CBaseModFrame: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Created page with ''''<code>CBaseModFrame</code>''' is the basic C++ class that each user interface panel in L4D-branch GameUI inherits from. == Simple example == <source lang=cpp> #include "…')
 
mNo edit summary
 
Line 1: Line 1:
'''<code>CBaseModFrame</code>''' is the basic C++ class that each user interface panel in L4D-branch [[GameUI]] inherits from.
'''<code>CBaseModFrame</code>''' is the basic C++ class that each user interface window in [[GameUI]] inherits from.


== Simple example ==
== Simple example ==
Line 58: Line 58:
* [[GameUI]]
* [[GameUI]]


[[Category:VGUI]] [[Category:Classes]]
[[Category:VGUI]] [[Category:Classes|B]]

Latest revision as of 08:00, 3 August 2011

CBaseModFrame is the basic C++ class that each user interface window in GameUI inherits from.

Simple example

#include "gameui\swarm\basemodui.h"

using namespace BaseModUI;

class MyWindow : public CBaseModFrame
{
	DECLARE_CLASS_SIMPLE( MyWindow, CBaseModFrame );

public:
	MyWindow(vgui::Panel *parent, const char *panelName):BaseClass(parent, panelName) { }
};

A "MyWindow.res" layout script is also required in resource\ui\basemodui\:

Resource/UI/MyWindow.res
{
	MyWindow
	{
		ControlName		Frame
		fieldName		MyWindow
		xpos			c
		ypos			c
		wide			1024
		tall			768
		autoResize		0
		pinCorner		0
		visible			1
		enabled			1
		tabPosition		0
		usetitlesafe		1
	}
}

Key functions

  • void OnOpen()
  • void OnClose()
  • void SetDataSettings(KeyValues*)
  • CBaseModFrame* SetNavBack(CBaseModFrame*)
  • CBaseModFrame* GetNavBack()
  • void PushModalInputFocus()
    • void PopModalInputFocus()
  • void RunFrame()
  • void AddFrameListener(IBaseModFrameListener*)
    • void RemoveFrameListener(IBaseModFrameListener*)
    • void RunFrameOnListeners()

See also