Panel

From Valve Developer Community
Revision as of 10:04, 2 August 2011 by Artfunkel (talk | contribs) (Created page with "'''<code>vgui::Panel</code>''' is the base class of all VGUI elements. It is a rectangle which covers an area of the screen and can draw itself, handle events, and host child...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

vgui::Panel is the base class of all VGUI elements. It is a rectangle which covers an area of the screen and can draw itself, handle events, and host children.

Important functions

General

SetVisible(bool)
Whether the panel is drawn.
Todo: Does processing continue?

Painting

A panel is drawn in its "paint" functions. PaintBackground() and Paint() are enabled by default.

PaintBackground()
SetPaintBackgroundEnabled(bool)
Draws the background of the panel.
Paint()
SetPaintEnabled(bool)
Draws the contents of the panel.
Confirm:Does not draw children.
PaintBorder()
SetPaintBorderEnabled(bool)
SetBorder(IBorder *border)
IBorder *GetBorder()
Paints a border around the panel. SetBorder() must be called before SetPaintBorderEnabled().
  • Get an IBorder from IScheme::GetBorder() in ApplySchemeSettings().
  • See swarm/resource/sourcescheme.res for examples of border definitions.
PostChildPaint()
SetPostChildPaintEnabled(bool)
Performs arbitrary drawing after the panel's children have been painted (i.e. on top of them).