Harmonic Flow Framework (libhffwk)
Cross platform C++ 2D Game Engine Framework
Widget.cpp
1 /*
2  Harmonic Flow Framework
3  Copyright (C) 2011-2018 Andreas Widen <andreas@harmonicflow.org>
4 
5  This software is provided 'as-is', without any express or implied
6  warranty. In no event will the authors be held liable for any damages
7  arising from the use of this software.
8 
9  Permission is granted to anyone to use this software for any purpose,
10  including commercial applications, and to alter it and redistribute it
11  freely, subject to the following restrictions:
12 
13  1. The origin of this software must not be misrepresented; you must not
14  claim that you wrote the original software. If you use this software
15  in a product, an acknowledgment in the product documentation would be
16  appreciated but is not required.
17  2. Altered source versions must be plainly marked as such, and must not be
18  misrepresented as being the original software.
19  3. This notice may not be removed or altered from any source distribution.
20 */
21 #include "Widget.h"
22 #include "WidgetManager.h"
23 #include "platform/Environment.h"
24 #include "platform/Graphics.h"
25 #include "platform/Image.h"
26 #include "font/Font.h"
27 
28 using namespace HFCore;
29 
30 #include "debug/CrtDbgNew.h"
31 
32 bool Widget::mWriteColoredString = true;
33 
35 {
37  mParentWidget = false;
38  mDrawEnabled = true;
39  mBatchUIUpdateNeeded = false;
40  mVisible = true;
41  mDisabled = false;
42  mIsDown = false;
43  mIsOver = false;
44  mDoFinger = false;
45  mMouseVisible = true;
46  mHasFocus = false;
47  mHasTransparencies = false;
48  mWantsFocus = false;
49  mMouseListenerEnabled = true;
50  mTouchListenerEnabled = true;
53  mTabPrev = NULL;
54  mTabNext = NULL;
55 }
56 
58 {
59  mColors.clear();
60 }
61 
63 {
64  if (mWidgetManager == NULL)
65  return;
66 
67  // Call RemovedFromManager on all child widgets and disable them.
68  WidgetList::iterator widgetItr;
69  for (widgetItr = mWidgets.begin(); widgetItr != mWidgets.end(); ++widgetItr)
70  {
71  Widget *widget = *widgetItr;
72  widget->widgetRemovedHelper();
73  }
74 
76 
77  WidgetManager::PreModalInfoList::iterator itr = mWidgetManager->mPreModalInfoList.begin();
78  while (itr != mWidgetManager->mPreModalInfoList.end())
79  {
80  PreModalInfo *preModalInfo = &(*itr);
81  if (preModalInfo->mPrevBaseModalWidget == this)
82  preModalInfo->mPrevBaseModalWidget = NULL;
83  if (preModalInfo->mPrevFocusWidget == this)
84  preModalInfo->mPrevFocusWidget = NULL;
85  ++itr;
86  }
87 
90 }
91 
93 {
94 }
95 
96 void Widget::setVisible(bool isVisible)
97 {
98  if (mVisible == isVisible)
99  return;
100 
101  mVisible = isVisible;
102 
103  if (mWidgetManager != NULL)
105 }
106 
107 void Widget::setColors(int32_hf colors[][3], int32_hf numColors)
108 {
109  mColors.clear();
110 
111  for (int32_hf i = 0; i < numColors; i++)
112  setColor(i, Color(colors[i][0], colors[i][1], colors[i][2]));
113 }
114 
115 void Widget::setColors(int32_hf colors[][4], int32_hf numColors)
116 {
117  mColors.clear();
118 
119  for (int32_hf i = 0; i < numColors; i++)
120  setColor(i, Color(colors[i][0], colors[i][1], colors[i][2], colors[i][3]));
121 }
122 
123 void Widget::setColor(int32_hf idx, const Color &color)
124 {
125  if (idx >= (int32_hf)mColors.size())
126  mColors.resize(idx + 1);
127 
128  mColors[idx] = color;
129 }
130 
132 {
133  static Color color;
134  if (idx < (int32_hf) mColors.size())
135  return mColors[idx];
136  return color;
137 }
138 
139 Color Widget::getColor(int32_hf idx, const Color &defaultColor)
140 {
141  if (idx < (int32_hf) mColors.size())
142  return mColors[idx];
143  return defaultColor;
144 }
145 
146 void Widget::setDisabled(bool isDisabled)
147 {
148  if (mDisabled == isDisabled)
149  return;
150 
151  mDisabled = isDisabled;
152 
153  if ((isDisabled) && (mWidgetManager != NULL))
155 }
156 
157 void Widget::showFinger(bool on)
158 {
159 }
160 
162 {
163  mMouseListenerEnabled = enable;
164 }
165 
167 {
168  return mMouseListenerEnabled;
169 }
170 
172 {
173  mTouchListenerEnabled = enable;
174 }
175 
177 {
178  return mTouchListenerEnabled;
179 }
180 
182 {
183  if ((mX == x) && (mY == y) && (mWidth == w) && (mHeight == h))
184  return;
185 
186  mX = x;
187  mY = y;
188  mWidth = (fp32_hf)w;
189  mHeight = (fp32_hf)h;
190 
191  if (mWidgetManager != NULL)
193 }
194 
195 void Widget::resize(const Rect &rect)
196 {
197  resize(rect.getX(), rect.getY(),
198  (int32_hf)rect.getWidth(),
199  (int32_hf)rect.getHeight());
200 }
201 
203 {
205 }
206 
208 {
209  return mWantsFocus;
210 }
211 
213 {
214 }
215 
217 {
218 }
219 
221 {
222  drawOverlay(g);
223 }
224 
226 {
227 }
228 
230 {
231  mHasFocus = true;
232 }
233 
235 {
236  mHasFocus = false;
237 }
238 
240 {
241 }
242 
244 {
245  if (kb.key == Keyboard::KEY_TAB)
246  {
247  if (kb.mods & Keyboard::KEYMOD_SHIFT)
248  {
249  if (mTabPrev != NULL)
251  }
252  else
253  {
254  if (mTabNext != NULL)
256  }
257  }
258 }
259 
261 {
262 }
263 
265 {
266 }
267 
269 {
270 }
271 
273 {
274 }
275 
277 {
278 }
279 
281 {
282 }
283 
285 {
286 }
287 
289 {
290 }
291 
293 {
294 }
295 
297 {
298  return true;
299 }
300 
302  int32_hf offset, const UString &string,
303  fp32_hf alpha)
304 {
305  int32_hf width = font->getStringWidth(string);
306  int32_hf x = (int32_hf)((mWidth - width) / 2 + mX);
307 
308  Color newColor(color.getRed(), color.getGreen(),
309  color.getBlue(), (int32_hf)(255 * alpha));
310 
311  Rect rect = mRH.drawCenteredString(g, font, newColor, offset,
312  x, width, string);
313 
314  return rect;
315 }
316 
318  int32_hf y, const UString &string,
319  fp32_hf scale)
320 {
321  int32_hf width = font->getStringWidth(string, scale);
322  int32_hf x = (int32_hf)((mWidth - width) / 2 + mX);
323 
324  mRH.beginBatchUI(g);
325  Rect rect = mRH.drawCenteredString(g, font, color, y,
326  x, width, string);
327  mRH.endBatchUI(g);
328 
329  return rect;
330 }
331 
332 fp32_hf Widget::drawString(Graphics *g, Font *font, Color color, const UString &string,
333  int32_hf x, int32_hf y, fp32_hf alpha)
334 {
335  Color newColor(color.getRed(), color.getGreen(),
336  color.getBlue(), (int32_hf)(255 * alpha));
337 
338  fp32_hf w = mRH.drawString(g, font, newColor,
339  string, x, y);
340 
341  return w;
342 }
343 
344 fp32_hf Widget::drawStringBatch(Graphics *g, Font *font, Color color, const UString &string,
345  int32_hf x, int32_hf y, fp32_hf scale)
346 {
347  mRH.beginBatchUI(g);
348  fp32_hf w = mRH.drawString(g, font, color, string, x, y, scale);
349  mRH.endBatchUI(g);
350 
351  return w;
352 }
353 
355  const Rect &rect, const UString &string,
356  int32_hf lineSpacing, int32_hf valign, int32_hf halign,
357  bool renderString, fp32_hf alpha, bool batch, fp32_hf scale)
358 {
359  if (batch)
360  mRH.beginBatchUI(g);
361 
362  Color newColor(color.getRed(), color.getGreen(),
363  color.getBlue(), (int32_hf)(255 * alpha));
364 
365  if (batch)
366  newColor = color; // alpha already set.
367  int32_hf offsetY = mRH.drawWordWrappedString(g, font, newColor, rect, string,
368  lineSpacing, valign, halign, renderString,
369  scale);
370 
371  if (batch)
372  mRH.endBatchUI(g);
373 
374  return offsetY;
375 }
376 
377 int32_hf Widget::getHAlignPosX(int32_hf halign, int32_hf rectPosX,
378  int32_hf rectWidth, int32_hf strWidth)
379 {
380  int32_hf halignposX = mRH.getHAlignPosX(halign, rectPosX, rectWidth, strWidth);
381  return halignposX;
382 }
383 
384 int32_hf Widget::getVAlignPosY(int32_hf valign, int32_hf rectPosY,
385  int32_hf rectHeight, int32_hf strHeight)
386 {
387  int32_hf valignposY = mRH.getVAlignPosY(valign, rectPosY, rectHeight, strHeight);
388  return valignposY;
389 }
390 
392  const UString &line, int32_hf lineSpacing)
393 {
394  // Just call the Draw version as it returns height. Color param is not used here.
395  // renderString param = false just run same code but without drawing :)
396  // This method is mainly used to calculate height when Aligning vertically Centered or Bottom.
397  return drawWordWrappedString(g, font, Color(255, 255, 255),
398  rect, line, lineSpacing, -1, -1, false);
399 }
400 
402 {
403  return ((x >= mX) && (x < mX + mWidth) &&
404  (y >= mY) && (y < mY + mHeight));
405 }
406 
408 {
412 }
413 
414 void Widget::layout(int32_hf layoutFlags, Widget *relativeWidget, int32_hf leftPad,
415  int32_hf topPad, int32_hf widthPad, int32_hf heightPad)
416 {
417  int32_hf relLeft = (int32_hf)relativeWidget->left();
418  int32_hf relTop = (int32_hf)relativeWidget->top();
419  if (relativeWidget == mParent)
420  {
421  relLeft = 0;
422  relTop = 0;
423  }
424 
425  int32_hf relWidth = (int32_hf)relativeWidget->width();
426  int32_hf relHeight = (int32_hf)relativeWidget->height();
427  int32_hf relRight = relLeft + relWidth;
428  int32_hf relBottom = relTop + relHeight;
429 
430  int32_hf left = (int32_hf)this->left();
431  int32_hf top = (int32_hf)this->top();
432  int32_hf width = (int32_hf)this->width();
433  int32_hf height = (int32_hf)this->height();
434 
435  int32_hf type = 1;
436  while (type < LAY_Max)
437  {
438  if (layoutFlags & type)
439  {
440  switch (type)
441  {
442  case LAY_SameWidth: width = relWidth + widthPad; break;
443  case LAY_SameHeight: height = relHeight + heightPad; break;
444 
445  case LAY_Above: top = relTop - height + topPad; break;
446  case LAY_Below: top = relBottom + topPad; break;
447  case LAY_Right: left = relRight + leftPad; break;
448  case LAY_Left: left = relLeft - width + leftPad; break;
449 
450  case LAY_SameLeft: left = relLeft + leftPad; break;
451  case LAY_SameRight: left = relRight - width + leftPad; break;
452  case LAY_SameTop: top = relTop + topPad; break;
453  case LAY_SameBottom: top = relBottom - height + topPad; break;
454 
455  case LAY_GrowToRight: width = relRight - left + widthPad; break;
456  case LAY_GrowToLeft: width = relLeft - left + widthPad; break;
457  case LAY_GrowToTop: height = relTop - top + heightPad; break;
458  case LAY_GrowToBottom: height = relBottom - top + heightPad; break;
459 
460  case LAY_SetLeft: left = leftPad; break;
461  case LAY_SetTop: top = topPad; break;
462  case LAY_SetWidth: width = widthPad; break;
463  case LAY_SetHeight: height = heightPad; break;
464 
465  case LAY_HCenter: left = relLeft + (relWidth - width) / 2 + leftPad; break;
466  case LAY_VCenter: top = relTop + (relHeight - height) / 2 + topPad; break;
467  }
468  }
469 
470  type <<= 1;
471  }
472 
473  resize((fp32_hf)left, (fp32_hf)top, width, height);
474 }
475 
477  Graphics::MinFilter minFilter)
478 {
479  mMagFilter = magFilter;
480  mMinFilter = minFilter;
481 }
482 
484 {
485  return mMagFilter;
486 }
487 
489 {
490  return mMinFilter;
491 }
492 
493 void Widget::setDrawEnabled(bool enable)
494 {
495  mDrawEnabled = enable;
496 }
497 
499 {
500  return mDrawEnabled;
501 }
502 
504 {
506 }
507 
509 {
510  return mBatchUIUpdateNeeded;
511 }
512 
514 {
515 }
516 
518 {
519 }
520 
522 {
523 }
524 
525 void Widget::renderBatchCallback(Graphics *g, bool updateBatchUIRenderTexture)
526 {
527 }
virtual void setMouseListenerEnabled(bool enable)
Set MouseListener enabled / disabled.
Definition: Widget.cpp:161
Rect drawCenteredString(Graphics *g, Font *font, Color color, int32_hf y, int32_hf widgetPosX, int32_hf widgetWidth, const UString &string, fp32_hf scale=1.0f)
Draw a centered string.
virtual int32_hf getStringWidth(const UString &str, fp32_hf scale=1.0f)=0
Get the width of str.
virtual ~Widget()
Destructor.
Definition: Widget.cpp:57
Widget * mTabPrev
Holds previously tabbed Widget.
Definition: Widget.h:1123
Interface for all rendering related things.
Interface for Resource type Font.
fp32_hf drawString(Graphics *g, Font *font, Color color, const UString &string, int32_hf x, int32_hf y, fp32_hf scale=1.0f)
Draw a string.
void widgetRemovedHelper()
Helper method for Widget removal and cleanup.
Definition: Widget.cpp:62
virtual void setDrawEnabled(bool enable)
Set drawing enabled / disabled.
Definition: Widget.cpp:493
bool mParentWidget
Flag indicating if parent widget or not.
Definition: Widget.h:1030
int32_hf mTop
Holds top inset.
Definition: Insets.h:68
virtual void keyDown(Keyboard::KeyboardInfo kb)
Called automatically when Keyboard keyDown event occurs.
Definition: Widget.cpp:243
virtual void setBatchUIUpdateNeeded(bool update)
Set BatchUI update needed flag.
Definition: Widget.cpp:503
void beginBatchUI(Graphics *g, Rect clipRect=Rect::ZERO())
Begin Batch for UI Widget content using optional clipping Rect.
MinFilter
Minification filter to use for Images.
Definition: Graphics.h:177
Widget * mPrevFocusWidget
Pointer to previous focus Widget.
Definition: WidgetManager.h:60
Interface for unicode string class UString.
Definition: UString.h:35
Widget is a base class with core functionality for specialized Widget&#39;s to use / override / inherit f...
Definition: Widget.h:163
Graphics::MinFilter mMinFilter
Holds Graphics::MinFilter enum value.
Definition: Widget.h:1118
virtual void touchMove(Touch::TouchInfo touch)
Called automatically when Touch move/drag event occurs.
Definition: Widget.cpp:268
virtual Rect drawCenteredString(Graphics *g, Font *font, Color color, int32_hf offset, const UString &string, fp32_hf alpha=1.0f)
Draw a centered string.
Definition: Widget.cpp:301
fp32_hf getWidth() const
Get Rect Width (or maxX).
Definition: Rect.h:168
int32_hf drawWordWrappedString(Graphics *g, Font *font, Color color, const Rect &rect, const UString &string, int32_hf lineSpacing=-1, int32_hf valign=TEXT_VALIGN_TOP, int32_hf halign=TEXT_HALIGN_LEFT, bool renderString=true, fp32_hf scale=1.0f)
Draw a word wrapped string within given rect Rect area and specified halign and valign horizontal and...
virtual void setTouchListenerEnabled(bool enable)
Set TouchListener enabled / disabled.
Definition: Widget.cpp:171
bool mDrawEnabled
Flag indicating if draw is enabled or not.
Definition: Widget.h:1035
void rehupMouse()
Rehup Mouse (calls Widget::mouseLeave()) if needed for over Widget.
int int32_hf
A type definition for int.
Definition: HFDataTypes.h:349
Key modifier Shift.
Definition: Keyboard.h:91
bool mHasTransparencies
Flag indicating if Widget has transparencies or not.
Definition: Widget.h:1075
static bool mWriteColoredString
Flag indicating whether ^color^ works in calls to WriteString or not.
Definition: Widget.h:1134
virtual void mouseLeave(Mouse::MouseInfo mouse)
Called automatically when Mouse leave event occurs.
Definition: Widget.cpp:292
void disableWidget(Widget *widget)
Disable widget.
int32_hf mBottom
Holds bottom inset.
Definition: Insets.h:78
Graphics::MagFilter mMagFilter
Holds Graphics::MagFilter enum value.
Definition: Widget.h:1113
bool mHasFocus
Flag indicating if Widget has focus or not.
Definition: Widget.h:1060
virtual bool getBatchUIUpdateNeeded()
Determine if BatchUI update is needed.
Definition: Widget.cpp:508
virtual void touchUp(Touch::TouchInfo touch)
Called automatically when Touch up event occurs.
Definition: Widget.cpp:264
fp32_hf mX
Holds Widget X position.
void endBatchUI(Graphics *g)
End Batch for UI Widget content.
void layout(int32_hf layoutFlags, Widget *relativeWidget, int32_hf leftPad=0, int32_hf topPad=0, int32_hf widthPad=0, int32_hf heightPad=0)
Method for Widget layouting.
Definition: Widget.cpp:414
int32_hf getHAlignPosX(int32_hf halign, int32_hf rectPosX, int32_hf rectWidth, int32_hf strWidth)
Get optimal horizontal position X based on alignment wanted.
virtual void showFinger(bool on)
Method for controlling if finger cursor should be shown.
Definition: Widget.cpp:157
bool mIsOver
Flag indicating if over or not.
Definition: Widget.h:1070
int32_hf mLeft
Holds left inset.
Definition: Insets.h:63
Vertical center.
Definition: Widget.h:215
Widget * mTabNext
Holds next tabbed Widget.
Definition: Widget.h:1128
Returns the weighted average of the texture elements that are closest to the specified texture coordi...
Definition: Graphics.h:184
int32_hf getVAlignPosY(int32_hf valign, int32_hf rectPosY, int32_hf rectHeight, int32_hf strHeight)
Get optimal vertical position Y based on alignment wanted.
virtual void setColor(int32_hf idx, const Color &color)
Set Color for given idx and store in internal Widget::ColorVector.
Definition: Widget.cpp:123
Returns the weighted average of the texture elements that are closest to the specified texture coordi...
Definition: Graphics.h:161
int32_hf getRed() const
Get red color component as int32_hf.
Definition: Color.cpp:91
bool mDoFinger
Flag indicating if we should show finger or not.
Definition: Widget.h:1091
A structure that contains Touch event information.
Definition: Touch.h:50
fp32_hf width()
Get Widget width.
Definition: Widget.h:994
virtual void mouseMove(Mouse::MouseInfo mouse)
Called automatically when Mouse motion event occurs.
Definition: Widget.cpp:272
virtual void keyUp(Keyboard::KeyboardInfo kb)
Called automatically when Keyboard keyUp event occurs.
Definition: Widget.cpp:239
virtual bool wantsFocus()
Determine whether Widget wants focus.
Definition: Widget.cpp:207
virtual void removedFromManager(WidgetManager *widgetManager)
Call removedFromManager() for all Widget&#39;s in internal list.
virtual fp32_hf drawString(Graphics *g, Font *font, Color color, const UString &string, int32_hf x, int32_hf y, fp32_hf alpha=1.0f)
Draw a string.
Definition: Widget.cpp:332
fp32_hf getY() const
Get Rect Y (or minY).
Definition: Rect.h:159
virtual void setVisible(bool isVisible)
Set visibility of Widget.
Definition: Widget.cpp:96
Interface for Resource type Image.
#define NULL
Convenient define for 0.
Definition: HFDataTypes.h:42
Widget()
Constructor.
Definition: Widget.cpp:34
virtual Graphics::MinFilter getMinRenderFilter()
Get Graphics::MinFilter currently set.
Definition: Widget.cpp:488
RenderHelper mRH
RenderHelper.
Definition: Widget.h:1025
virtual void mouseEnter(Mouse::MouseInfo mouse)
Called automatically when Mouse enter event occurs.
Definition: Widget.cpp:288
MagFilter
Magnification filter to use for Images.
Definition: Graphics.h:154
virtual Rect drawCenteredStringBatch(Graphics *g, Font *font, Color color, int32_hf y, const UString &string, fp32_hf scale=1.0f)
Draw a centered string batch.
Definition: Widget.cpp:317
virtual void resize(fp32_hf x, fp32_hf y, int32_hf w, int32_hf h)
Resize Widget.
Definition: Widget.cpp:181
Interface for RGBA Color.
Definition: Color.h:51
A structure that contains Mouse event information.
Definition: Mouse.h:63
virtual void orderInManagerChanged()
Method for controlling if order in manager has changed.
Definition: Widget.cpp:92
virtual fp32_hf drawStringBatch(Graphics *g, Font *font, Color color, const UString &string, int32_hf x, int32_hf y, fp32_hf scale=1.0f)
Draw a string batch.
Definition: Widget.cpp:344
Widget * mPrevBaseModalWidget
Pointer to previous base modal Widget.
Definition: WidgetManager.h:55
virtual Graphics::MagFilter getMagRenderFilter()
Get Graphics::MagFilter currently set.
Definition: Widget.cpp:483
virtual void renderBatchCallback(Graphics *g, bool updateBatchUIRenderTexture)
Called by the framework when render batch should be performed.
Definition: Widget.cpp:525
A structure that contains Keyboard event information.
Definition: Keyboard.h:103
Key key
Key enum value if any.
Definition: Keyboard.h:109
virtual void move(fp32_hf x, fp32_hf y)
Move Widget to x, y position.
Definition: Widget.cpp:202
Insets mMouseInsets
Mouse insets.
Definition: Widget.h:1086
fp32_hf top()
Get Widget top position.
Definition: Widget.h:973
fp32_hf getX() const
Get Rect X (or minX).
Definition: Rect.h:150
fp32_hf left()
Get Widget left position.
Definition: Widget.h:966
void setFocus(Widget *widget)
Set focus on widget.
virtual void setUpdateRenderTexture(bool update)
Set update render target flag.
Definition: Widget.cpp:513
virtual bool contains(int32_hf x, int32_hf y)
Determine whether a point specified by x and y is contained within Widget or not. ...
Definition: Widget.cpp:401
virtual Rect getInsetRect()
Get Widget inset Rect.
Definition: Widget.cpp:407
virtual void gotFocus()
Called when the Widget gains focus.
Definition: Widget.cpp:229
bool mTouchListenerEnabled
Flag indicating if TouchListener callbacks is enabled or not.
Definition: Widget.h:1108
virtual void mouseButtonUp(Mouse::MouseInfo mouse)
Called automatically when Mouse button up event occurs.
Definition: Widget.cpp:280
virtual void lostFocus()
Called when the Widget loses focus.
Definition: Widget.cpp:234
virtual bool getTouchListenerEnabled()
Determine whether TouchListener is enabled.
Definition: Widget.cpp:176
bool mBatchUIUpdateNeeded
Flag indicating if BatchUI update is needed or not.
Definition: Widget.h:1040
virtual void mouseWheel(Mouse::MouseInfo mouse)
Called automatically when Mouse wheel event occurs.
Definition: Widget.cpp:284
virtual void createRenderTextures()
Called by the framework when Render textures needs to be created/initialized.
Definition: Widget.cpp:521
Widget is a base class with core functionality for specialized Widget&#39;s to inherit from...
fp32_hf mY
Holds Widget Y position.
virtual bool getIsDrawEnabled()
Determine whether drawing is enabled.
Definition: Widget.cpp:498
bool mWantsFocus
Flag indicating if Widget wants focus or not.
Definition: Widget.h:1096
bool mMouseListenerEnabled
Flag indicating if MouseListener callbacks is enabled or not.
Definition: Widget.h:1102
Definition: Actor.h:34
WidgetContainer * mParent
Pointer to parent WidgetContainer.
Horizontal center.
Definition: Widget.h:214
virtual void destroyRenderTextures()
Called by the framework when Render textures needs to be destroyed.
Definition: Widget.cpp:517
Interface for Resource type Font.
Definition: Font.h:84
Singleton interface for platform specific things.
virtual void update(fp32_hf dt)
Called by the framework once for every iteration of the game loop, immediately before rendering takes...
Definition: Widget.cpp:225
virtual void setDisabled(bool isDisabled)
Set disabled flag.
Definition: Widget.cpp:146
bool mVisible
Flag indicating if visible or not.
Definition: Widget.h:1045
virtual void drawOverlay(Graphics *g)
Called by the framework once for every iteration of the main loop.
Definition: Widget.cpp:216
Specialized Boundary representing a Rect.
Definition: Rect.h:34
virtual bool isPointVisible(int32_hf x, int32_hf y)
Determine whether a point is visible or not.
Definition: Widget.cpp:296
Interface for all rendering related things.
Definition: Graphics.h:120
virtual void mouseButtonDown(Mouse::MouseInfo mouse)
Called automatically when Mouse button down event occurs.
Definition: Widget.cpp:276
WidgetManager manages Widget&#39;s and interacts with Game interface.
virtual void setRenderFilter(Graphics::MagFilter magFilter, Graphics::MinFilter minFilter)
Set Graphics::MagFilter and Graphics::MinFilter to use for drawing operations.
Definition: Widget.cpp:476
int32_hf mRight
Holds right inset.
Definition: Insets.h:73
bool mDisabled
Flag indicating if disabled or not.
Definition: Widget.h:1055
bool mIsDown
Flag indicating if down or not.
Definition: Widget.h:1065
bool mMouseVisible
Flag indicating if mouse is visible or not.
Definition: Widget.h:1050
virtual void setColors(int32_hf colors[][3], int32_hf numColors)
Set RGB colors.
Definition: Widget.cpp:107
fp32_hf getHeight() const
Get Rect Height (or maxY).
Definition: Rect.h:177
virtual int32_hf drawWordWrappedString(Graphics *g, Font *font, Color color, const Rect &rect, const UString &string, int32_hf lineSpacing=-1, int32_hf valign=TEXT_VALIGN_TOP, int32_hf halign=TEXT_HALIGN_LEFT, bool renderString=true, fp32_hf alpha=1.0f, bool batch=false, fp32_hf scale=1.0f)
Draw a word wrapped string within given rect Rect area and specified halign and valign horizontal and...
Definition: Widget.cpp:354
ColorVector mColors
Vector holding Color&#39;s set by setColor() and setColors().
Definition: Widget.h:1081
PreModalInfoList mPreModalInfoList
Internal WidgetManager::PreModalInfoList.
WidgetManager * mWidgetManager
Pointer to WidgetManager.
Modifiers mods
Key Modifier/s if any.
Definition: Keyboard.h:110
fp32_hf height()
Get Widget height.
Definition: Widget.h:1001
virtual const Color & getColor(int32_hf idx)
Get Color for given idx or uninitialized color if not found.
Definition: Widget.cpp:131
int32_hf getBlue() const
Get blue color component as int32_hf.
Definition: Color.cpp:101
virtual int32_hf getWordWrappedHeight(Graphics *g, Font *font, const Rect &rect, const UString &line, int32_hf lineSpacing=-1)
Get word wrapped height for given text line.
Definition: Widget.cpp:391
fp32_hf mWidth
Holds Widget width.
virtual void touchDown(Touch::TouchInfo touch)
Called automatically when Touch down event occurs.
Definition: Widget.cpp:260
float fp32_hf
A type definition for float.
Definition: HFDataTypes.h:359
int32_hf getGreen() const
Get green color component as int32_hf.
Definition: Color.cpp:96
Class holding modal Widget info.
Definition: WidgetManager.h:44
fp32_hf mHeight
Holds Widget height.
virtual void draw(Graphics *g)
Called by the framework once for every iteration of the main loop.
Definition: Widget.cpp:212
WidgetList mWidgets
WidgetContainer::WidgetList holding child Widget&#39;s.
virtual bool getMouseListenerEnabled()
Determine whether MouseListener is enabled.
Definition: Widget.cpp:166