Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
IGUIObject.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2012 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 /*
19 IGUIObject
20 */
21 
22 #include "precompiled.h"
23 #include "GUI.h"
24 
25 #include "ps/Parser.h"
26 
30 
31 #include "ps/CLogger.h"
32 
33 extern int g_xres, g_yres;
34 
35 
36 //-------------------------------------------------------------------
37 // Implementation Macros
38 //-------------------------------------------------------------------
39 
40 //-------------------------------------------------------------------
41 // Constructor / Destructor
42 //-------------------------------------------------------------------
44  m_pGUI(NULL),
45  m_pParent(NULL),
46  m_MouseHovering(false),
47  m_JSObject(NULL)
48 {
49  AddSetting(GUIST_bool, "enabled");
50  AddSetting(GUIST_bool, "hidden");
51  AddSetting(GUIST_CClientArea, "size");
52  AddSetting(GUIST_CStr, "style");
53  AddSetting(GUIST_CStr, "hotkey" );
54  AddSetting(GUIST_float, "z");
55  AddSetting(GUIST_bool, "absolute");
56  AddSetting(GUIST_bool, "ghost");
57  AddSetting(GUIST_float, "aspectratio");
58 
59  // Setup important defaults
60  GUI<bool>::SetSetting(this, "hidden", false);
61  GUI<bool>::SetSetting(this, "ghost", false);
62  GUI<bool>::SetSetting(this, "enabled", true);
63  GUI<bool>::SetSetting(this, "absolute", true);
64 
65 
66  for (int i=0; i<6; i++)
67  m_LastClickTime[i]=0;
68 }
69 
71 {
72  {
73  std::map<CStr, SGUISetting>::iterator it;
74  for (it = m_Settings.begin(); it != m_Settings.end(); ++it)
75  {
76  switch (it->second.m_Type)
77  {
78  // delete() needs to know the type of the variable - never delete a void*
79 #define TYPE(t) case GUIST_##t: delete (t*)it->second.m_pSetting; break;
80 #include "GUItypes.h"
81 #undef TYPE
82  default:
83  debug_warn(L"Invalid setting type");
84  }
85  }
86  }
87 
88  {
89  std::map<CStr, JSObject**>::iterator it;
90  for (it = m_ScriptHandlers.begin(); it != m_ScriptHandlers.end(); ++it)
91  {
92  JS_RemoveObjectRoot(g_ScriptingHost.getContext(), it->second);
93  delete it->second;
94  }
95  }
96 
97  if (m_JSObject)
98  JS_RemoveObjectRoot(g_ScriptingHost.getContext(), &m_JSObject);
99 }
100 
101 //-------------------------------------------------------------------
102 // Functions
103 //-------------------------------------------------------------------
105 {
106  //
107 // ENSURE(pChild);
108 
109  pChild->SetParent(this);
110 
111  m_Children.push_back(pChild);
112 
113  // If this (not the child) object is already attached
114  // to a CGUI, it pGUI pointer will be non-null.
115  // This will mean we'll have to check if we're using
116  // names already used.
117  if (pChild->GetGUI())
118  {
119  try
120  {
121  // Atomic function, if it fails it won't
122  // have changed anything
123  //UpdateObjects();
124  pChild->GetGUI()->UpdateObjects();
125  }
126  catch (PSERROR_GUI&)
127  {
128  // If anything went wrong, reverse what we did and throw
129  // an exception telling it never added a child
130  m_Children.erase( m_Children.end()-1 );
131 
132  throw;
133  }
134  }
135  // else do nothing
136 }
137 
139 {
140  // Just don't do anything about the top node
141  if (m_pParent == NULL)
142  return;
143 
144  // Now actually add this one
145  // notice we won't add it if it's doesn't have any parent
146  // (i.e. being the base object)
147  if (m_Name.empty())
148  {
150  }
151  if (ObjectMap.count(m_Name) > 0)
152  {
153  throw PSERROR_GUI_NameAmbiguity(m_Name.c_str());
154  }
155  else
156  {
157  ObjectMap[m_Name] = this;
158  }
159 }
160 
162 {
163  // Is there anything besides the children to destroy?
164 }
165 
166 // Notice if using this, the naming convention of GUIST_ should be strict.
167 #define TYPE(type) \
168  case GUIST_##type: \
169  m_Settings[Name].m_pSetting = new type(); \
170  break;
171 
172 void IGUIObject::AddSetting(const EGUISettingType &Type, const CStr& Name)
173 {
174  // Is name already taken?
175  if (m_Settings.count(Name) >= 1)
176  return;
177 
178  // Construct, and set type
179  m_Settings[Name].m_Type = Type;
180 
181  switch (Type)
182  {
183  // Construct the setting.
184  #include "GUItypes.h"
185 
186  default:
187  debug_warn(L"IGUIObject::AddSetting failed, type not recognized!");
188  break;
189  }
190 }
191 #undef TYPE
192 
193 
195 {
196  if(!GetGUI())
198 
200 }
201 
203 {
204  return false;
205 }
206 
208 {
209  return ((GetGUI())?(GetGUI()->m_MousePos):CPos());
210 }
211 
212 void IGUIObject::UpdateMouseOver(IGUIObject * const &pMouseOver)
213 {
214  // Check if this is the object being hovered.
215  if (pMouseOver == this)
216  {
217  if (!m_MouseHovering)
218  {
219  // It wasn't hovering, so that must mean it just entered
220  SendEvent(GUIM_MOUSE_ENTER, "mouseenter");
221  }
222 
223  // Either way, set to true
224  m_MouseHovering = true;
225 
226  // call mouse over
227  SendEvent(GUIM_MOUSE_OVER, "mousemove");
228  }
229  else // Some other object (or none) is hovered
230  {
231  if (m_MouseHovering)
232  {
233  m_MouseHovering = false;
234  SendEvent(GUIM_MOUSE_LEAVE, "mouseleave");
235  }
236  }
237 }
238 
239 bool IGUIObject::SettingExists(const CStr& Setting) const
240 {
241  // Because GetOffsets will direct dynamically defined
242  // classes with polymorphism to respective ms_SettingsInfo
243  // we need to make no further updates on this function
244  // in derived classes.
245  //return (GetSettingsInfo().count(Setting) >= 1);
246  return (m_Settings.count(Setting) >= 1);
247 }
248 
249 #define TYPE(type) \
250  else \
251  if (set.m_Type == GUIST_##type) \
252  { \
253  type _Value; \
254  if (!GUI<type>::ParseString(Value, _Value)) \
255  return PSRETURN_GUI_UnableToParse; \
256  \
257  GUI<type>::SetSetting(this, Setting, _Value, SkipMessage); \
258  }
259 
260 PSRETURN IGUIObject::SetSetting(const CStr& Setting, const CStrW& Value, const bool& SkipMessage)
261 {
262  if (!SettingExists(Setting))
263  {
265  }
266 
267  // Get setting
268  SGUISetting set = m_Settings[Setting];
269 
270  if (0);
271  // else...
272 #include "GUItypes.h"
273  else
274  {
275  // Why does it always fail?
276  //return PS_FAIL;
277  return LogInvalidSettings(Setting);
278  }
279  return PSRETURN_OK;
280 }
281 
282 #undef TYPE
283 
284 
285 PSRETURN IGUIObject::GetSettingType(const CStr& Setting, EGUISettingType &Type) const
286 {
287  if (!SettingExists(Setting))
288  {
289  return LogInvalidSettings(Setting);
290  }
291 
292  if (m_Settings.find(Setting) == m_Settings.end())
293  {
294  return LogInvalidSettings(Setting);
295  }
296 
297  Type = m_Settings.find(Setting)->second.m_Type;
298 
299  return PSRETURN_OK;
300 }
301 
302 
304 {
305  if (MouseOver())
306  {
307  // Check if we've got competition at all
308  if (pObject == NULL)
309  {
310  pObject = this;
311  return;
312  }
313 
314  // Or if it's closer
315  if (GetBufferedZ() >= pObject->GetBufferedZ())
316  {
317  pObject = this;
318  return;
319  }
320  }
321 }
322 
324 {
325  // Important, we're not using GetParent() for these
326  // checks, that could screw it up
327  if (m_pParent)
328  {
329  if (m_pParent->m_pParent == NULL)
330  return NULL;
331  }
332 
333  return m_pParent;
334 }
335 
337 {
338  bool absolute;
339  GUI<bool>::GetSetting(this, "absolute", absolute);
340 
341  float aspectratio = 0.f;
342  GUI<float>::GetSetting(this, "aspectratio", aspectratio);
343 
344  CClientArea ca;
345  GUI<CClientArea>::GetSetting(this, "size", ca);
346 
347  // If absolute="false" and the object has got a parent,
348  // use its cached size instead of the screen. Notice
349  // it must have just been cached for it to work.
350  if (absolute == false && m_pParent && !IsRootObject())
352  else
353  m_CachedActualSize = ca.GetClientArea(CRect(0.f, 0.f, (float)g_xres, (float)g_yres));
354 
355  // In a few cases, GUI objects have to resize to fill the screen
356  // but maintain a constant aspect ratio.
357  // Adjust the size to be the max possible, centered in the original size:
358  if (aspectratio)
359  {
361  {
362  float delta = m_CachedActualSize.GetWidth() - m_CachedActualSize.GetHeight()*aspectratio;
363  m_CachedActualSize.left += delta/2.f;
364  m_CachedActualSize.right -= delta/2.f;
365  }
366  else
367  {
368  float delta = m_CachedActualSize.GetHeight() - m_CachedActualSize.GetWidth()/aspectratio;
369  m_CachedActualSize.bottom -= delta/2.f;
370  m_CachedActualSize.top += delta/2.f;
371  }
372  }
373 }
374 
375 void IGUIObject::LoadStyle(CGUI &GUIinstance, const CStr& StyleName)
376 {
377  // Fetch style
378  if (GUIinstance.m_Styles.count(StyleName)==1)
379  {
380  LoadStyle(GUIinstance.m_Styles[StyleName]);
381  }
382  else
383  {
384  debug_warn(L"IGUIObject::LoadStyle failed");
385  }
386 }
387 
389 {
390  // Iterate settings, it won't be able to set them all probably, but that doesn't matter
391  std::map<CStr, CStrW>::const_iterator cit;
392  for (cit = Style.m_SettingsDefaults.begin(); cit != Style.m_SettingsDefaults.end(); ++cit)
393  {
394  // Try set setting in object
395  SetSetting(cit->first, cit->second);
396 
397  // It doesn't matter if it fail, it's not suppose to be able to set every setting.
398  // since it's generic.
399 
400  // The beauty with styles is that it can contain more settings
401  // than exists for the objects using it. So if the SetSetting
402  // fails, don't care.
403  }
404 }
405 
407 {
408  bool absolute;
409  GUI<bool>::GetSetting(this, "absolute", absolute);
410 
411  float Z;
412  GUI<float>::GetSetting(this, "z", Z);
413 
414  if (absolute)
415  return Z;
416  else
417  {
418  if (GetParent())
419  return GetParent()->GetBufferedZ() + Z;
420  else
421  {
422  // In philosophy, a parentless object shouldn't be able to have a relative sizing,
423  // but we'll accept it so that absolute can be used as default without a complaint.
424  // Also, you could consider those objects children to the screen resolution.
425  return Z;
426  }
427  }
428 }
429 
430 void IGUIObject::RegisterScriptHandler(const CStr& Action, const CStr& Code, CGUI* pGUI)
431 {
432  const int paramCount = 1;
433  const char* paramNames[paramCount] = { "mouse" };
434 
435  // Location to report errors from
436  CStr CodeName = GetName()+" "+Action;
437 
438  // Generate a unique name
439  static int x=0;
440  char buf[64];
441  sprintf_s(buf, ARRAY_SIZE(buf), "__eventhandler%d (%s)", x++, Action.c_str());
442 
443  JSFunction* func = JS_CompileFunction(g_ScriptingHost.getContext(), pGUI->m_ScriptObject,
444  buf, paramCount, paramNames, Code.c_str(), Code.length(), CodeName.c_str(), 0);
445 
446  if (!func)
447  return; // JS will report an error message
448 
449  SetScriptHandler(Action, JS_GetFunctionObject(func));
450 }
451 
452 void IGUIObject::SetScriptHandler(const CStr& Action, JSObject* Function)
453 {
454  JSObject** obj = new JSObject*;
455  *obj = Function;
456  JS_AddObjectRoot(g_ScriptingHost.getContext(), obj);
457 
458  if (m_ScriptHandlers[Action])
459  {
460  JS_RemoveObjectRoot(g_ScriptingHost.getContext(), m_ScriptHandlers[Action]);
461  delete m_ScriptHandlers[Action];
462  }
463  m_ScriptHandlers[Action] = obj;
464 }
465 
467 {
468  PROFILE2_EVENT("gui event");
469  PROFILE2_ATTR("type: %s", EventName.c_str());
470  PROFILE2_ATTR("object: %s", m_Name.c_str());
471 
472  SGUIMessage msg(type);
473  HandleMessage(msg);
474 
475  ScriptEvent(EventName);
476 
477  return (msg.skipped ? IN_PASS : IN_HANDLED);
478 }
479 
480 void IGUIObject::ScriptEvent(const CStr& Action)
481 {
482  std::map<CStr, JSObject**>::iterator it = m_ScriptHandlers.find(Action);
483  if (it == m_ScriptHandlers.end())
484  return;
485 
486  // Set up the 'mouse' parameter
487  CScriptVal mouse;
488  g_ScriptingHost.GetScriptInterface().Eval("({})", mouse);
489  g_ScriptingHost.GetScriptInterface().SetProperty(mouse.get(), "x", m_pGUI->m_MousePos.x, false);
490  g_ScriptingHost.GetScriptInterface().SetProperty(mouse.get(), "y", m_pGUI->m_MousePos.y, false);
491  g_ScriptingHost.GetScriptInterface().SetProperty(mouse.get(), "buttons", m_pGUI->m_MouseButtons, false);
492 
493  jsval paramData[] = { mouse.get() };
494 
495  jsval result;
496  JSBool ok = JS_CallFunctionValue(g_ScriptingHost.getContext(), GetJSObject(), OBJECT_TO_JSVAL(*it->second), ARRAY_SIZE(paramData), paramData, &result);
497  if (!ok)
498  {
499  // We have no way to propagate the script exception, so just ignore it
500  // and hope the caller checks JS_IsExceptionPending
501  }
502 }
503 
504 void IGUIObject::ScriptEvent(const CStr& Action, const CScriptValRooted& Argument)
505 {
506  std::map<CStr, JSObject**>::iterator it = m_ScriptHandlers.find(Action);
507  if (it == m_ScriptHandlers.end())
508  return;
509 
510  JSObject* object = GetJSObject();
511 
512  jsval arg = Argument.get();
513 
514  jsval result;
515  JSBool ok = JS_CallFunctionValue(g_ScriptingHost.getContext(), object, OBJECT_TO_JSVAL(*it->second), 1, &arg, &result);
516  if (!ok)
517  {
518  JS_ReportError(g_ScriptingHost.getContext(), "Errors executing script action \"%s\"", Action.c_str());
519  }
520 }
521 
523 {
524  // Cache the object when somebody first asks for it, because otherwise
525  // we end up doing far too much object allocation. TODO: Would be nice to
526  // not have these objects hang around forever using up memory, though.
527  if (! m_JSObject)
528  {
529  m_JSObject = JS_NewObject(g_ScriptingHost.getContext(), &JSI_IGUIObject::JSI_class, NULL, NULL);
530  JS_AddObjectRoot(g_ScriptingHost.getContext(), &m_JSObject);
531  JS_SetPrivate(g_ScriptingHost.getContext(), m_JSObject, this);
532  }
533  return m_JSObject;
534 }
535 
537 {
538  // __internal(), must be at least 13 letters to be able to be
539  // an internal name
540  if (m_Name.length() <= 12)
541  return m_Name;
542 
543  if (m_Name.substr(0, 10) == "__internal")
544  return CStr("[unnamed object]");
545  else
546  return m_Name;
547 }
548 
550 {
551  GetGUI()->m_FocusedObject = this;
552 }
553 
555 {
556  return GetGUI()->m_FocusedObject == this;
557 }
558 
560 {
561  return (GetGUI() != 0 && m_pParent == GetGUI()->m_BaseObject);
562 }
563 
564 PSRETURN IGUIObject::LogInvalidSettings(const CStr8 &Setting) const
565 {
566  LOGWARNING(L"IGUIObject: setting %hs was not found on an object",
567  Setting.c_str());
569 }
#define PROFILE2_EVENT(name)
Record the named event at the current time.
Definition: Profiler2.h:453
CGUI * m_pGUI
Definition: IGUIObject.h:554
std::map< CStr, CStrW > m_SettingsDefaults
Definition: CGUI.h:76
void RegisterScriptHandler(const CStr &Action, const CStr &Code, CGUI *pGUI)
Set the script handler for a particular object-specific action.
Definition: IGUIObject.cpp:430
void SetScriptHandler(const CStr &Action, JSObject *Function)
Definition: IGUIObject.cpp:452
IGUIObject * m_FocusedObject
Focused object! Say an input box that is selected.
Definition: CGUI.h:633
const PSRETURN PSRETURN_OK
Definition: Errors.h:103
float top
Definition: Overlay.h:159
void ScriptEvent(const CStr &Action)
Execute the script for a particular action.
Definition: IGUIObject.cpp:480
JSObject * m_ScriptObject
An JSObject* under which all GUI JavaScript things will be created, so that they can be garbage-colle...
Definition: CGUI.h:590
int g_xres
Definition: Config.cpp:58
float left
Returning CPos representing each corner.
Definition: Overlay.h:159
static PSRETURN GetSetting(const IGUIObject *pObject, const CStr &Setting, T &Value)
Retrieves a setting by name from object pointer.
Definition: GUIutil.cpp:344
const jsval & get() const
Returns the current value.
Definition: ScriptVal.h:38
A trivial wrapper around a jsval.
Definition: ScriptVal.h:29
IGUIObject * m_pParent
Definition: IGUIObject.h:519
const CStr & GetName() const
Get object name, name is unique.
Definition: IGUIObject.h:181
EGUISettingType
Definition: IGUIObject.h:95
Base settings, all objects possess these settings in their m_BaseSettings Instructions can be found i...
Definition: IGUIObject.h:140
CStr GetPresentableName() const
Definition: IGUIObject.cpp:536
int sprintf_s(char *buf, size_t max_chars, const char *fmt,...) PRINTF_ARGS(3)
#define ARRAY_SIZE(name)
The main object that represents a whole GUI page.
Definition: CGUI.h:97
virtual float GetBufferedZ() const
Returns not the Z value, but the actual buffered Z value, i.e.
Definition: IGUIObject.cpp:406
JSObject * m_JSObject
Definition: IGUIObject.h:560
#define LOGWARNING
Definition: CLogger.h:34
float GetWidth() const
Definition: Overlay.cpp:232
unsigned int m_MouseButtons
Indicates which buttons are pressed (bit 0 = LMB, bit 1 = RMB, bit 2 = MMB)
Definition: CGUI.h:603
virtual void UpdateCachedSize()
All sizes are relative to resolution, and the calculation is not wanted in real time, therefore it is cached, update the cached size with this function.
Definition: IGUIObject.cpp:336
JSObject * GetJSObject()
Retrieves the JSObject representing this GUI object.
Definition: IGUIObject.cpp:522
CPos m_MousePos
don&#39;t want to pass this around with the ChooseMouseOverAndClosest broadcast - we&#39;d need to pack this ...
Definition: CGUI.h:597
bool IsRootObject() const
Definition: IGUIObject.cpp:559
IGUIObject * GetParent() const
NOTE! This will not just return m_pParent, when that is need use it! There is one exception to it...
Definition: IGUIObject.cpp:323
#define g_ScriptingHost
vector_pObjects m_Children
Definition: IGUIObject.h:516
u32 PSRETURN
Definition: Errors.h:75
void UpdateObjects()
Updates the object pointers, needs to be called each time an object has been added or removed...
Definition: CGUI.cpp:542
void SetParent(IGUIObject *pParent)
Set parent of this object.
Definition: IGUIObject.h:376
InReaction
Definition: input.h:34
Definition: input.h:40
std::map< CStr, SGUISetting > m_Settings
Settings pool, all an object&#39;s settings are located here If a derived object has got more settings th...
Definition: IGUIObject.h:550
int g_yres
Definition: Config.cpp:58
virtual ~IGUIObject()
Definition: IGUIObject.cpp:70
EGUIMessageType
Message types.
Definition: GUIbase.h:75
std::map< CStr, SGUIStyle > m_Styles
Definition: CGUI.h:676
void AddSetting(const EGUISettingType &Type, const CStr &Name)
Add a setting to m_Settings.
Definition: IGUIObject.cpp:172
virtual bool MouseOver()
Checks if mouse is hovering this object.
Definition: IGUIObject.cpp:194
void AddChild(IGUIObject *pChild)
Notice nothing will be returned or thrown if the child hasn&#39;t been inputted into the GUI yet...
Definition: IGUIObject.cpp:104
bool IsFocused() const
Check if object is focused.
Definition: IGUIObject.cpp:554
CRect GetClientArea(const CRect &parent) const
Get client area rectangle when the parent is given.
Definition: GUIbase.cpp:46
void ChooseMouseOverAndClosest(IGUIObject *&pObject)
Inputs a reference pointer, checks if the new inputted object if hovered, if so, then check if this&#39;s...
Definition: IGUIObject.cpp:303
CRect m_CachedActualSize
Cached size, real size m_Size is actually dependent on resolution and can have different real outcome...
Definition: IGUIObject.h:434
Made to represent screen positions and delta values.
Definition: Overlay.h:167
InReaction SendEvent(EGUIMessageType type, const CStr &EventName)
Send event to this GUI object (HandleMessage and ScriptEvent)
Definition: IGUIObject.cpp:466
double m_LastClickTime[6]
Definition: IGUIObject.h:522
std::map< CStr, IGUIObject * > map_pObjects
Definition: GUIbase.h:154
#define PROFILE2_ATTR
Associates a string (with printf-style formatting) with the current region or event.
Definition: Profiler2.h:461
PSRETURN LogInvalidSettings(const CStr8 &Setting) const
Logs an invalid setting search and returns the correct return result.
Definition: IGUIObject.cpp:564
PSRETURN GetSettingType(const CStr &Setting, EGUISettingType &Type) const
Retrieves the type of a named setting.
Definition: IGUIObject.cpp:285
float right
Definition: Overlay.h:159
Definition: Decompose.h:22
CPos GetMousePos() const
Get Mouse from CGUI.
Definition: IGUIObject.cpp:207
bool SettingExists(const CStr &Setting) const
Checks if settings exists, only available for derived classes that has this set up, that&#39;s why the base class just returns false.
Definition: IGUIObject.cpp:239
const PSRETURN PSRETURN_GUI_InvalidSetting
CGUI * GetGUI()
Definition: IGUIObject.h:388
A GUI Setting is anything that can be inputted from XML as &lt;object&gt;-attributes (with exceptions)...
Definition: IGUIObject.h:108
void UpdateMouseOver(IGUIObject *const &pMouseOver)
Inputes the object that is currently hovered, this function updates this object accordingly (i...
Definition: IGUIObject.cpp:212
PSRETURN SetSetting(const CStr &Setting, const CStrW &Value, const bool &SkipMessage=false)
Set a setting by string, regardless of what type it is.
Definition: IGUIObject.cpp:260
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.
Definition: GUIutil.cpp:366
float y
Definition: Overlay.h:195
jsval get() const
Returns the current value (or JSVAL_VOID if uninitialised).
Definition: ScriptVal.cpp:45
float GetHeight() const
Definition: Overlay.cpp:237
std::map< CStr, JSObject ** > m_ScriptHandlers
Definition: IGUIObject.h:557
#define debug_warn(expr)
display the error dialog with the given text.
Definition: debug.h:324
void AddToPointersMap(map_pObjects &ObjectMap)
Adds object and its children to the map, it&#39;s name being the first part, and the second being itself...
Definition: IGUIObject.cpp:138
bool m_MouseHovering
This is an array of true or false, each element is associated with a string representing a setting...
Definition: IGUIObject.h:539
CStr m_Name
Definition: IGUIObject.h:512
virtual void Destroy()
Calls Destroy on all children, and deallocates all memory.
Definition: IGUIObject.cpp:161
Message send to IGUIObject::HandleMessage() in order to give life to Objects manually with a derived ...
Definition: GUIbase.h:106
float bottom
Definition: Overlay.h:159
virtual void HandleMessage(SGUIMessage &Message)
This function is called with different messages for instance when the mouse enters the object...
Definition: IGUIObject.h:322
float x
Position.
Definition: Overlay.h:195
void LoadStyle(CGUI &GUIinstance, const CStr &StyleName)
Loads a style.
Definition: IGUIObject.cpp:375
Contains a list of values for new defaults to objects.
Definition: CGUI.h:73
bool PointInside(const CPos &point) const
Evalutates if point is within the rectangle.
Definition: Overlay.cpp:272
virtual bool MouseOverIcon()
Test if mouse position is over an icon.
Definition: IGUIObject.cpp:202
void SetFocus()
Take focus!
Definition: IGUIObject.cpp:549
Rectangle class used for screen rectangles.
Definition: Overlay.h:71
Client Area is a rectangle relative to a parent rectangle.
Definition: GUIbase.h:179