22 #include "precompiled.h"
48 AddSetting(GUIST_CGUISpriteInstance,
"sprite");
49 AddSetting(GUIST_CGUISpriteInstance,
"sprite_selectarea");
53 AddSetting(GUIST_CColor,
"textcolor_selected");
93 std::vector<SGUIText*>::iterator it;
117 float buffer_zone=0.f;
121 float buffered_y = 0.f;
123 for (
int i=0; i<(int)pList->
m_Items.size(); ++i)
161 switch (Message.
type)
164 if (Message.
value ==
"list")
170 if (Message.
value ==
"selected")
178 if (Message.
value ==
"scrollbar")
184 if (Message.
value ==
"scrollbar_style")
186 CStr scrollbar_style;
222 for (
int i=0; i<(int)pList->
m_Items.size(); ++i)
265 CStr scrollbar_style;
324 DrawList(selected,
"sprite",
"sprite_selectarea",
"textcolor");
329 const CStr& _sprite_selected,
330 const CStr& _textcolor)
373 if (rect_sel.top <= rect.
bottom &&
374 rect_sel.bottom >= rect.
top)
376 if (rect_sel.bottom > rect.
bottom)
377 rect_sel.bottom = rect.
bottom;
378 if (rect_sel.top < rect.
top)
379 rect_sel.top = rect.
top;
384 if (rect_sel.right >
GetScrollBar(0).GetOuterRect().left &&
388 if (rect_sel.left >=
GetScrollBar(0).GetOuterRect().left &&
400 for (
int i=0; i<(int)pList->
m_Items.size(); ++i)
433 pList->
m_Items.push_back( gui_string );
437 pListData->
m_Items.push_back( data_string );
467 if (selected != (
int)pList->
m_Items.size()-1)
513 if (selected != (
int)pList->
m_Items.size()-1)
void DrawSprite(const CGUISpriteInstance &Sprite, int CellID, const float &Z, const CRect &Rect, const CRect &Clipping=CRect())
Draw GUI Sprite.
virtual InReaction ManuallyHandleEvent(const SDL_Event_ *ev)
Handle events manually to catch keyboard inputting.
void DrawList(const int &selected, const CStr &_sprite, const CStr &_sprite_selected, const CStr &_textcolor)
const PSRETURN PSRETURN_OK
void ScriptEvent(const CStr &Action)
Execute the script for a particular action.
ISoundManager * g_SoundManager
int GetElementID(const char *Name) const
float left
Returning CPos representing each corner.
static PSRETURN GetSetting(const IGUIObject *pObject, const CStr &Setting, T &Value)
Retrieves a setting by name from object pointer.
virtual void AddItem(const CStrW &str, const CStrW &data)
Adds an item last to the list.
virtual void PlayAsUI(const VfsPath &itemPath, bool looping)=0
void SetupText()
Sets up text, should be called every time changes has been made that can change the visual...
virtual void HandleMessage(SGUIMessage &Message)
virtual void Draw()
Draws the List box.
virtual float GetBufferedZ() const
Returns not the Z value, but the actual buffered Z value, i.e.
Includes static functions that needs one template argument.
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
CSize m_Size
Width and height of the whole output, used when setting up scrollbars and such.
std::vector< float > m_ItemsYPositions
List of each element's relative y position.
virtual void HandleMessage(SGUIMessage &Message)
std::vector< CGUIString > m_Items
List of items (as text), the post-processed result is stored in the IGUITextOwner structure of this c...
void AddSetting(const EGUISettingType &Type, const CStr &Name)
Add a setting to m_Settings.
void SetValue(const CStrW &str)
Set the value, the string will automatically be parsed when set.
Made to represent screen positions and delta values.
CPos GetMousePos() const
Get Mouse from CGUI.
virtual CRect GetListRect() const
virtual void DrawText(int index, const CColor &color, const CPos &pos, float z, const CRect &clipping=CRect())
Draws the Text.
static PSRETURN SetSetting(IGUIObject *pObject, const CStr &Setting, const T &Value, const bool &SkipMessage=false)
Sets a value by name using a real datatype as input.
virtual void SelectNextElement()
Easy select elements functions.
virtual void SelectLastElement()
virtual void SelectFirstElement()
virtual bool HandleAdditionalChildren(const XMBElement &child, CXeromyces *pFile)
Handle the <item> tag.
std::vector< SGUIText * > m_GeneratedTexts
Texts that are generated and ready to be rendered.
Message send to IGUIObject::HandleMessage() in order to give life to Objects manually with a derived ...
EGUIMessageType type
Describes what the message regards.
void AddText(SGUIText *text)
Adds a text object.
String class, substitute for CStr, but that parses the tags and builds up a list of all text that wil...
SGUIText GenerateText(const CGUIString &Text, const CStrW &Font, const float &Width, const float &BufferZone, const IGUIObject *pObject=NULL)
Generate a SGUIText object from the inputted string.
virtual void SelectPrevElement()
CPos TopLeft() const
Get Position equivalent to top/left corner.
static PSRETURN GetSettingPointer(const IGUIObject *pObject, const CStr &Setting, T *&Value)
An SGUIText object is a parsed string, divided into text-rendering components.
Rectangle class used for screen rectangles.