diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /utils/vgui_panel_zoo/FrameDemo.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'utils/vgui_panel_zoo/FrameDemo.cpp')
| -rw-r--r-- | utils/vgui_panel_zoo/FrameDemo.cpp | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/utils/vgui_panel_zoo/FrameDemo.cpp b/utils/vgui_panel_zoo/FrameDemo.cpp new file mode 100644 index 0000000..422c208 --- /dev/null +++ b/utils/vgui_panel_zoo/FrameDemo.cpp @@ -0,0 +1,91 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// +#include "DemoPage.h" + +#include <VGUI/IVGui.h> +#include <vgui_controls/Controls.h> + +#include <Keyvalues.h> +#include <vgui_controls/Frame.h> + + +using namespace vgui; + + +class FrameDemo: public DemoPage +{ + public: + FrameDemo(Panel *parent, const char *name); + ~FrameDemo(); + + void OnButtonClicked(); + + void SetVisible(bool status); + + private: + Frame *m_pFrame; + +}; + +//----------------------------------------------------------------------------- +// Purpose: Constructor +//----------------------------------------------------------------------------- +FrameDemo::FrameDemo(Panel *parent, const char *name) : DemoPage(parent, name) +{ + // Create a Frame. + // This frame has no parent, this way if you press the minimize button + // a label will go on the taskbar. + m_pFrame = new Frame(NULL, "AFrame"); + + // Frames are well, a "frame" around a panel. They have a name bar + // at the top where a title can be displayed, sizing hotspots on the corners, + // and a minimize and close box in the upper right corner. + + // Set the title of the frame + m_pFrame->SetTitle("A Demo Frame", ""); + + // Frames are sizable and moveable by default. + + // Set its position and size + m_pFrame->SetSize(300, 100); + + // Set its Position + m_pFrame->MoveToCenterOfScreen(); + + // Start the frame off invisible. This way it will not be visible when + // other demo tabs are selected. It becomes visible when this demo tab is selected. + m_pFrame->SetVisible(false); + +} + +//----------------------------------------------------------------------------- +// Purpose: Destructor +//----------------------------------------------------------------------------- +FrameDemo::~FrameDemo() +{ +} + +//----------------------------------------------------------------------------- +// Purpose: When we make this this demo page we make the frame visible. +//----------------------------------------------------------------------------- +void FrameDemo::SetVisible(bool status) +{ + if (status) + m_pFrame->SetVisible(true); + else + m_pFrame->SetVisible(false); + + DemoPage::SetVisible(status); +} + + +Panel* FrameDemo_Create(Panel *parent) +{ + return new FrameDemo(parent, "FrameDemo"); +} + + |