CBaseModFrame

From Valve Developer Community
Jump to navigation Jump to search

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