The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
widget.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2007 - 2016 by Mark de Wever <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #define GETTEXT_DOMAIN "wesnoth-lib"
16 
17 #include "gui/widgets/settings.hpp"
18 #include "gui/widgets/window.hpp"
20 #include "gui/core/log.hpp"
21 #include "sdl/rect.hpp"
22 
23 namespace gui2
24 {
25 
26 /***** ***** ***** Constructor and destructor. ***** ***** *****/
27 
29  : id_("")
30  , parent_(nullptr)
31  , x_(-1)
32  , y_(-1)
33  , width_(0)
34  , height_(0)
35  , layout_size_(tpoint(0, 0))
36 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
37  , last_best_size_(tpoint(0, 0))
38 #endif
39  , linked_group_()
40  , is_dirty_(true)
41  , visible_(tvisible::visible)
42  , redraw_action_(tredraw_action::full)
43  , clipping_rectangle_()
44 #ifndef LOW_MEM
45  , debug_border_mode_(0)
46  , debug_border_colour_(0)
47 #endif
48 {
49  DBG_GUI_LF << "widget create: " << static_cast<void*>(this) << "\n";
50 }
51 
53  : id_(builder.id)
54  , parent_(nullptr)
55  , x_(-1)
56  , y_(-1)
57  , width_(0)
58  , height_(0)
59  , layout_size_(tpoint(0, 0))
60 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
61  , last_best_size_(tpoint(0, 0))
62 #endif
63  , linked_group_(builder.linked_group)
64  , is_dirty_(true)
65  , visible_(tvisible::visible)
66  , redraw_action_(tredraw_action::full)
67  , clipping_rectangle_()
68 #ifndef LOW_MEM
69  , debug_border_mode_(builder.debug_border_mode)
70  , debug_border_colour_(builder.debug_border_color)
71 #endif
72 {
73  DBG_GUI_LF << "widget create: " << static_cast<void*>(this) << "\n";
74 }
75 
77 {
79  << "widget destroy: " << static_cast<void*>(this) << " (id: " << id_
80  << ")\n";
81 
82  twidget* p = parent();
83  while(p) {
84  fire(event::NOTIFY_REMOVAL, *p, nullptr);
85  p = p->parent();
86  }
87 
88  if(!linked_group_.empty()) {
89  if(twindow* window = get_window()) {
90  window->remove_linked_widget(linked_group_, this);
91  }
92  }
93 }
94 
95 /***** ***** ***** ***** ID functions. ***** ***** ***** *****/
96 
98 {
99  tcontrol* this_ctrl = dynamic_cast<tcontrol*>(this);
100 
101  DBG_GUI_LF
102  << "set id of " << static_cast<void*>(this) << " to '" << id << "' "
103  << "(was '" << id_ << "'). Widget type: "
104  << (this_ctrl ? this_ctrl->get_control_type() : typeid(twidget).name()) << "\n";
105 
106  id_ = id;
107 }
108 
109 const std::string& twidget::id() const
110 {
111  return id_;
112 }
113 
114 /***** ***** ***** ***** Parent functions ***** ***** ***** *****/
115 
117 {
118  // Go up into the parent tree until we find the top level
119  // parent, we can also be the toplevel so start with
120  // ourselves instead of our parent.
121  twidget* result = this;
122  while(result->parent_) {
123  result = result->parent_;
124  }
125 
126  // on error dynamic_cast returns nullptr which is what we want.
127  return dynamic_cast<twindow*>(result);
128 }
129 
131 {
132  // Go up into the parent tree until we find the top level
133  // parent, we can also be the toplevel so start with
134  // ourselves instead of our parent.
135  const twidget* result = this;
136  while(result->parent_) {
137  result = result->parent_;
138  }
139 
140  // on error dynamic_cast returns nullptr which is what we want.
141  return dynamic_cast<const twindow*>(result);
142 }
143 
145 {
146  twindow* window = get_window();
147  return window ? window->dialog() : nullptr;
148 }
149 
151 {
152  parent_ = parent;
153 }
154 
156 {
157  return parent_;
158 }
159 
160 /***** ***** ***** ***** Size and layout functions. ***** ***** ***** *****/
161 
162 void twidget::layout_initialise(const bool /*full_initialisation*/)
163 {
164  assert(visible_ != tvisible::invisible);
165  assert(get_window());
166 
167  layout_size_ = tpoint(0, 0);
168  if(!linked_group_.empty()) {
170  }
171 }
172 
173 void twidget::demand_reduce_width(const unsigned /*maximum_width*/)
174 {
175  /* DO NOTHING */
176 }
177 
178 void twidget::request_reduce_height(const unsigned /*maximum_height*/)
179 {
180  /* DO NOTHING */
181 }
182 
183 void twidget::demand_reduce_height(const unsigned /*maximum_height*/)
184 {
185  /* DO NOTHING */
186 }
187 
189 {
190  assert(visible_ != tvisible::invisible);
191 
193  if(result == tpoint(0, 0)) {
194  result = calculate_best_size();
195  //Adjust to linked widget size if linked widget size was already calculated.
196  if(!get_window()->get_need_layout() && !linked_group_.empty())
197  {
199  result.x = std::max(result.x, linked_size.x);
200  result.y = std::max(result.y, linked_size.y);
201  }
202  }
203 
204 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
205  last_best_size_ = result;
206 #endif
207 
208  return result;
209 }
210 
211 bool twidget::can_wrap() const
212 {
213  return false;
214 }
215 
216 void twidget::set_origin(const tpoint& origin)
217 {
218  x_ = origin.x;
219  y_ = origin.y;
220 }
221 
223 {
224  assert(size.x >= 0);
225  assert(size.y >= 0);
226 
227  width_ = size.x;
228  height_ = size.y;
229 
230  set_is_dirty(true);
231 }
232 
233 void twidget::place(const tpoint& origin, const tpoint& size)
234 {
235  assert(size.x >= 0);
236  assert(size.y >= 0);
237 
238  x_ = origin.x;
239  y_ = origin.y;
240  width_ = size.x;
241  height_ = size.y;
242 
243 #if 0
244  std::cerr
245  << "Id " << id()
246  << " rect " << get_rectangle()
247  << " parent "
248  << (parent ? parent->get_x() : 0)
249  << ','
250  << (parent ? parent->get_y() : 0)
251  << " screen origin " << x_ << ',' << y_
252  << ".\n";
253 #endif
254 
255  set_is_dirty(true);
256 }
257 
258 void twidget::move(const int x_offset, const int y_offset)
259 {
260  x_ += x_offset;
261  y_ += y_offset;
262 }
263 
265 {
266  /* DO NOTHING */
267 }
268 
270 {
271  return tpoint(x_, y_);
272 }
273 
275 {
276  return tpoint(width_, height_);
277 }
278 
279 SDL_Rect twidget::get_rectangle() const
280 {
281  return create_rect(get_origin(), get_size());
282 }
283 
284 int twidget::get_x() const
285 {
286  return x_;
287 }
288 
289 int twidget::get_y() const
290 {
291  return y_;
292 }
293 
294 unsigned twidget::get_width() const
295 {
296  return width_;
297 }
298 
299 unsigned twidget::get_height() const
300 {
301  return height_;
302 }
303 
305 {
306  layout_size_ = size;
307 }
308 
310 {
311  return layout_size_;
312 }
313 
314 void twidget::set_linked_group(const std::string& linked_group)
315 {
316  linked_group_ = linked_group;
317 }
318 
319 /***** ***** ***** ***** Drawing functions. ***** ***** ***** *****/
320 
321 SDL_Rect twidget::calculate_blitting_rectangle(const int x_offset,
322  const int y_offset)
323 {
324  SDL_Rect result = get_rectangle();
325  result.x += x_offset;
326  result.y += y_offset;
327  return result;
328 }
329 
330 SDL_Rect twidget::calculate_clipping_rectangle(const int x_offset,
331  const int y_offset)
332 {
333  SDL_Rect result = clipping_rectangle_;
334  result.x += x_offset;
335  result.y += y_offset;
336  return result;
337 }
338 
339 void twidget::draw_background(surface& frame_buffer, int x_offset, int y_offset)
340 {
341  assert(visible_ == tvisible::visible);
342 
344  const SDL_Rect clipping_rectangle
345  = calculate_clipping_rectangle(x_offset, y_offset);
346 
347  clip_rect_setter clip(frame_buffer, &clipping_rectangle);
348  draw_debug_border(frame_buffer, x_offset, y_offset);
349  impl_draw_background(frame_buffer, x_offset, y_offset);
350  } else {
351  draw_debug_border(frame_buffer, x_offset, y_offset);
352  impl_draw_background(frame_buffer, x_offset, y_offset);
353  }
354 }
355 
356 void twidget::draw_children(surface& frame_buffer, int x_offset, int y_offset)
357 {
358  assert(visible_ == tvisible::visible);
359 
361  const SDL_Rect clipping_rectangle
362  = calculate_clipping_rectangle(x_offset, y_offset);
363 
364  clip_rect_setter clip(frame_buffer, &clipping_rectangle);
365  impl_draw_children(frame_buffer, x_offset, y_offset);
366  } else {
367  impl_draw_children(frame_buffer, x_offset, y_offset);
368  }
369 }
370 
371 void twidget::draw_foreground(surface& frame_buffer, int x_offset, int y_offset)
372 {
373  assert(visible_ == tvisible::visible);
374 
376  const SDL_Rect clipping_rectangle
377  = calculate_clipping_rectangle(x_offset, y_offset);
378 
379  clip_rect_setter clip(frame_buffer, &clipping_rectangle);
380  impl_draw_foreground(frame_buffer, x_offset, y_offset);
381  } else {
382  impl_draw_foreground(frame_buffer, x_offset, y_offset);
383  }
384 }
385 
387  std::vector<twidget*>& call_stack)
388 {
389  assert(call_stack.empty() || call_stack.back() != this);
390 
391  if(visible_ != tvisible::visible) {
392  return;
393  }
394 
396  return;
397  }
398 
399  call_stack.push_back(this);
400  if(is_dirty_) {
401  caller.add_to_dirty_list(call_stack);
402  } else {
403  // virtual function which only does something for container items.
404  child_populate_dirty_list(caller, call_stack);
405  }
406 }
407 
408 void
410  ,
411  const std::vector<twidget*>& /*call_stack*/)
412 {
413  /* DO NOTHING */
414 }
415 
417 {
420 }
421 
422 void twidget::set_visible_rectangle(const SDL_Rect& rectangle)
423 {
425 
428  } else if(clipping_rectangle_ == sdl::empty_rect) {
430  } else {
432  }
433 }
434 
435 void twidget::set_is_dirty(const bool is_dirty)
436 {
437  is_dirty_ = is_dirty;
438 }
439 
441 {
442  return is_dirty_;
443 }
444 
446 {
447  if(visible == visible_) {
448  return;
449  }
450 
451  // Switching to or from invisible should invalidate the layout.
452  const bool need_resize = visible_ == tvisible::invisible
453  || visible == tvisible::invisible;
454  visible_ = visible;
455 
456  if(need_resize) {
457  if(new_widgets) {
458  event::tmessage message;
459  fire(event::REQUEST_PLACEMENT, *this, message);
460  } else {
461  twindow* window = get_window();
462  if(window) {
463  window->invalidate_layout();
464  }
465  }
466  } else {
467  set_is_dirty(true);
468  }
469 }
470 
472 {
473  return visible_;
474 }
475 
477 {
478  return (width_ == 0 || height_ == 0) ? tredraw_action::none
479  : redraw_action_;
480 }
481 
482 #ifndef LOW_MEM
483 
484 void twidget::set_debug_border_mode(const unsigned debug_border_mode)
485 {
486  debug_border_mode_ = debug_border_mode;
487 }
488 
489 void twidget::set_debug_border_colour(const unsigned debug_border_colour)
490 {
491  debug_border_colour_ = debug_border_colour;
492 }
493 
495 {
497  : get_rectangle();
498 
499  switch(debug_border_mode_) {
500  case 0:
501  /* DO NOTHING */
502  break;
503  case 1:
505  r.x, r.y, r.w, r.h, debug_border_colour_, frame_buffer);
506  break;
507 
508  case 2:
509  sdl::fill_rect(frame_buffer, &r, debug_border_colour_);
510  break;
511 
512  default:
513  assert(false);
514  }
515 }
516 
517 void
518 twidget::draw_debug_border(surface& frame_buffer, int x_offset, int y_offset)
519 {
521  ? calculate_clipping_rectangle(x_offset, y_offset)
522  : calculate_blitting_rectangle(x_offset, y_offset);
523 
524  switch(debug_border_mode_) {
525  case 0:
526  /* DO NOTHING */
527  break;
528 
529  case 1:
531  r.x, r.y, r.w, r.h, debug_border_colour_, frame_buffer);
532  break;
533 
534  case 2:
535  sdl::fill_rect(frame_buffer, &r, debug_border_colour_);
536  break;
537 
538  default:
539  assert(false);
540  }
541 }
542 
543 #endif
544 
545 /***** ***** ***** ***** Query functions ***** ***** ***** *****/
546 
547 twidget* twidget::find_at(const tpoint& coordinate, const bool must_be_active)
548 {
549  return is_at(coordinate, must_be_active) ? this : nullptr;
550 }
551 
552 const twidget* twidget::find_at(const tpoint& coordinate,
553  const bool must_be_active) const
554 {
555  return is_at(coordinate, must_be_active) ? this : nullptr;
556 }
557 
558 twidget* twidget::find(const std::string& id, const bool /*must_be_active*/)
559 {
560  return id_ == id ? this : nullptr;
561 }
562 
564  const bool /*must_be_active*/) const
565 {
566  return id_ == id ? this : nullptr;
567 }
568 
569 bool twidget::has_widget(const twidget& widget) const
570 {
571  return &widget == this;
572 }
573 
574 bool twidget::is_at(const tpoint& coordinate) const
575 {
576  return is_at(coordinate, true);
577 }
578 
579 bool twidget::recursive_is_visible(const twidget* widget, const bool must_be_active) const
580 {
581  while(widget) {
582  if(widget->visible_ == tvisible::invisible
583  || (widget->visible_ == tvisible::hidden && must_be_active)) {
584  return false;
585  }
586 
587  widget = widget->parent_;
588  }
589 
590  return true;
591 }
592 
593 bool twidget::is_at(const tpoint& coordinate, const bool must_be_active) const
594 {
595  if(!recursive_is_visible(this, must_be_active)) {
596  return false;
597  }
598 
599  return coordinate.x >= x_ && coordinate.x < (x_ + static_cast<int>(width_))
600  && coordinate.y >= y_
601  && coordinate.y < (y_ + static_cast<int>(height_));
602 }
603 
604 } // namespace gui2
Define the common log macros for the gui toolkit.
unsigned get_width() const
Definition: widget.cpp:294
#define DBG_GUI_LF
Definition: log.hpp:65
bool new_widgets
Do we wish to use the new library or not.
Definition: settings.cpp:40
SDL_Rect intersect_rects(SDL_Rect const &rect1, SDL_Rect const &rect2)
Calculates the intersection of two rectangles.
Definition: rect.cpp:58
tformula< unsigned > x_
The x coordinate of the rectangle.
Definition: canvas.cpp:682
void draw_foreground(surface &frame_buffer, int x_offset, int y_offset)
Draws the foreground of the widget.
Definition: widget.cpp:371
The widget is fully visible.
Definition: widget.hpp:127
void fill_rect(surface &dst, SDL_Rect *dst_rect, const Uint32 color)
Fill a rectangle on a given surface.
Definition: rect.hpp:143
std::string id_
Definition: formula.cpp:636
void set_parent(twidget *parent)
Definition: widget.cpp:150
virtual bool can_wrap() const
Can the widget wrap.
Definition: widget.cpp:211
virtual void impl_draw_children(surface &, int, int)
See draw_children.
Definition: widget.hpp:599
Contains the info needed to instantiate a widget.
tredraw_action::scoped_enum redraw_action_
Field for the action to do on a drawing request.
Definition: widget.hpp:707
unsigned width_
The width of the widget.
Definition: widget.hpp:467
virtual bool is_at(const tpoint &coordinate) const override
See event::tdispatcher::is_at.
Definition: widget.cpp:574
Visibility settings done by the user.
Definition: widget.hpp:61
virtual const std::string & get_control_type() const =0
Returns the control_type of the control.
const SDL_Rect empty_rect
Definition: rect.cpp:26
twidget * parent_
The parent widget.
Definition: widget.hpp:230
unsigned debug_border_colour_
The colour for the debug border.
Definition: widget.hpp:728
This file contains the window object, this object is a top level container which has the event manage...
tvisible::scoped_enum get_visible() const
Definition: widget.cpp:471
The widget is not visible.
Definition: widget.hpp:142
tpoint get_size() const
Returns the size of the widget.
Definition: widget.cpp:274
int get_y() const
Definition: widget.cpp:289
virtual void demand_reduce_height(const unsigned maximum_height)
Tries to reduce the height of a widget.
Definition: widget.cpp:183
SDL_Rect create_rect(const tpoint &origin, const tpoint &size)
Creates a rectangle.
Definition: helper.cpp:50
bool is_dirty_
Is the widget dirty?
Definition: widget.hpp:701
void set_is_dirty(const bool is_dirty)
Definition: widget.cpp:435
std::string linked_group_
The linked group the widget belongs to.
Definition: widget.hpp:503
tpoint get_best_size() const
Gets the best size for the widget.
Definition: widget.cpp:188
virtual void layout_initialise(const bool full_initialisation)
How the layout engine works.
Definition: widget.cpp:162
virtual void move(const int x_offset, const int y_offset)
Moves a widget.
Definition: widget.cpp:258
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:62
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
unsigned debug_border_mode_
Mode for drawing the debug border.
Definition: widget.hpp:725
tredraw_action::scoped_enum get_drawing_action() const
Definition: widget.cpp:476
twidget * parent()
Definition: widget.cpp:155
The user set the widget invisible, that means:
Definition: widget.hpp:103
SDL_Rect calculate_clipping_rectangle(const int x_offset, const int y_offset)
Calculates the clipping rectangle of the widget.
Definition: widget.cpp:330
const tpoint & layout_size() const
Definition: widget.cpp:309
tdialog * dialog()
Inherited from twidget.
Definition: window.hpp:290
GLuint64EXT * result
Definition: glew.h:10727
SDL_Rect clipping_rectangle_
The clipping rectangle if a widget is partly visible.
Definition: widget.hpp:710
GLuint id
Definition: glew.h:1647
This file contains the settings handling of the widget library.
bool recursive_is_visible(const twidget *widget, const bool must_be_active) const
Is the widget and every single one of its parents visible?
Definition: widget.cpp:579
bool fire(const tevent event, twidget &target)
Fires an event which has no extra parameters.
Definition: dispatcher.cpp:144
Abstract base class for all dialogs.
Definition: dialog.hpp:121
int x_
The x-coordinate of the widget on the screen.
Definition: widget.hpp:461
int y
y coordinate.
Definition: point.hpp:34
void set_layout_size(const tpoint &size)
Definition: widget.cpp:304
virtual void impl_draw_foreground(surface &, int, int)
See draw_foreground.
Definition: widget.hpp:608
void populate_dirty_list(twindow &caller, std::vector< twidget * > &call_stack)
Adds a widget to the dirty list if it is dirty.
Definition: widget.cpp:386
This file contains the defintions for the gui2::event::tmessage class.
tpoint layout_size_
The best size for the widget.
Definition: widget.hpp:479
void draw_children(surface &frame_buffer, int x_offset, int y_offset)
Draws the children of a widget.
Definition: widget.cpp:356
bool get_is_dirty() const
Definition: widget.cpp:440
The user sets the widget hidden, that means:
Definition: widget.hpp:91
virtual void child_populate_dirty_list(twindow &caller, const std::vector< twidget * > &call_stack)
Tries to add all children of a container to the dirty list.
Definition: widget.cpp:409
int get_x() const
Definition: widget.cpp:284
void set_id(const std::string &id)
Definition: widget.cpp:97
Request for somebody to place the widget.
Definition: handler.hpp:175
virtual void place(const tpoint &origin, const tpoint &size)
Places the widget.
Definition: widget.cpp:233
void draw_background(surface &frame_buffer, int x_offset, int y_offset)
Draws the background of a widget.
Definition: widget.cpp:339
GLfloat GLfloat p
Definition: glew.h:12766
int x
x coordinate.
Definition: point.hpp:31
The user sets the widget visible, that means:
Definition: widget.hpp:79
tpoint get_origin() const
Returns the screen origin of the widget.
Definition: widget.cpp:269
std::string id_
The id is the unique name of the widget in a certain context.
Definition: widget.hpp:183
void set_debug_border_colour(const unsigned debug_border_colour)
Definition: widget.cpp:489
unsigned height_
The height of the widget.
Definition: widget.hpp:470
virtual bool has_widget(const twidget &widget) const
Does the widget contain the widget.
Definition: widget.cpp:569
unsigned get_height() const
Definition: widget.cpp:299
const std::string & id() const
Definition: widget.cpp:109
Holds a 2D point.
Definition: point.hpp:24
SDL_Rect calculate_blitting_rectangle(const int x_offset, const int y_offset)
Calculates the blitting rectangle of the widget.
Definition: widget.cpp:321
tformula< unsigned > y_
The y coordinate of the rectangle.
Definition: canvas.cpp:682
GLdouble GLdouble GLdouble r
Definition: glew.h:1374
virtual void request_reduce_height(const unsigned maximum_height)
Tries to reduce the height of a widget.
Definition: widget.cpp:178
Send by a widget to notify others it's being destroyed.
Definition: handler.hpp:128
virtual void set_visible_rectangle(const SDL_Rect &rectangle)
Sets the visible rectangle for a widget.
Definition: widget.cpp:422
virtual tpoint calculate_best_size() const =0
Calculates the best size.
virtual twidget * find_at(const tpoint &coordinate, const bool must_be_active)
Returns the widget at the wanted coordinates.
Definition: widget.cpp:547
Base class for all visible items.
Definition: control.hpp:34
GLuint const GLchar * name
Definition: glew.h:1782
virtual void demand_reduce_width(const unsigned maximum_width)
Tries to reduce the width of a widget.
Definition: widget.cpp:173
GLsizeiptr size
Definition: glew.h:1649
tdialog * dialog()
Returns the top-level dialogue.
Definition: widget.cpp:144
void add_to_dirty_list(const std::vector< twidget * > &call_stack)
Adds an item to the dirty_list_.
Definition: window.hpp:213
virtual void set_origin(const tpoint &origin)
Sets the origin of the widget.
Definition: widget.cpp:216
Contains the SDL_Rect helper code.
void add_linked_widget(const std::string &id, twidget *widget)
Adds a widget to a linked size group.
Definition: window.cpp:984
tvisible::scoped_enum visible_
Field for the status of the visibility.
Definition: widget.hpp:704
Base class for all widgets.
Definition: widget.hpp:49
GLsizei GLenum GLuint GLuint GLsizei char * message
Definition: glew.h:2499
Visibility set by the engine.
Definition: widget.hpp:113
virtual ~twidget() override
Definition: widget.cpp:76
SDL_Rect get_dirty_rectangle() const
Gets the dirty rectangle of the widget.
Definition: widget.cpp:416
int y_
The y-coordinate of the widget on the screen.
Definition: widget.hpp:464
twindow * get_window()
Get the parent window.
Definition: widget.cpp:116
SDL_Rect get_rectangle() const
Gets the bounding rectangle of the widget on the screen.
Definition: widget.cpp:279
virtual void set_size(const tpoint &size)
Sets the size of the widget.
Definition: widget.cpp:222
The widget is partly visible.
Definition: widget.hpp:135
void set_debug_border_mode(const unsigned debug_border_mode)
Definition: widget.cpp:484
tpoint get_linked_size(const std::string &linked_group_id) const
Definition: window.hpp:454
virtual void impl_draw_background(surface &)
See draw_background.
Definition: widget.hpp:587
virtual twidget * find(const std::string &id, const bool must_be_active)
Returns a widget with the wanted id.
Definition: widget.cpp:558
void set_visible(const tvisible::scoped_enum visible)
Definition: widget.cpp:445
virtual void layout_children()
Allows a widget to update its children.
Definition: widget.cpp:264
GLsizei const GLcharARB ** string
Definition: glew.h:4503
void draw_rectangle(int x, int y, int w, int h, Uint32 color, surface target)
Draw a colored rectangle on a surface.
Definition: rect.cpp:103
void draw_debug_border(surface &frame_buffer)
Definition: widget.cpp:494
void invalidate_layout()
Updates the size of the window.
Definition: window.cpp:941
void set_linked_group(const std::string &linked_group)
Definition: widget.cpp:314