G3D::GuiSkin Class ReferenceRenders UI elements.
More...
#include <GuiSkin.h>
Inherits G3D::ReferenceCountedObject.
List of all members.
|
Public Types |
| enum | ButtonStyle { NORMAL_BUTTON_STYLE,
TOOL_BUTTON_STYLE,
NO_BUTTON_STYLE,
BUTTON_STYLE_COUNT
} |
| enum | PaneStyle { SIMPLE_PANE_STYLE,
ORNATE_PANE_STYLE,
PANE_STYLE_COUNT
} |
typedef ReferenceCountedPointer<
class GuiSkin > | Ref |
| enum | WindowStyle {
NORMAL_WINDOW_STYLE,
TOOL_WINDOW_STYLE,
DIALOG_WINDOW_STYLE,
DRAWER_WINDOW_STYLE,
WINDOW_STYLE_COUNT
} |
Public Member Functions |
| void | beginRendering (class RenderDevice *rd) |
| Rect2D | clientToPaneBounds (const Rect2D &bounds, PaneStyle paneStyle) const |
| Rect2D | clientToWindowBounds (const Rect2D &bounds, WindowStyle frameStyle) const |
| Rect2D | dropDownListToClickBounds (const Rect2D &bounds) const |
| void | endRendering () |
| Rect2D | horizontalSliderToThumbBounds (const Rect2D &bounds, float pos) const |
| Rect2D | horizontalSliderToTrackBounds (const Rect2D &bounds) const |
| Rect2D | paneToClientBounds (const Rect2D &bounds, PaneStyle paneStyle) const |
| void | popClientRect () |
| void | pushClientRect (const Rect2D &r) |
| void | ReferenceCountedObject_zeroWeakPointers () |
| void | renderButton (const Rect2D &bounds, bool enabled, bool focused, bool pushed, const GuiCaption &text, ButtonStyle buttonStyle) const |
| void | renderCheckBox (const Rect2D &bounds, bool enabled, bool focused, bool checked, const GuiCaption &text) const |
| void | renderDropDownList (const Rect2D &bounds, bool enabled, bool focused, bool menuOpen, const GuiCaption &contentText, const GuiCaption &text) const |
| void | renderHorizontalSlider (const Rect2D &bounds, float pos, bool enabled, bool focused, const GuiCaption &text) const |
| void | renderLabel (const Rect2D &bounds, const GuiCaption &text, GFont::XAlign xalign, GFont::YAlign yalign, bool enabled) const |
| void | renderPane (const Rect2D &bounds, PaneStyle paneStyle) const |
| void | renderRadioButton (const Rect2D &bounds, bool enabled, bool focused, bool checked, const GuiCaption &text) const |
| void | renderTextBox (const Rect2D &bounds, bool enabled, bool focused, const GuiCaption &caption, const GuiCaption &text, const GuiCaption &cursor, int cursorPosition) const |
| void | renderWindow (const Rect2D &bounds, bool focused, bool hasCloseButton, bool closeButtonIsDown, bool closeIsFocused, const GuiCaption &text, WindowStyle frameStyle) const |
| Rect2D | textBoxToClickBounds (const Rect2D &bounds) const |
| Rect2D | windowToClientBounds (const Rect2D &bounds, WindowStyle frameStyle) const |
| Rect2D | windowToCloseButtonBounds (const Rect2D &bounds, WindowStyle frameStyle) const |
| Rect2D | windowToTitleBounds (const Rect2D &bounds, WindowStyle frameStyle) const |
Static Public Member Functions |
| static GuiSkinRef | fromFile (const std::string &filename, const GFont::Ref &fallbackFont, float fallbackSize=11, const Color4 &fallbackColor=Color3::black(), const Color4 &fallbackOutlineColor=Color4::clear()) |
| static void | makeSkinFromSourceFiles (const std::string &sourceDir, const std::string &whiteName, const std::string &blackName, const std::string &coordsFile, const std::string &destFile) |
Public Attributes |
| AtomicInt32 | ReferenceCountedObject_refCount |
| _WeakPtrLinkedList * | ReferenceCountedObject_weakPointer |
Classes |
| class | Button |
| class | Checkable |
| | Used for radio and check boxes.
|
| class | DropDownList |
| class | Fill |
| class | HSlider |
| class | Pad |
| class | Pane |
| class | StretchRectH |
| | Horizontal stretch--two caps and a center fill.
|
| class | StretchRectHV |
| | Stretchable in horizontal and vertical direction.
|
| class | StretchRectV |
| | Vertical stretch--two caps and a center fill.
|
| class | Text |
| | Used for delayed text rendering.
|
| class | TextBox |
| class | TextStyle |
| | Default style information for captions.
|
| class | Window |
| class | WindowButton |
| | Window close, minimize, maximize.
|
Detailed Description
Renders UI elements.
Loads and renders G3D GUI .skn files, which can be used with G3D::Gui. .skn files can be found in the data module data/gui directory.
Can also be used to explicitly render a UI without actual controls behind it, for example:
skin->beginRendering(rd);
skin->renderWindow(rd, Rect2D::xywh(80, 70, 550, 250), false, false, false, "Window", GuiSkin::NORMAL_WINDOW_STYLE);
skin->renderWindow(rd, Rect2D::xywh(500, 120, 50, 150), true, true, true, "Tools", GuiSkin::TOOL_WINDOW_STYLE);
skin->renderCheckBox(rd, Rect2D::xywh(100, 100, 20, 20), true, true, true, "Check box");
skin->renderRadioButton(rd, Rect2D::xywh(100, 120, 20, 20), true, false, false, "Radio button");
skin->renderButton(rd, Rect2D::xywh(100, 160, 80, 27), true, true, true, "Button");
skin->setFont(timesFont, 12, Color3::black(), Color4::clear());
skin->renderButton(rd, Rect2D::xywh(200, 160, 80, 27), true, true, true, "New Font");
skin->setFont(arialFont, 10, Color3::black(), Color4::clear());
skin->renderHorizontalSlider(rd, Rect2D::xywh(100, 200, 150, 27), 0.5f, true, false, "Slider");
int s = 30;
skin->renderButton(rd, Rect2D::xywh(100 + s * 0, 230, 30, 30), true, false, false, GuiCaption("7", iconFont));
skin->renderButton(rd, Rect2D::xywh(100 + s * 1, 230, 30, 30), true, false, false, GuiCaption("4", iconFont));
skin->renderButton(rd, Rect2D::xywh(100 + s * 2, 230, 30, 30), true, false, false, GuiCaption("=", iconFont));
skin->renderButton(rd, Rect2D::xywh(100 + s * 3, 230, 30, 30), true, false, true, GuiCaption(";", iconFont));
skin->renderButton(rd, Rect2D::xywh(100 + s * 4, 230, 30, 30), true, false, false, GuiCaption("<", iconFont));
skin->renderButton(rd, Rect2D::xywh(100 + s * 5, 230, 30, 30), true, false, false, GuiCaption("8", iconFont));
skin->setFont(arialFont, 10, Color3::black(), Color4::clear());
skin->endRendering(rd);
- See also:
- G3D::GuiWindow
Member Typedef Documentation
Member Enumeration Documentation
- Enumerator:
-
| NORMAL_BUTTON_STYLE |
|
| TOOL_BUTTON_STYLE |
|
| NO_BUTTON_STYLE |
|
| BUTTON_STYLE_COUNT |
|
- Enumerator:
-
| SIMPLE_PANE_STYLE |
|
| ORNATE_PANE_STYLE |
|
| PANE_STYLE_COUNT |
|
- Enumerator:
-
| NORMAL_WINDOW_STYLE |
|
| TOOL_WINDOW_STYLE |
|
| DIALOG_WINDOW_STYLE |
|
| DRAWER_WINDOW_STYLE |
|
| WINDOW_STYLE_COUNT |
|
Member Function Documentation
| void G3D::GuiSkin::beginRendering |
( |
class RenderDevice * |
rd |
) |
|
Call before all other render methods.
- Parameters:
-
| offset | Offset all positions by this amount (convenient for rendering relative to a containing control or window.) |
Given the area that controls should appear in for a window, returns the bounds that should be used to draw the window.
Note that the window's shadow or other effects may exceed these bounds when rendering.
| Rect2D G3D::GuiSkin::dropDownListToClickBounds |
( |
const Rect2D & |
bounds |
) |
const |
Given the bounds of a full dropDownList and caption, returns the bounds around just the control itself.
| void G3D::GuiSkin::endRendering |
( |
|
) |
|
Call after all other render methods.
| static GuiSkinRef G3D::GuiSkin::fromFile |
( |
const std::string & |
filename, |
|
|
const GFont::Ref & |
fallbackFont, |
|
|
float |
fallbackSize = 11, |
|
|
const Color4 & |
fallbackColor = Color3::black(), |
|
|
const Color4 & |
fallbackOutlineColor = Color4::clear() | |
|
) |
| | [static] |
May return a cached copy.
- Parameters:
-
| filename | Name of the .skn file. |
| Rect2D G3D::GuiSkin::horizontalSliderToThumbBounds |
( |
const Rect2D & |
bounds, |
|
|
float |
pos | |
|
) |
| | const |
Returns the position of the thumb button, which is needed for processing UI events for the slider.
| Rect2D G3D::GuiSkin::horizontalSliderToTrackBounds |
( |
const Rect2D & |
bounds |
) |
const |
| static void G3D::GuiSkin::makeSkinFromSourceFiles |
( |
const std::string & |
sourceDir, |
|
|
const std::string & |
whiteName, |
|
|
const std::string & |
blackName, |
|
|
const std::string & |
coordsFile, |
|
|
const std::string & |
destFile | |
|
) |
| | [static] |
Create a .skn file from source files.
Used as a preprocess when creating new skins. You probably don't need to call this because most people will want to use pre-existing skins (making a skin is a time-consuming artistic process!)
- Parameters:
-
| sourceDir | Must end in a slash. |
| whiteName | Image of controls on a white background, must be in sourceDir |
| blackName | Image of controls on a black background, must be in sourceDir |
| coordsFile | Text file describing the location of controls |
| destFile | Output .skn file, not relative to sourceDir |
| void G3D::GuiSkin::popClientRect |
( |
|
) |
|
| void G3D::GuiSkin::pushClientRect |
( |
const Rect2D & |
r |
) |
|
Offsets all subsequent rendering by r.x0y0() and sets the clipping region to r.
Call only between beginRendering and endRendering.
| void G3D::ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers |
( |
|
) |
[inline, inherited] |
Automatically called immediately before the object is deleted.
This is not called from the destructor because it needs to be invoked before the subclass destructor.
| void G3D::GuiSkin::renderButton |
( |
const Rect2D & |
bounds, |
|
|
bool |
enabled, |
|
|
bool |
focused, |
|
|
bool |
pushed, |
|
|
const GuiCaption & |
text, |
|
|
ButtonStyle |
buttonStyle | |
|
) |
| | const |
Only call between beginRendering and endRendering.
| void G3D::GuiSkin::renderCheckBox |
( |
const Rect2D & |
bounds, |
|
|
bool |
enabled, |
|
|
bool |
focused, |
|
|
bool |
checked, |
|
|
const GuiCaption & |
text | |
|
) |
| | const |
Only call between beginRendering and endRendering.
| void G3D::GuiSkin::renderDropDownList |
( |
const Rect2D & |
bounds, |
|
|
bool |
enabled, |
|
|
bool |
focused, |
|
|
bool |
menuOpen, |
|
|
const GuiCaption & |
contentText, |
|
|
const GuiCaption & |
text | |
|
) |
| | const |
| void G3D::GuiSkin::renderHorizontalSlider |
( |
const Rect2D & |
bounds, |
|
|
float |
pos, |
|
|
bool |
enabled, |
|
|
bool |
focused, |
|
|
const GuiCaption & |
text | |
|
) |
| | const |
Only call between beginRendering and endRendering.
Label is on the right, slider is aligned with the left edge - Parameters:
-
| pos | 0 = left edge, 1 = right edge |
Only call between beginRendering and endRendering.
| void G3D::GuiSkin::renderPane |
( |
const Rect2D & |
bounds, |
|
|
PaneStyle |
paneStyle | |
|
) |
| | const |
| void G3D::GuiSkin::renderRadioButton |
( |
const Rect2D & |
bounds, |
|
|
bool |
enabled, |
|
|
bool |
focused, |
|
|
bool |
checked, |
|
|
const GuiCaption & |
text | |
|
) |
| | const |
Only call between beginRendering and endRendering.
| void G3D::GuiSkin::renderTextBox |
( |
const Rect2D & |
bounds, |
|
|
bool |
enabled, |
|
|
bool |
focused, |
|
|
const GuiCaption & |
caption, |
|
|
const GuiCaption & |
text, |
|
|
const GuiCaption & |
cursor, |
|
|
int |
cursorPosition | |
|
) |
| | const |
Render a single-line text box.
Only call between beginRendering and endRendering. Automatically shifts text so that a cursor at character index given by cursorPosition is visible on screen.
| void G3D::GuiSkin::renderWindow |
( |
const Rect2D & |
bounds, |
|
|
bool |
focused, |
|
|
bool |
hasCloseButton, |
|
|
bool |
closeButtonIsDown, |
|
|
bool |
closeIsFocused, |
|
|
const GuiCaption & |
text, |
|
|
WindowStyle |
frameStyle | |
|
) |
| | const |
Only call between beginRendering and endRendering.
- Parameters:
-
| bounds | Corresponds to the footprint of the window; dropshadows and glows may still render outside this area. |
| Rect2D G3D::GuiSkin::textBoxToClickBounds |
( |
const Rect2D & |
bounds |
) |
const |
Given the bounds on a window's borders, returns the bounds of the area inside the window where controls will appear.
Member Data Documentation
The long name is to keep this from accidentally conflicting with a subclass's variable name.
Do not use or explicitly manipulate this value--its type may change in the future and is not part of the supported API.
Linked list of all weak pointers that reference this (some may be on the stack!).
Do not use or explicitly manipulate this value.
The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:46 2007 for G3D by
1.5.2
Hosted by
|