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.
- Invisible panels and their children are not drawn or updated and do not receive input messages.
IsFullyVisible()checks parent panels for visibility too.
- Disabled panels do not receive input and are often drawn with muted colours to indicate this.
- Called every frame before painting if the panel is visible. To do: What about
Think()? Is it obsolete? Does it run even if the panel isn't visible?
- Called at regular intervals if
- Confirm:When a panel is proportional, its layout values are interpreted as being relative to a 640*480 screen. This allows you to position a panel at 64,48 and be certain that it will always be 10% away from the screen edge, regardless of the current resolution. This system does not respond well to changes in aspect ratio. The
r.res keywords were added to resolve this issue.
SetPos(), GetPos(), SetSize(), GetSize(), SetBounds(), GetBounds(), GetWide(), SetWide(), GetTall(), SetTall()
- Functions for configuring the panel's position or size, or both at once.
A panel is drawn by its "paint" functions.
Paint() are enabled by default.
- Draws the background of the panel.
- Draws the contents of the panel. Confirm:Does not draw children.
- Paints a border around the panel.
SetBorder()must be called before
- Get an
swarm/resource/sourcescheme.resfor examples of border definitions.
- Get an
- Performs arbitrary drawing after the panel's children have been painted (i.e. above them).
- Prevents a child from drawing, Confirm:without stopping it from thinking.
- Sets the alpha of this panel and its children panels. 0 is invisible, 255 is opaque.
Each panel has one parent and can have many children. Unless made a popup, children are drawn relative to and within the confines of their parent panel.
- Gets/sets this panel's parent.
- Is the given panel somewhere above this one in the hierarchy?
Panel *GetChild(int index)
Panel *FindChildByName(char* childName, bool recurseDown = false)
- Provides access to child panels.
- Called when a child is added to this panel.
PopupMakePopup(bool showTaskbarIcon = true,bool disabled = false)
- Popup panels draw outside of their parent's space and do not follow it around.
These can be used within a .res layout file.
- Sets the control's name. Default is NULL.
- The initial size of the panel.
- The X and Y position of the panel's pinned corner relative to its parent. By default this value is an offset from the left/top edge, but the special characters
rallow positioning relative to the centre and right/bottom edge respectively. Examples:
- The pinned corner is the one positioned at xpos/ypos. Values are:
- To do
- The Z position. Default is
1. Higher numbers are drawn on top of lower numbers.
- To do: "Only get colors if we're ignoring the scheme." See also
- Whether the control is visible.
- Whether the control can be used.
- Controls the order in which panels are focused on when is pressed. Valid range is 0-255. Default is 0.
- Text displayed when mouse is hovered over this panel. No support on consoles.
- Whether to draw the background/border of the panel. Default is -1, which means no value will be applied.
- Sets which edges of the panel can be resized. Values are: