Otclient  14/8/2020
uiwidgetbasestyle.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2020 OTClient <https://github.com/edubart/otclient>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  * THE SOFTWARE.
21  */
22 
23 #include "uiwidget.h"
24 #include "uihorizontallayout.h"
25 #include "uiverticallayout.h"
26 #include "uigridlayout.h"
27 #include "uianchorlayout.h"
28 #include "uitranslator.h"
29 
33 
34 void UIWidget::initBaseStyle()
35 {
40  m_opacity = 1.0f;
41  m_rotation = 0.0f;
43 
44  // generate an unique id, this is need because anchored layouts find widgets by id
45  static unsigned long id = 1;
46  m_id = stdext::format("widget%d", id++);
47 }
48 
49 void UIWidget::parseBaseStyle(const OTMLNodePtr& styleNode)
50 {
51  // parse lua variables and callbacks first
52  for(const OTMLNodePtr& node : styleNode->children()) {
53  // lua functions
54  if(stdext::starts_with(node->tag(), "@")) {
55  // load once
56  if(m_firstOnStyle) {
57  std::string funcName = node->tag().substr(1);
58  std::string funcOrigin = "@" + node->source() + ": [" + node->tag() + "]";
59  g_lua.loadFunction(node->value(), funcOrigin);
60  luaSetField(funcName);
61  }
62  // lua fields value
63  } else if(stdext::starts_with(node->tag(), "&")) {
64  std::string fieldName = node->tag().substr(1);
65  std::string fieldOrigin = "@" + node->source() + ": [" + node->tag() + "]";
66 
67  g_lua.evaluateExpression(node->value(), fieldOrigin);
68  luaSetField(fieldName);
69  }
70  }
71  // load styles used by all widgets
72  for(const OTMLNodePtr& node : styleNode->children()) {
73  if(node->tag() == "color")
74  setColor(node->value<Color>());
75  else if(node->tag() == "x")
76  setX(node->value<int>());
77  else if(node->tag() == "y")
78  setY(node->value<int>());
79  else if(node->tag() == "pos")
80  setPosition(node->value<Point>());
81  else if(node->tag() == "width")
82  setWidth(node->value<int>());
83  else if(node->tag() == "height")
84  setHeight(node->value<int>());
85  else if(node->tag() == "rect")
86  setRect(node->value<Rect>());
87  else if(node->tag() == "background")
88  setBackgroundColor(node->value<Color>());
89  else if(node->tag() == "background-color")
90  setBackgroundColor(node->value<Color>());
91  else if(node->tag() == "background-offset-x")
92  setBackgroundOffsetX(node->value<int>());
93  else if(node->tag() == "background-offset-y")
94  setBackgroundOffsetY(node->value<int>());
95  else if(node->tag() == "background-offset")
96  setBackgroundOffset(node->value<Point>());
97  else if(node->tag() == "background-width")
98  setBackgroundWidth(node->value<int>());
99  else if(node->tag() == "background-height")
100  setBackgroundHeight(node->value<int>());
101  else if(node->tag() == "background-size")
102  setBackgroundSize(node->value<Size>());
103  else if(node->tag() == "background-rect")
104  setBackgroundRect(node->value<Rect>());
105  else if(node->tag() == "icon")
106  setIcon(stdext::resolve_path(node->value(), node->source()));
107  else if(node->tag() == "icon-source")
108  setIcon(stdext::resolve_path(node->value(), node->source()));
109  else if(node->tag() == "icon-color")
110  setIconColor(node->value<Color>());
111  else if(node->tag() == "icon-offset-x")
112  setIconOffsetX(node->value<int>());
113  else if(node->tag() == "icon-offset-y")
114  setIconOffsetY(node->value<int>());
115  else if(node->tag() == "icon-offset")
116  setIconOffset(node->value<Point>());
117  else if(node->tag() == "icon-width")
118  setIconWidth(node->value<int>());
119  else if(node->tag() == "icon-height")
120  setIconHeight(node->value<int>());
121  else if(node->tag() == "icon-size")
122  setIconSize(node->value<Size>());
123  else if(node->tag() == "icon-rect")
124  setIconRect(node->value<Rect>());
125  else if(node->tag() == "icon-clip")
126  setIconClip(node->value<Rect>());
127  else if(node->tag() == "icon-align")
128  setIconAlign(Fw::translateAlignment(node->value()));
129  else if(node->tag() == "opacity")
130  setOpacity(node->value<float>());
131  else if(node->tag() == "rotation")
132  setRotation(node->value<float>());
133  else if(node->tag() == "enabled")
134  setEnabled(node->value<bool>());
135  else if(node->tag() == "visible")
136  setVisible(node->value<bool>());
137  else if(node->tag() == "checked")
138  setChecked(node->value<bool>());
139  else if(node->tag() == "draggable")
140  setDraggable(node->value<bool>());
141  else if(node->tag() == "on")
142  setOn(node->value<bool>());
143  else if(node->tag() == "focusable")
144  setFocusable(node->value<bool>());
145  else if(node->tag() == "auto-focus")
147  else if(node->tag() == "phantom")
148  setPhantom(node->value<bool>());
149  else if(node->tag() == "size")
150  setSize(node->value<Size>());
151  else if(node->tag() == "fixed-size")
152  setFixedSize(node->value<bool>());
153  else if(node->tag() == "clipping")
154  setClipping(node->value<bool>());
155  else if(node->tag() == "border") {
156  auto split = stdext::split(node->value(), " ");
157  if(split.size() == 2) {
158  setBorderWidth(stdext::safe_cast<int>(split[0]));
159  setBorderColor(stdext::safe_cast<Color>(split[1]));
160  } else
161  throw OTMLException(node, "border param must have its width followed by its color");
162  }
163  else if(node->tag() == "border-width")
164  setBorderWidth(node->value<int>());
165  else if(node->tag() == "border-width-top")
166  setBorderWidthTop(node->value<int>());
167  else if(node->tag() == "border-width-right")
168  setBorderWidthRight(node->value<int>());
169  else if(node->tag() == "border-width-bottom")
170  setBorderWidthBottom(node->value<int>());
171  else if(node->tag() == "border-width-left")
172  setBorderWidthLeft(node->value<int>());
173  else if(node->tag() == "border-color")
174  setBorderColor(node->value<Color>());
175  else if(node->tag() == "border-color-top")
176  setBorderColorTop(node->value<Color>());
177  else if(node->tag() == "border-color-right")
178  setBorderColorRight(node->value<Color>());
179  else if(node->tag() == "border-color-bottom")
180  setBorderColorBottom(node->value<Color>());
181  else if(node->tag() == "border-color-left")
182  setBorderColorLeft(node->value<Color>());
183  else if(node->tag() == "margin-top")
184  setMarginTop(node->value<int>());
185  else if(node->tag() == "margin-right")
186  setMarginRight(node->value<int>());
187  else if(node->tag() == "margin-bottom")
188  setMarginBottom(node->value<int>());
189  else if(node->tag() == "margin-left")
190  setMarginLeft(node->value<int>());
191  else if(node->tag() == "margin") {
192  std::string marginDesc = node->value();
193  std::vector<std::string> split = stdext::split(marginDesc, " ");
194  if(split.size() == 4) {
195  setMarginTop(stdext::safe_cast<int>(split[0]));
196  setMarginRight(stdext::safe_cast<int>(split[1]));
197  setMarginBottom(stdext::safe_cast<int>(split[2]));
198  setMarginLeft(stdext::safe_cast<int>(split[3]));
199  } else if(split.size() == 3) {
200  int marginTop = stdext::safe_cast<int>(split[0]);
201  int marginHorizontal = stdext::safe_cast<int>(split[1]);
202  int marginBottom = stdext::safe_cast<int>(split[2]);
203  setMarginTop(marginTop);
204  setMarginRight(marginHorizontal);
205  setMarginBottom(marginBottom);
206  setMarginLeft(marginHorizontal);
207  } else if(split.size() == 2) {
208  int marginVertical = stdext::safe_cast<int>(split[0]);
209  int marginHorizontal = stdext::safe_cast<int>(split[1]);
210  setMarginTop(marginVertical);
211  setMarginRight(marginHorizontal);
212  setMarginBottom(marginVertical);
213  setMarginLeft(marginHorizontal);
214  } else if(split.size() == 1) {
215  int margin = stdext::safe_cast<int>(split[0]);
216  setMarginTop(margin);
217  setMarginRight(margin);
218  setMarginBottom(margin);
219  setMarginLeft(margin);
220  }
221  }
222  else if(node->tag() == "padding-top")
223  setPaddingTop(node->value<int>());
224  else if(node->tag() == "padding-right")
225  setPaddingRight(node->value<int>());
226  else if(node->tag() == "padding-bottom")
227  setPaddingBottom(node->value<int>());
228  else if(node->tag() == "padding-left")
229  setPaddingLeft(node->value<int>());
230  else if(node->tag() == "padding") {
231  std::string paddingDesc = node->value();
232  std::vector<std::string> split = stdext::split(paddingDesc, " ");
233  if(split.size() == 4) {
234  setPaddingTop(stdext::safe_cast<int>(split[0]));
235  setPaddingRight(stdext::safe_cast<int>(split[1]));
236  setPaddingBottom(stdext::safe_cast<int>(split[2]));
237  setPaddingLeft(stdext::safe_cast<int>(split[3]));
238  } else if(split.size() == 3) {
239  int paddingTop = stdext::safe_cast<int>(split[0]);
240  int paddingHorizontal = stdext::safe_cast<int>(split[1]);
241  int paddingBottom = stdext::safe_cast<int>(split[2]);
242  setPaddingTop(paddingTop);
243  setPaddingRight(paddingHorizontal);
244  setPaddingBottom(paddingBottom);
245  setPaddingLeft(paddingHorizontal);
246  } else if(split.size() == 2) {
247  int paddingVertical = stdext::safe_cast<int>(split[0]);
248  int paddingHorizontal = stdext::safe_cast<int>(split[1]);
249  setPaddingTop(paddingVertical);
250  setPaddingRight(paddingHorizontal);
251  setPaddingBottom(paddingVertical);
252  setPaddingLeft(paddingHorizontal);
253  } else if(split.size() == 1) {
254  int padding = stdext::safe_cast<int>(split[0]);
255  setPaddingTop(padding);
256  setPaddingRight(padding);
257  setPaddingBottom(padding);
258  setPaddingLeft(padding);
259  }
260  }
261  // layouts
262  else if(node->tag() == "layout") {
263  std::string layoutType;
264  if(node->hasValue())
265  layoutType = node->value();
266  else
267  layoutType = node->valueAt<std::string>("type", "");
268 
269  if(!layoutType.empty()) {
270  UILayoutPtr layout;
271  if(layoutType == "horizontalBox")
272  layout = UIHorizontalLayoutPtr(new UIHorizontalLayout(static_self_cast<UIWidget>()));
273  else if(layoutType == "verticalBox")
274  layout = UIVerticalLayoutPtr(new UIVerticalLayout(static_self_cast<UIWidget>()));
275  else if(layoutType == "grid")
276  layout = UIGridLayoutPtr(new UIGridLayout(static_self_cast<UIWidget>()));
277  else if(layoutType == "anchor")
278  layout = UIAnchorLayoutPtr(new UIAnchorLayout(static_self_cast<UIWidget>()));
279  else
280  throw OTMLException(node, "cannot determine layout type");
281  setLayout(layout);
282  }
283 
284  if(node->hasChildren())
285  m_layout->applyStyle(node);
286  }
287  // anchors
288  else if(stdext::starts_with(node->tag(), "anchors.")) {
289  UIWidgetPtr parent = getParent();
290  if(!parent) {
291  if(m_firstOnStyle)
292  throw OTMLException(node, "cannot create anchor, there is no parent widget!");
293  else
294  continue;
295  }
296 
297  UILayoutPtr layout = parent->getLayout();
298  UIAnchorLayoutPtr anchorLayout;
299  if(layout->isUIAnchorLayout())
300  anchorLayout = layout->static_self_cast<UIAnchorLayout>();
301 
302  if(!anchorLayout)
303  throw OTMLException(node, "cannot create anchor, the parent widget doesn't use anchor layout!");
304 
305  std::string what = node->tag().substr(8);
306  if(what == "fill") {
307  fill(node->value());
308  } else if(what == "centerIn") {
309  centerIn(node->value());
310  } else {
311  Fw::AnchorEdge anchoredEdge = Fw::translateAnchorEdge(what);
312 
313  if(node->value() == "none") {
314  removeAnchor(anchoredEdge);
315  } else {
316  std::vector<std::string> split = stdext::split(node->value(), ".");
317  if(split.size() != 2)
318  throw OTMLException(node, "invalid anchor description");
319 
320  std::string hookedWidgetId = split[0];
322 
323  if(anchoredEdge == Fw::AnchorNone)
324  throw OTMLException(node, "invalid anchor edge");
325 
326  if(hookedEdge == Fw::AnchorNone)
327  throw OTMLException(node, "invalid anchor target edge");
328 
329  addAnchor(anchoredEdge, hookedWidgetId, hookedEdge);
330  }
331  }
332  }
333  }
334 }
335 
336 void UIWidget::drawBackground(const Rect& screenCoords)
337 {
338  if(m_backgroundColor.aF() > 0.0f) {
339  Rect drawRect = screenCoords;
340  drawRect.translate(m_backgroundRect.topLeft());
342  drawRect.resize(m_backgroundRect.size());
344  g_painter->drawFilledRect(drawRect);
345  }
346 }
347 
348 void UIWidget::drawBorder(const Rect& screenCoords)
349 {
350  // top
351  if(m_borderWidth.top > 0) {
353 
354  Rect borderRect(screenCoords.topLeft(), screenCoords.width(), m_borderWidth.top);
355  g_painter->drawFilledRect(borderRect);
356  }
357  // right
358  if(m_borderWidth.right > 0) {
360 
361  Rect borderRect(screenCoords.topRight() - Point(m_borderWidth.right - 1, 0), m_borderWidth.right, screenCoords.height());
362  g_painter->drawFilledRect(borderRect);
363  }
364  // bottom
365  if(m_borderWidth.bottom > 0) {
367 
368  Rect borderRect(screenCoords.bottomLeft() - Point(0, m_borderWidth.bottom - 1), screenCoords.width(), m_borderWidth.bottom);
369  g_painter->drawFilledRect(borderRect);
370  }
371  // left
372  if(m_borderWidth.left > 0) {
374 
375  Rect borderRect(screenCoords.topLeft(), m_borderWidth.left, screenCoords.height());
376  g_painter->drawFilledRect(borderRect);
377  }
378 }
379 
380 void UIWidget::drawIcon(const Rect& screenCoords)
381 {
382  if(m_icon) {
383  Rect drawRect;
384  if(m_iconRect.isValid()) {
385  drawRect = screenCoords;
386  drawRect.translate(m_iconRect.topLeft());
387  drawRect.resize(m_iconRect.size());
388  } else {
389  drawRect.resize(m_iconClipRect.size());
390 
392  drawRect.moveCenter(screenCoords.center());
393  else
394  drawRect.alignIn(screenCoords, m_iconAlign);
395  }
396  drawRect.translate(m_iconOffset);
399  }
400 }
401 
402 void UIWidget::setIcon(const std::string& iconFile)
403 {
404  if(iconFile.empty())
405  m_icon = nullptr;
406  else
407  m_icon = g_textures.getTexture(iconFile);
408  if(m_icon && !m_iconClipRect.isValid())
409  m_iconClipRect = Rect(0, 0, m_icon->getSize());
410 }
Painter::setColor
virtual void setColor(const Color &color)
Definition: painter.h:77
EdgeGroup::right
T right
Definition: uiwidget.h:41
TRect::bottomLeft
TPoint< T > bottomLeft() const
Definition: rect.h:63
UIWidget::m_layout
UILayoutPtr m_layout
Definition: uiwidget.h:72
UIWidget::setIconOffset
void setIconOffset(const Point &pos)
Definition: uiwidget.h:318
TRect::resize
void resize(const TSize< T > &size)
Definition: rect.h:100
UIWidget::setPaddingTop
void setPaddingTop(int padding)
Definition: uiwidget.h:345
UIWidget::setAutoFocusPolicy
void setAutoFocusPolicy(Fw::AutoFocusPolicy policy)
Definition: uiwidget.cpp:1009
UIWidget::m_iconOffset
Point m_iconOffset
Definition: uiwidget.h:418
UIWidget::fill
void fill(const std::string &hookedWidgetId)
Definition: uiwidget.cpp:597
UIWidget::setY
void setY(int y)
Definition: uiwidget.h:300
Color
Definition: color.h:32
UIWidget::setBackgroundRect
void setBackgroundRect(const Rect &rect)
Definition: uiwidget.h:313
UIWidget::m_iconRect
Rect m_iconRect
Definition: uiwidget.h:286
OTMLException
All OTML errors throw this exception.
Definition: otmlexception.h:29
UIWidget::getLayout
UILayoutPtr getLayout()
Definition: uiwidget.h:260
UIWidget::setFocusable
void setFocusable(bool focusable)
Definition: uiwidget.cpp:972
TRect< int >
Texture::getSize
const Size & getSize()
Definition: texture.h:50
UIWidget::centerIn
void centerIn(const std::string &hookedWidgetId)
Definition: uiwidget.cpp:585
UIWidget::setIconRect
void setIconRect(const Rect &rect)
Definition: uiwidget.h:322
uitranslator.h
UIWidget::setMarginRight
void setMarginRight(int margin)
Definition: uiwidget.h:339
EdgeGroup::top
T top
Definition: uiwidget.h:40
UIWidget::m_borderWidth
EdgeGroup< int > m_borderWidth
Definition: uiwidget.h:290
TRect::alignIn
void alignIn(const TRect< T > &r, Fw::AlignmentFlag align)
Definition: rect.h:287
uihorizontallayout.h
Fw::AnchorEdge
AnchorEdge
Definition: const.h:211
UIWidget::m_iconClipRect
Rect m_iconClipRect
Definition: uiwidget.h:287
UILayout::isUIAnchorLayout
virtual bool isUIAnchorLayout()
Definition: uilayout.h:51
UIWidget::setRotation
void setRotation(float degrees)
Definition: uiwidget.h:350
UIAnchorLayout
Definition: uianchorlayout.h:62
texturemanager.h
UIWidget::setIconColor
void setIconColor(const Color &color)
Definition: uiwidget.h:315
OTMLNode::children
OTMLNodeList children()
Definition: otmlnode.cpp:170
uiwidget.h
UIWidget::setPosition
void setPosition(const Point &pos)
Definition: uiwidget.h:304
UIWidget::addAnchor
void addAnchor(Fw::AnchorEdge anchoredEdge, const std::string &hookedWidgetId, Fw::AnchorEdge hookedEdge)
Definition: uiwidget.cpp:569
UIWidget::setIcon
void setIcon(const std::string &iconFile)
Definition: uiwidgetbasestyle.cpp:402
stdext::format
std::string format()
Definition: format.h:82
TRect::topRight
TPoint< T > topRight() const
Definition: rect.h:62
UIWidget::setBackgroundOffsetX
void setBackgroundOffsetX(int x)
Definition: uiwidget.h:307
stdext::starts_with
bool starts_with(const std::string &str, const std::string &test)
Definition: string.cpp:263
UIWidget::drawBorder
void drawBorder(const Rect &screenCoords)
Definition: uiwidgetbasestyle.cpp:348
UIWidget::setBorderWidthRight
void setBorderWidthRight(int width)
Definition: uiwidget.h:327
UIWidget::setBackgroundOffsetY
void setBackgroundOffsetY(int y)
Definition: uiwidget.h:308
UIWidget::setColor
void setColor(const Color &color)
Definition: uiwidget.h:305
UIWidget::setBackgroundColor
void setBackgroundColor(const Color &color)
Definition: uiwidget.h:306
UIVerticalLayoutPtr
stdext::shared_object_ptr< UIVerticalLayout > UIVerticalLayoutPtr
Definition: declarations.h:47
UIWidget::setIconHeight
void setIconHeight(int height)
Definition: uiwidget.h:320
UIWidget::setIconAlign
void setIconAlign(Fw::AlignmentFlag align)
Definition: uiwidget.h:324
UIWidget::setIconOffsetX
void setIconOffsetX(int x)
Definition: uiwidget.h:316
UIWidget::m_iconAlign
Fw::AlignmentFlag m_iconAlign
Definition: uiwidget.h:288
UIWidget::setPaddingBottom
void setPaddingBottom(int padding)
Definition: uiwidget.h:347
UIWidget::m_opacity
float m_opacity
Definition: uiwidget.h:293
UIWidget::setBorderWidth
void setBorderWidth(int width)
Definition: uiwidget.h:325
TRect::topLeft
TPoint< T > topLeft() const
Definition: rect.h:60
Fw::AlignNone
@ AlignNone
Definition: const.h:193
painter.h
UIHorizontalLayout
Definition: uihorizontallayout.h:28
Fw::translateAutoFocusPolicy
AutoFocusPolicy translateAutoFocusPolicy(std::string policy)
Definition: uitranslator.cpp:104
stdext::resolve_path
std::string resolve_path(const std::string &filePath, std::string sourcePath)
Resolve a file path by combining sourcePath with filePath.
Definition: string.cpp:35
UIWidget::m_id
std::string m_id
Definition: uiwidget.h:61
uianchorlayout.h
UIWidget::setIconClip
void setIconClip(const Rect &rect)
Definition: uiwidget.h:323
g_lua
LuaInterface g_lua
Definition: luainterface.cpp:31
UIGridLayout
Definition: uigridlayout.h:29
UIWidget::setBorderColor
void setBorderColor(const Color &color)
Definition: uiwidget.h:330
UIVerticalLayout
Definition: uiverticallayout.h:29
stdext::shared_object::static_self_cast
stdext::shared_object_ptr< T > static_self_cast()
Definition: shared_object.h:50
UIWidget::setChecked
void setChecked(bool checked)
Definition: uiwidget.cpp:966
EdgeGroup::set
void set(T value)
Definition: uiwidget.h:39
UIWidget::setOn
void setOn(bool on)
Definition: uiwidget.cpp:961
UIWidget::setDraggable
void setDraggable(bool draggable)
Definition: uiwidget.cpp:993
LuaObject::luaSetField
void luaSetField(const std::string &key)
Sets a field from this lua object, the value must be on the stack.
Definition: luaobject.cpp:62
UIWidget::setBackgroundOffset
void setBackgroundOffset(const Point &pos)
Definition: uiwidget.h:309
Color::white
static const Color white
Definition: color.h:101
Fw::AnchorNone
@ AnchorNone
Definition: const.h:212
UIWidget::setBorderWidthTop
void setBorderWidthTop(int width)
Definition: uiwidget.h:326
UIWidget::setHeight
void setHeight(int height)
Definition: uiwidget.h:302
UIWidget::getParent
UIWidgetPtr getParent()
Definition: uiwidget.h:255
UIWidget::setBorderColorRight
void setBorderColorRight(const Color &color)
Definition: uiwidget.h:332
TRect::moveCenter
void moveCenter(const TPoint< T > &p)
Definition: rect.h:122
TextureManager::getTexture
TexturePtr getTexture(const std::string &fileName)
Definition: texturemanager.cpp:90
UIWidget::m_backgroundRect
Rect m_backgroundRect
Definition: uiwidget.h:283
UIWidget::setBorderWidthBottom
void setBorderWidthBottom(int width)
Definition: uiwidget.h:328
Color::aF
float aF() const
Definition: color.h:49
UIWidget::setClipping
void setClipping(bool clipping)
Definition: uiwidget.h:131
UIWidget::setPhantom
void setPhantom(bool phantom)
Definition: uiwidget.cpp:988
Color::black
static const Color black
Definition: color.h:102
UIWidget::setWidth
void setWidth(int width)
Definition: uiwidget.h:301
UIWidget::setBorderColorBottom
void setBorderColorBottom(const Color &color)
Definition: uiwidget.h:333
UIWidget::drawIcon
void drawIcon(const Rect &screenCoords)
Definition: uiwidgetbasestyle.cpp:380
Rect
TRect< int > Rect
Definition: rect.h:319
uigridlayout.h
UIWidget::setIconWidth
void setIconWidth(int width)
Definition: uiwidget.h:319
UIWidget::setMarginTop
void setMarginTop(int margin)
Definition: uiwidget.h:338
stdext::split
std::vector< std::string > split(const std::string &str, const std::string &separators)
Definition: string.cpp:273
UIWidget::setIconOffsetY
void setIconOffsetY(int y)
Definition: uiwidget.h:317
Color::alpha
static const Color alpha
Definition: color.h:100
UIWidget::m_rotation
float m_rotation
Definition: uiwidget.h:294
UIWidget::setX
void setX(int x)
Definition: uiwidget.h:299
UIWidget::m_backgroundColor
Color m_backgroundColor
Definition: uiwidget.h:282
UIWidget::setOpacity
void setOpacity(float opacity)
Definition: uiwidget.h:349
UIWidget::setBorderWidthLeft
void setBorderWidthLeft(int width)
Definition: uiwidget.h:329
texture.h
UIWidget::setBackgroundWidth
void setBackgroundWidth(int width)
Definition: uiwidget.h:310
TRect::isValid
bool isValid() const
Definition: rect.h:50
UIWidget::m_icon
TexturePtr m_icon
Definition: uiwidget.h:284
UIWidget::m_borderColor
EdgeGroup< Color > m_borderColor
Definition: uiwidget.h:289
stdext::shared_object_ptr< OTMLNode >
UIWidget::setFixedSize
void setFixedSize(bool fixed)
Definition: uiwidget.cpp:998
Fw::translateAlignment
AlignmentFlag translateAlignment(std::string aligment)
Definition: uitranslator.cpp:27
UIWidget::removeAnchor
void removeAnchor(Fw::AnchorEdge anchoredEdge)
Definition: uiwidget.cpp:580
UIWidget::setLayout
void setLayout(const UILayoutPtr &layout)
Definition: uiwidget.cpp:843
UIWidget::setMarginLeft
void setMarginLeft(int margin)
Definition: uiwidget.h:341
g_painter
Painter * g_painter
Definition: painter.cpp:28
UIWidget::setEnabled
void setEnabled(bool enabled)
Definition: uiwidget.cpp:926
Fw::translateAnchorEdge
AnchorEdge translateAnchorEdge(std::string anchorEdge)
Definition: uitranslator.cpp:52
UIWidget::setVisible
void setVisible(bool visible)
Definition: uiwidget.cpp:936
UIWidget::setSize
void setSize(const Size &size)
Definition: uiwidget.h:303
TRect::height
T height() const
Definition: rect.h:70
UIGridLayoutPtr
stdext::shared_object_ptr< UIGridLayout > UIGridLayoutPtr
Definition: declarations.h:48
UIWidget::setPaddingRight
void setPaddingRight(int padding)
Definition: uiwidget.h:346
UIWidget::m_iconColor
Color m_iconColor
Definition: uiwidget.h:285
UIWidget::setPaddingLeft
void setPaddingLeft(int padding)
Definition: uiwidget.h:348
UIAnchorLayoutPtr
stdext::shared_object_ptr< UIAnchorLayout > UIAnchorLayoutPtr
Definition: declarations.h:51
g_textures
TextureManager g_textures
Definition: texturemanager.cpp:33
LuaInterface::loadFunction
void loadFunction(const std::string &buffer, const std::string &source="lua function buffer")
Definition: luainterface.cpp:338
TPoint< int >
TRect::size
TSize< T > size() const
Definition: rect.h:71
UIHorizontalLayoutPtr
stdext::shared_object_ptr< UIHorizontalLayout > UIHorizontalLayoutPtr
Definition: declarations.h:46
EdgeGroup::bottom
T bottom
Definition: uiwidget.h:42
EdgeGroup::left
T left
Definition: uiwidget.h:43
Painter::drawFilledRect
virtual void drawFilledRect(const Rect &dest)=0
UIWidget::setBackgroundHeight
void setBackgroundHeight(int height)
Definition: uiwidget.h:311
TRect::width
T width() const
Definition: rect.h:69
TRect::center
TPoint< T > center() const
Definition: rect.h:68
UILayout::applyStyle
virtual void applyStyle(const OTMLNodePtr &)
Definition: uilayout.h:39
TSize< int >
UIWidget::setMarginBottom
void setMarginBottom(int margin)
Definition: uiwidget.h:340
UIWidget::setBackgroundSize
void setBackgroundSize(const Size &size)
Definition: uiwidget.h:312
UIWidget::setRect
bool setRect(const Rect &rect)
Definition: uiwidget.cpp:870
UIWidget::setBorderColorTop
void setBorderColorTop(const Color &color)
Definition: uiwidget.h:331
UIWidget::setBorderColorLeft
void setBorderColorLeft(const Color &color)
Definition: uiwidget.h:334
UIWidget::setIconSize
void setIconSize(const Size &size)
Definition: uiwidget.h:321
Painter::drawTexturedRect
virtual void drawTexturedRect(const Rect &dest, const TexturePtr &texture, const Rect &src)=0
LuaInterface::evaluateExpression
void evaluateExpression(const std::string &expression, const std::string &source="lua expression")
Definition: luainterface.cpp:362
TRect::translate
void translate(T x, T y)
Definition: rect.h:98
uiverticallayout.h
UIWidget::drawBackground
void drawBackground(const Rect &screenCoords)
Definition: uiwidgetbasestyle.cpp:336
UIWidget::m_color
Color m_color
Definition: uiwidget.h:281