#include <guibackground.h>
Inheritance diagram for GuiBorder:
Public Member Functions | |
DECLSPEC | GuiBorder (const SDL_Rect &r, GuiElement *p, const char *name, SdlSurfaceContainer *bmps=0, bool themestyle=true) |
DECLSPEC | GuiBorder (TiXmlElement *el, GuiElement *p) |
virtual const char * | getClassName () |
DECLSPEC void | setBmps (SdlSurfaceContainer *sc) |
SdlSurfaceContainer * | getBmps () |
| |
Static Public Member Functions | |
static void | newguiobject (void *presult, BasicObject *o, void *xmldata) |
Public Attributes | |
bool | invert |
bool | neutral |
bool | left |
determine the visibility of the borders | |
bool | right |
bool | top |
bool | bottom |
Protected Member Functions | |
virtual DECLSPEC Uint32 | onResize () |
virtual DECLSPEC Uint32 | onFrame (SdlSurface *dst) |
virtual DECLSPEC void | onInit () |
virtual DECLSPEC Uint32 | onThemeChanged (UiTheme *t) |
Protected Attributes | |
bool | bCanNeutral |
if true, flat mode is possible | |
bool | bShowBorder |
if true, border is shown, if false, it is hidden | |
int | nCornerWidth |
size of the border's corner | |
int | nCornerHeight |
int | nBmpWidth |
width of horizontal border surface | |
int | nBmpHeight |
height of vertical border surface |
This class is used to draw a border to the rect's boundary. The borders at the top, bottom, left and right can appear different or be hidden. Corners are displayed using other bitmap-sources.
The appearance can be switched between three modes: raised, flat or sunken, by setting the variables neutral and invert accordingly.
GuiBorder::GuiBorder | ( | const SDL_Rect & | r, | |
GuiElement * | p, | |||
const char * | name, | |||
SdlSurfaceContainer * | bmps = 0 , |
|||
bool | themestyle = true | |||
) |
Constructor.
r | the rect of the element's appearance, relative to the parent's top-left position | |
p | the parent element; or NULL, if it will be used as top level | |
bmps | the source for the look of the borders; if flat (neutral) mode should be possible, at least 18 surfaces have to be in the container: always three surfaces belong together, the first should be light, the second dark, the third is shown in flat mode; the first three are used to show horizontal borders, the next for vertical borders, then the corners follow: top-left, top-right, bottom-left, bottom-right (6 * 3 = 18). If flat mode is not needed, then 6 * 2 = 12 surfaces are needed, because there are always two in a group (the neutral is not needed). If this param is NULL, the theme's default surfaces are taken. | |
themestyle | if true, the variables neutral and invert are set as the theme wants them to be, but changing them has still the same effect as if the param is false. |
GuiBorder::GuiBorder | ( | TiXmlElement * | el, | |
GuiElement * | p | |||
) |
Constructor. Uses XML data.
el | the XML data for initialisation, the following attributes are read: InvertBorder, BorderEdges, HideBorder, BorderBmps, NeutralBorder, BorderTheme | |
p | parent element (or NULL, to take GuiManager::the as parent) |
virtual const char* GuiBorder::getClassName | ( | ) | [inline, virtual] |
This function should be overriden in every sub-class of BasicObject!
Reimplemented from GuiElement.
Reimplemented in GuiDynamicButton, GuiClickableBtn, GuiCheckableBtn, GuiRadioBtn, and GuiForm.
void GuiBorder::setBmps | ( | SdlSurfaceContainer * | sc | ) |
Changes the source surfaces for the border's look
sc | the surfaces that are used; if less than 18 are in the container, flat (neutral) mode is switched off, otherwise it is switched on |
Uint32 GuiBorder::onResize | ( | ) | [protected, virtual] |
This event is called, when the element changed its place or size.
Reimplemented from GuiElement.
Uint32 GuiBorder::onFrame | ( | SdlSurface * | dst | ) | [protected, virtual] |
This event is called, when a frame is drawn. If the object should be visible, is has to draw it's look to a valid surface. This method calls the children's function, if visible.
Reimplemented from GuiElement.
Reimplemented in GuiDynamicButton.
void GuiBorder::onInit | ( | ) | [protected, virtual] |
Initializes the object's variables by reading data from the XML element. If there were no XML data used for creation, nothing is done. This function calls onInit() of its children recursively (after it has inited itself). It is highly recommended to call BasicObject::onInit(), usually at the end of the onInit() method, when overwriting it in a derived class.
Reimplemented from GuiElement.
Reimplemented in GuiDynamicButton, GuiClickableBtn, GuiCheckableBtn, GuiRadioBtn, and GuiForm.
Uint32 GuiBorder::onThemeChanged | ( | UiTheme * | t | ) | [protected, virtual] |
This event is called, when the theme changes. Perform here the changes of the object's look and feel.
t | pointer to the new used theme |
Reimplemented from GuiElement.
Reimplemented in GuiDynamicButton, GuiClickableBtn, GuiCheckableBtn, GuiRadioBtn, and GuiForm.
bool GuiBorder::invert |
if neutral is true, invert has no effect; otherwise, if invert, the usually dark borders become light and the other way round