The Battle for Wesnoth  1.15.5+dev
widget.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2007 - 2018 by Mark de Wever <koraq@xs4all.nl>
3  Part of the Battle for Wesnoth Project https://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/grid.hpp"
18 #include "gui/widgets/settings.hpp"
19 #include "gui/widgets/window.hpp"
21 #include "gui/core/log.hpp"
23 #include "sdl/rect.hpp"
24 
25 namespace gui2
26 {
27 
28 /***** ***** ***** Constructor and destructor. ***** ***** *****/
29 
31  : enable_lua_ptr<widget>(this)
32  , id_("")
33  , parent_(nullptr)
34  , x_(-1)
35  , y_(-1)
36  , width_(0)
37  , height_(0)
38  , layout_size_()
39 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
40  , last_best_size_()
41 #endif
42  , linked_group_()
43  , is_dirty_(true)
44  , visible_(visibility::visible)
45  , redraw_action_(redraw_action::full)
46  , clipping_rectangle_()
47  , debug_border_mode_(0)
48  , debug_border_color_(0,0,0,0)
49 {
50  DBG_GUI_LF << "widget create: " << static_cast<void*>(this) << "\n";
51 }
52 
54  : enable_lua_ptr<widget>(this)
55  , id_(builder.id)
56  , parent_(nullptr)
57  , x_(-1)
58  , y_(-1)
59  , width_(0)
60  , height_(0)
61  , layout_size_()
62 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
63  , last_best_size_()
64 #endif
65  , linked_group_(builder.linked_group)
66  , is_dirty_(true)
67  , visible_(visibility::visible)
70  , debug_border_mode_(builder.debug_border_mode)
71  , debug_border_color_(builder.debug_border_color)
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  widget* 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(window* window = get_window()) {
91  }
92  }
93 }
94 
95 /***** ***** ***** ***** ID functions. ***** ***** ***** *****/
96 
97 void widget::set_id(const std::string& id)
98 {
99  styled_widget* this_ctrl = dynamic_cast<styled_widget*>(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(widget).name()) << "\n";
105 
106  id_ = id;
107 }
108 
109 const std::string& widget::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  widget* 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<window*>(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 widget* 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 window*>(result);
142 }
143 
145 {
146  widget* result = parent_;
147  while(result && dynamic_cast<grid*>(result) == nullptr) {
148  result = result->parent_;
149  }
150 
151  return result ? dynamic_cast<grid*>(result) : nullptr;
152 }
153 
155 {
156  parent_ = parent;
157 }
158 
160 {
161  return parent_;
162 }
163 
164 /***** ***** ***** ***** Size and layout functions. ***** ***** ***** *****/
165 
166 void widget::layout_initialize(const bool /*full_initialization*/)
167 {
168  assert(visible_ != visibility::invisible);
169  assert(get_window());
170 
171  layout_size_ = point();
172  if(!linked_group_.empty()) {
174  }
175 }
176 
177 void widget::demand_reduce_width(const unsigned /*maximum_width*/)
178 {
179  /* DO NOTHING */
180 }
181 
182 void widget::request_reduce_height(const unsigned /*maximum_height*/)
183 {
184  /* DO NOTHING */
185 }
186 
187 void widget::demand_reduce_height(const unsigned /*maximum_height*/)
188 {
189  /* DO NOTHING */
190 }
191 
193 {
194  assert(visible_ != visibility::invisible);
195 
196  point result = layout_size_;
197  if(result == point()) {
198  result = calculate_best_size();
199  //Adjust to linked widget size if linked widget size was already calculated.
200  if(!get_window()->get_need_layout() && !linked_group_.empty())
201  {
202  point linked_size = get_window()->get_linked_size(linked_group_);
203  result.x = std::max(result.x, linked_size.x);
204  result.y = std::max(result.y, linked_size.y);
205  }
206  }
207 
208 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
209  last_best_size_ = result;
210 #endif
211 
212  return result;
213 }
214 
215 bool widget::can_wrap() const
216 {
217  return false;
218 }
219 
220 void widget::set_origin(const point& origin)
221 {
222  x_ = origin.x;
223  y_ = origin.y;
224 }
225 
227 {
228  assert(size.x >= 0);
229  assert(size.y >= 0);
230 
231  width_ = size.x;
232  height_ = size.y;
233 
234  set_is_dirty(true);
235 }
236 
237 void widget::place(const point& origin, const point& size)
238 {
239  assert(size.x >= 0);
240  assert(size.y >= 0);
241 
242  x_ = origin.x;
243  y_ = origin.y;
244  width_ = size.x;
245  height_ = size.y;
246 
247 #if 0
248  std::cerr
249  << "Id " << id()
250  << " rect " << get_rectangle()
251  << " parent "
252  << (parent ? parent->get_x() : 0)
253  << ','
254  << (parent ? parent->get_y() : 0)
255  << " screen origin " << x_ << ',' << y_
256  << ".\n";
257 #endif
258 
259  set_is_dirty(true);
260 }
261 
262 void widget::move(const int x_offset, const int y_offset)
263 {
264  x_ += x_offset;
265  y_ += y_offset;
266 }
267 
269 {
270  grid* parent_grid = get_parent_grid();
271  if(!parent_grid) {
272  return;
273  }
274 
276 
277  // TODO: evaluate necessity
278  //get_window()->invalidate_layout();
279 }
280 
282 {
283  grid* parent_grid = get_parent_grid();
284  if(!parent_grid) {
285  return;
286  }
287 
289 
290  // TODO: evaluate necessity
291  //get_window()->invalidate_layout();
292 }
293 
295 {
296  /* DO NOTHING */
297 }
298 
300 {
301  return point(x_, y_);
302 }
303 
305 {
306  return point(width_, height_);
307 }
308 
309 SDL_Rect widget::get_rectangle() const
310 {
311  return create_rect(get_origin(), get_size());
312 }
313 
314 int widget::get_x() const
315 {
316  return x_;
317 }
318 
319 int widget::get_y() const
320 {
321  return y_;
322 }
323 
324 unsigned widget::get_width() const
325 {
326  return width_;
327 }
328 
329 unsigned widget::get_height() const
330 {
331  return height_;
332 }
333 
335 {
336  layout_size_ = size;
337 }
338 
340 {
341  return layout_size_;
342 }
343 
344 void widget::set_linked_group(const std::string& linked_group)
345 {
346  linked_group_ = linked_group;
347 }
348 
349 /***** ***** ***** ***** Drawing functions. ***** ***** ***** *****/
350 
351 SDL_Rect widget::calculate_blitting_rectangle(const int x_offset,
352  const int y_offset)
353 {
354  SDL_Rect result = get_rectangle();
355  result.x += x_offset;
356  result.y += y_offset;
357  return result;
358 }
359 
360 SDL_Rect widget::calculate_clipping_rectangle(const int x_offset,
361  const int y_offset)
362 {
363  SDL_Rect result = clipping_rectangle_;
364  result.x += x_offset;
365  result.y += y_offset;
366  return result;
367 }
368 
369 void widget::draw_background(surface& frame_buffer, int x_offset, int y_offset)
370 {
371  assert(visible_ == visibility::visible);
372 
374  const SDL_Rect clipping_rectangle
375  = calculate_clipping_rectangle(x_offset, y_offset);
376 
377  clip_rect_setter clip(frame_buffer, &clipping_rectangle);
378  draw_debug_border(x_offset, y_offset);
379  impl_draw_background(frame_buffer, x_offset, y_offset);
380  } else {
381  draw_debug_border(x_offset, y_offset);
382  impl_draw_background(frame_buffer, x_offset, y_offset);
383  }
384 }
385 
386 void widget::draw_children(surface& frame_buffer, int x_offset, int y_offset)
387 {
388  assert(visible_ == visibility::visible);
389 
391  const SDL_Rect clipping_rectangle
392  = calculate_clipping_rectangle(x_offset, y_offset);
393 
394  clip_rect_setter clip(frame_buffer, &clipping_rectangle);
395  impl_draw_children(frame_buffer, x_offset, y_offset);
396  } else {
397  impl_draw_children(frame_buffer, x_offset, y_offset);
398  }
399 }
400 
401 void widget::draw_foreground(surface& frame_buffer, int x_offset, int y_offset)
402 {
403  assert(visible_ == visibility::visible);
404 
406  const SDL_Rect clipping_rectangle
407  = calculate_clipping_rectangle(x_offset, y_offset);
408 
409  clip_rect_setter clip(frame_buffer, &clipping_rectangle);
410  impl_draw_foreground(frame_buffer, x_offset, y_offset);
411  } else {
412  impl_draw_foreground(frame_buffer, x_offset, y_offset);
413  }
414 }
415 
417  std::vector<widget*>& call_stack)
418 {
419  assert(call_stack.empty() || call_stack.back() != this);
420 
422  return;
423  }
424 
426  return;
427  }
428 
429  call_stack.push_back(this);
430  if(is_dirty_) {
431  caller.add_to_dirty_list(call_stack);
432  } else {
433  // virtual function which only does something for container items.
434  child_populate_dirty_list(caller, call_stack);
435  }
436 }
437 
438 void
440  ,
441  const std::vector<widget*>& /*call_stack*/)
442 {
443  /* DO NOTHING */
444 }
445 
447 {
450 }
451 
452 void widget::set_visible_rectangle(const SDL_Rect& rectangle)
453 {
455 
458  } else if(clipping_rectangle_ == sdl::empty_rect) {
460  } else {
462  }
463 }
464 
465 void widget::set_is_dirty(const bool is_dirty)
466 {
467  is_dirty_ = is_dirty;
468 }
469 
471 {
472  return is_dirty_;
473 }
474 
475 void widget::set_visible(const visibility visible)
476 {
477  if(visible == visible_) {
478  return;
479  }
480 
481  // Switching to or from invisible should invalidate the layout
482  // if the widget has already been laid out.
483  const bool need_resize = visible_ == visibility::invisible
484  || (visible == visibility::invisible && get_size() != point());
485  visible_ = visible;
486 
487  if(need_resize) {
488  if(visible == visibility::visible && new_widgets) {
490  fire(event::REQUEST_PLACEMENT, *this, message);
491  } else {
492  window* window = get_window();
493  if(window) {
494  window->invalidate_layout();
495  }
496  }
497  } else {
498  set_is_dirty(true);
499  }
500 }
501 
503 {
504  return visible_;
505 }
506 
508 {
509  return (width_ == 0 || height_ == 0) ? redraw_action::none
510  : redraw_action_;
511 }
512 
513 void widget::set_debug_border_mode(const unsigned debug_border_mode)
514 {
515  debug_border_mode_ = debug_border_mode;
516 }
517 
518 void widget::set_debug_border_color(const color_t debug_border_color)
519 {
520  debug_border_color_ = debug_border_color;
521 }
522 
524 {
526  : get_rectangle();
527 
528  switch(debug_border_mode_) {
529  case 0:
530  /* DO NOTHING */
531  break;
532  case 1:
534  break;
535 
536  case 2:
538  break;
539 
540  default:
541  assert(false);
542  }
543 }
544 
545 void
546 widget::draw_debug_border(int x_offset, int y_offset)
547 {
548  SDL_Rect r = redraw_action_ == redraw_action::partly
549  ? calculate_clipping_rectangle(x_offset, y_offset)
550  : calculate_blitting_rectangle(x_offset, y_offset);
551 
552  switch(debug_border_mode_) {
553  case 0:
554  /* DO NOTHING */
555  break;
556 
557  case 1:
559  break;
560 
561  case 2:
563  break;
564 
565  default:
566  assert(false);
567  }
568 }
569 
570 /***** ***** ***** ***** Query functions ***** ***** ***** *****/
571 
572 widget* widget::find_at(const point& coordinate, const bool must_be_active)
573 {
574  return is_at(coordinate, must_be_active) ? this : nullptr;
575 }
576 
578  const bool must_be_active) const
579 {
580  return is_at(coordinate, must_be_active) ? this : nullptr;
581 }
582 
583 widget* widget::find(const std::string& id, const bool /*must_be_active*/)
584 {
585  return id_ == id ? this : nullptr;
586 }
587 
588 const widget* widget::find(const std::string& id,
589  const bool /*must_be_active*/) const
590 {
591  return id_ == id ? this : nullptr;
592 }
593 
594 bool widget::has_widget(const widget& widget) const
595 {
596  return &widget == this;
597 }
598 
599 bool widget::is_at(const point& coordinate) const
600 {
601  return is_at(coordinate, true);
602 }
603 
604 bool widget::recursive_is_visible(const widget* widget, const bool must_be_active) const
605 {
606  while(widget) {
607  if(widget->visible_ == visibility::invisible
608  || (widget->visible_ == visibility::hidden && must_be_active)) {
609  return false;
610  }
611 
612  widget = widget->parent_;
613  }
614 
615  return true;
616 }
617 
618 bool widget::is_at(const point& coordinate, const bool must_be_active) const
619 {
620  if(!recursive_is_visible(this, must_be_active)) {
621  return false;
622  }
623 
624  return sdl::point_in_rect(coordinate, get_rectangle());
625 }
626 
627 } // namespace gui2
Define the common log macros for the gui toolkit.
#define DBG_GUI_LF
Definition: log.hpp:64
Contains the info needed to instantiate a widget.
bool new_widgets
Do we wish to use the new library or not.
Definition: settings.cpp:24
grid * get_parent_grid()
Get the parent grid.
Definition: widget.cpp:144
int get_x() const
Definition: widget.cpp:314
SDL_Rect create_rect(const point &origin, const point &size)
Creates a rectangle.
Definition: helper.cpp:32
void set_parent(widget *parent)
Definition: widget.cpp:154
virtual bool is_at(const point &coordinate) const override
See event::dispatcher::is_at.
Definition: widget.cpp:599
void set_debug_border_mode(const unsigned debug_border_mode)
Definition: widget.cpp:513
virtual void layout_initialize(const bool full_initialization)
How the layout engine works.
Definition: widget.cpp:166
void set_layout_size(const point &size)
Definition: widget.cpp:334
redraw_action
Visibility set by the engine.
Definition: widget.hpp:104
SDL_Rect calculate_blitting_rectangle(const int x_offset, const int y_offset)
Calculates the blitting rectangle of the widget.
Definition: widget.cpp:351
virtual widget * find(const std::string &id, const bool must_be_active)
Returns a widget with the wanted id.
Definition: widget.cpp:583
virtual void impl_draw_foreground(surface &, int, int)
See draw_foreground.
Definition: widget.hpp:613
visibility get_visible() const
Definition: widget.cpp:502
Main class to show messages to the user.
Definition: message.hpp:34
unsigned debug_border_mode_
Mode for drawing the debug border.
Definition: widget.hpp:724
widget * parent_
The parent widget.
Definition: widget.hpp:209
const std::string & id() const
Definition: widget.cpp:109
This file contains the window object, this object is a top level container which has the event manage...
unsigned height_
The height of the widget.
Definition: widget.hpp:472
redraw_action get_drawing_action() const
Definition: widget.cpp:507
SDL_Rect get_rectangle() const
Gets the bounding rectangle of the widget on the screen.
Definition: widget.cpp:309
Base class for all widgets.
Definition: widget.hpp:49
virtual void set_visible_rectangle(const SDL_Rect &rectangle)
Sets the visible rectangle for a widget.
Definition: widget.cpp:452
unsigned get_height() const
Definition: widget.cpp:329
redraw_action redraw_action_
Field for the action to do on a drawing request.
Definition: widget.hpp:708
SDL_Rect intersect_rects(const SDL_Rect &rect1, const SDL_Rect &rect2)
Calculates the intersection of two rectangles.
Definition: rect.cpp:39
static const unsigned HORIZONTAL_MASK
Definition: grid.hpp:59
virtual void request_reduce_height(const unsigned maximum_height)
Tries to reduce the height of a widget.
Definition: widget.cpp:182
virtual ~widget() override
Definition: widget.cpp:76
void draw_debug_border()
Definition: widget.cpp:523
virtual void demand_reduce_width(const unsigned maximum_width)
Tries to reduce the width of a widget.
Definition: widget.cpp:177
std::string id_
The id is the unique name of the widget in a certain context.
Definition: widget.hpp:170
unsigned get_width() const
Definition: widget.cpp:324
visibility visible_
Field for the status of the visibility.
Definition: widget.hpp:705
virtual void set_horizontal_alignment(const std::string &alignment)
Sets the horizontal alignment of the widget within its parent grid.
Definition: widget.cpp:268
int x
x coordinate.
Definition: point.hpp:44
Generic file dialog.
Definition: field-fwd.hpp:22
point get_linked_size(const std::string &linked_group_id) const
Definition: window.hpp:395
The message callbacks hold a reference to a message.
Definition: message.hpp:45
Base container class.
Definition: grid.hpp:30
virtual void impl_draw_background(surface &)
See draw_background.
Definition: widget.hpp:592
void populate_dirty_list(window &caller, std::vector< widget *> &call_stack)
Adds a widget to the dirty list if it is dirty.
Definition: widget.cpp:416
Request to place the widget.
Definition: handler.hpp:102
SDL_Rect get_dirty_rectangle() const
Gets the dirty rectangle of the widget.
Definition: widget.cpp:446
point get_best_size() const
Gets the best size for the widget.
Definition: widget.cpp:192
virtual void demand_reduce_height(const unsigned maximum_height)
Tries to reduce the height of a widget.
Definition: widget.cpp:187
This file contains the settings handling of the widget library.
virtual void place(const point &origin, const point &size)
Places the widget.
Definition: widget.cpp:237
The widget is fully visible.
void set_visible(const visibility visible)
Definition: widget.cpp:475
void set_is_dirty(const bool is_dirty)
Definition: widget.cpp:465
virtual void set_origin(const point &origin)
Sets the origin of the widget.
Definition: widget.cpp:220
Sent by a widget to notify others it&#39;s being destroyed.
Definition: handler.hpp:95
void draw_rectangle(const SDL_Rect &rect, const color_t &color)
Draw a rectangle outline.
Definition: rect.cpp:57
widget * parent()
Definition: widget.cpp:159
The widget is not visible.
virtual point calculate_best_size() const =0
Calculates the best size.
virtual bool has_widget(const widget &widget) const
Does the widget contain the widget.
Definition: widget.cpp:594
This file contains the definitions for the gui2::event::message class.
point layout_size_
The best size for the widget.
Definition: widget.hpp:484
void draw_background(surface &frame_buffer, int x_offset, int y_offset)
Draws the background of a widget.
Definition: widget.cpp:369
std::string linked_group_
The linked group the widget belongs to.
Definition: widget.hpp:508
int y_
The y-coordinate of the widget on the screen.
Definition: widget.hpp:466
virtual void impl_draw_children(surface &, int, int)
See draw_children.
Definition: widget.hpp:604
int get_y() const
Definition: widget.cpp:319
bool point_in_rect(int x, int y, const SDL_Rect &rect)
Tests whether a point is inside a rectangle.
Definition: rect.cpp:22
void add_linked_widget(const std::string &id, widget *widget)
Adds a widget to a linked size group.
Definition: window.cpp:848
void add_to_dirty_list(const std::vector< widget *> &call_stack)
Adds an item to the dirty_list_.
Definition: window.hpp:160
u64 size
Definition: statement.cpp:80
mock_party p
The user set the widget invisible, that means:
color_t debug_border_color_
The color for the debug border.
Definition: widget.hpp:727
window * get_window()
Get the parent window.
Definition: widget.cpp:116
visibility
Visibility settings done by the user.
Definition: widget.hpp:59
Holds a 2D point.
Definition: point.hpp:23
static const unsigned VERTICAL_MASK
Definition: grid.hpp:52
virtual void layout_children()
Allows a widget to update its children.
Definition: widget.cpp:294
Base class for all visible items.
bool recursive_is_visible(const widget *widget, const bool must_be_active) const
Is the widget and every single one of its parents visible?
Definition: widget.cpp:604
bool get_is_dirty() const
Definition: widget.cpp:470
unsigned get_v_align(const std::string &v_align)
Returns the vertical alignment.
Definition: helper.cpp:37
point get_size() const
Returns the size of the widget.
Definition: widget.cpp:304
SDL_Rect clipping_rectangle_
The clipping rectangle if a widget is partly visible.
Definition: widget.hpp:711
unsigned width_
The width of the widget.
Definition: widget.hpp:469
Contains the SDL_Rect helper code.
The user sets the widget visible, that means:
The user sets the widget hidden, that means:
void set_child_alignment(widget *widget, unsigned set_flag, unsigned mode_mask)
Modifies the widget alignment data of a child cell containing a specific widget.
Definition: grid.cpp:943
constexpr const SDL_Rect empty_rect
Definition: rect.hpp:31
virtual void move(const int x_offset, const int y_offset)
Moves a widget.
Definition: widget.cpp:262
void set_id(const std::string &id)
Definition: widget.cpp:97
void set_debug_border_color(const color_t debug_border_color)
Definition: widget.cpp:518
void fill_rectangle(const SDL_Rect &rect, const color_t &color)
Draws a filled rectangle.
Definition: rect.cpp:65
void draw_foreground(surface &frame_buffer, int x_offset, int y_offset)
Draws the foreground of the widget.
Definition: widget.cpp:401
bool fire(const ui_event event, widget &target)
Fires an event which has no extra parameters.
Definition: dispatcher.cpp:130
virtual void set_size(const point &size)
Sets the size of the widget.
Definition: widget.cpp:226
const point & layout_size() const
Definition: widget.cpp:339
void invalidate_layout()
Updates the size of the window.
Definition: window.cpp:805
virtual void set_vertical_alignment(const std::string &alignment)
Sets the horizontal alignment of the widget within its parent grid.
Definition: widget.cpp:281
virtual const std::string & get_control_type() const =0
Returns the type of this styled_widget.
bool is_dirty_
Is the widget dirty?
Definition: widget.hpp:702
virtual widget * find_at(const point &coordinate, const bool must_be_active)
Returns the widget at the wanted coordinates.
Definition: widget.cpp:572
void draw_children(surface &frame_buffer, int x_offset, int y_offset)
Draws the children of a widget.
Definition: widget.cpp:386
void remove_linked_widget(const std::string &id, const widget *widget)
Removes a widget from a linked size group.
Definition: window.cpp:862
map_location coordinate
Contains an x and y coordinate used for starting positions in maps.
virtual bool can_wrap() const
Can the widget wrap.
Definition: widget.cpp:215
unsigned get_h_align(const std::string &h_align)
Returns the horizontal alignment.
Definition: helper.cpp:52
The widget is partly visible.
int y
y coordinate.
Definition: point.hpp:47
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:62
int x_
The x-coordinate of the widget on the screen.
Definition: widget.hpp:463
virtual void child_populate_dirty_list(window &caller, const std::vector< widget *> &call_stack)
Tries to add all children of a container to the dirty list.
Definition: widget.cpp:439
static std::deque< std::string > call_stack
Definition: function.cpp:39
SDL_Rect calculate_clipping_rectangle(const int x_offset, const int y_offset)
Calculates the clipping rectangle of the widget.
Definition: widget.cpp:360
point get_origin() const
Returns the screen origin of the widget.
Definition: widget.cpp:299
void set_linked_group(const std::string &linked_group)
Definition: widget.cpp:344