The Battle for Wesnoth  1.15.0-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  : id_("")
32  , parent_(nullptr)
33  , x_(-1)
34  , y_(-1)
35  , width_(0)
36  , height_(0)
37  , layout_size_()
38 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
39  , last_best_size_()
40 #endif
41  , linked_group_()
42  , is_dirty_(true)
43  , visible_(visibility::visible)
44  , redraw_action_(redraw_action::full)
45  , clipping_rectangle_()
46  , debug_border_mode_(0)
47  , debug_border_color_(0,0,0,0)
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_()
60 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
61  , last_best_size_()
62 #endif
63  , linked_group_(builder.linked_group)
64  , is_dirty_(true)
65  , visible_(visibility::visible)
68  , debug_border_mode_(builder.debug_border_mode)
69  , debug_border_color_(builder.debug_border_color)
70 {
71  DBG_GUI_LF << "widget create: " << static_cast<void*>(this) << "\n";
72 }
73 
75 {
77  << "widget destroy: " << static_cast<void*>(this) << " (id: " << id_
78  << ")\n";
79 
80  widget* p = parent();
81  while(p) {
82  fire(event::NOTIFY_REMOVAL, *p, nullptr);
83  p = p->parent();
84  }
85 
86  if(!linked_group_.empty()) {
87  if(window* window = get_window()) {
89  }
90  }
91 }
92 
93 /***** ***** ***** ***** ID functions. ***** ***** ***** *****/
94 
95 void widget::set_id(const std::string& id)
96 {
97  styled_widget* this_ctrl = dynamic_cast<styled_widget*>(this);
98 
100  << "set id of " << static_cast<void*>(this) << " to '" << id << "' "
101  << "(was '" << id_ << "'). Widget type: "
102  << (this_ctrl ? this_ctrl->get_control_type() : typeid(widget).name()) << "\n";
103 
104  id_ = id;
105 }
106 
107 const std::string& widget::id() const
108 {
109  return id_;
110 }
111 
112 /***** ***** ***** ***** Parent functions ***** ***** ***** *****/
113 
115 {
116  // Go up into the parent tree until we find the top level
117  // parent, we can also be the toplevel so start with
118  // ourselves instead of our parent.
119  widget* result = this;
120  while(result->parent_) {
121  result = result->parent_;
122  }
123 
124  // on error dynamic_cast returns nullptr which is what we want.
125  return dynamic_cast<window*>(result);
126 }
127 
129 {
130  // Go up into the parent tree until we find the top level
131  // parent, we can also be the toplevel so start with
132  // ourselves instead of our parent.
133  const widget* result = this;
134  while(result->parent_) {
135  result = result->parent_;
136  }
137 
138  // on error dynamic_cast returns nullptr which is what we want.
139  return dynamic_cast<const window*>(result);
140 }
141 
143 {
144  widget* result = parent_;
145  while(result && dynamic_cast<grid*>(result) == nullptr) {
146  result = result->parent_;
147  }
148 
149  return result ? dynamic_cast<grid*>(result) : nullptr;
150 }
151 
153 {
154  parent_ = parent;
155 }
156 
158 {
159  return parent_;
160 }
161 
162 /***** ***** ***** ***** Size and layout functions. ***** ***** ***** *****/
163 
164 void widget::layout_initialize(const bool /*full_initialization*/)
165 {
166  assert(visible_ != visibility::invisible);
167  assert(get_window());
168 
169  layout_size_ = point();
170  if(!linked_group_.empty()) {
172  }
173 }
174 
175 void widget::demand_reduce_width(const unsigned /*maximum_width*/)
176 {
177  /* DO NOTHING */
178 }
179 
180 void widget::request_reduce_height(const unsigned /*maximum_height*/)
181 {
182  /* DO NOTHING */
183 }
184 
185 void widget::demand_reduce_height(const unsigned /*maximum_height*/)
186 {
187  /* DO NOTHING */
188 }
189 
191 {
192  assert(visible_ != visibility::invisible);
193 
194  point result = layout_size_;
195  if(result == point()) {
196  result = calculate_best_size();
197  //Adjust to linked widget size if linked widget size was already calculated.
198  if(!get_window()->get_need_layout() && !linked_group_.empty())
199  {
200  point linked_size = get_window()->get_linked_size(linked_group_);
201  result.x = std::max(result.x, linked_size.x);
202  result.y = std::max(result.y, linked_size.y);
203  }
204  }
205 
206 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
207  last_best_size_ = result;
208 #endif
209 
210  return result;
211 }
212 
213 bool widget::can_wrap() const
214 {
215  return false;
216 }
217 
218 void widget::set_origin(const point& origin)
219 {
220  x_ = origin.x;
221  y_ = origin.y;
222 }
223 
225 {
226  assert(size.x >= 0);
227  assert(size.y >= 0);
228 
229  width_ = size.x;
230  height_ = size.y;
231 
232  set_is_dirty(true);
233 }
234 
235 void widget::place(const point& origin, const point& size)
236 {
237  assert(size.x >= 0);
238  assert(size.y >= 0);
239 
240  x_ = origin.x;
241  y_ = origin.y;
242  width_ = size.x;
243  height_ = size.y;
244 
245 #if 0
246  std::cerr
247  << "Id " << id()
248  << " rect " << get_rectangle()
249  << " parent "
250  << (parent ? parent->get_x() : 0)
251  << ','
252  << (parent ? parent->get_y() : 0)
253  << " screen origin " << x_ << ',' << y_
254  << ".\n";
255 #endif
256 
257  set_is_dirty(true);
258 }
259 
260 void widget::move(const int x_offset, const int y_offset)
261 {
262  x_ += x_offset;
263  y_ += y_offset;
264 }
265 
266 void widget::set_horizontal_alignment(const std::string& alignment)
267 {
268  grid* parent_grid = get_parent_grid();
269  if(!parent_grid) {
270  return;
271  }
272 
274 
275  // TODO: evaluate necessity
276  //get_window()->invalidate_layout();
277 }
278 
279 void widget::set_vertical_alignment(const std::string& alignment)
280 {
281  grid* parent_grid = get_parent_grid();
282  if(!parent_grid) {
283  return;
284  }
285 
287 
288  // TODO: evaluate necessity
289  //get_window()->invalidate_layout();
290 }
291 
293 {
294  /* DO NOTHING */
295 }
296 
298 {
299  return point(x_, y_);
300 }
301 
303 {
304  return point(width_, height_);
305 }
306 
307 SDL_Rect widget::get_rectangle() const
308 {
309  return create_rect(get_origin(), get_size());
310 }
311 
312 int widget::get_x() const
313 {
314  return x_;
315 }
316 
317 int widget::get_y() const
318 {
319  return y_;
320 }
321 
322 unsigned widget::get_width() const
323 {
324  return width_;
325 }
326 
327 unsigned widget::get_height() const
328 {
329  return height_;
330 }
331 
333 {
334  layout_size_ = size;
335 }
336 
338 {
339  return layout_size_;
340 }
341 
342 void widget::set_linked_group(const std::string& linked_group)
343 {
344  linked_group_ = linked_group;
345 }
346 
347 /***** ***** ***** ***** Drawing functions. ***** ***** ***** *****/
348 
349 SDL_Rect widget::calculate_blitting_rectangle(const int x_offset,
350  const int y_offset)
351 {
352  SDL_Rect result = get_rectangle();
353  result.x += x_offset;
354  result.y += y_offset;
355  return result;
356 }
357 
358 SDL_Rect widget::calculate_clipping_rectangle(const int x_offset,
359  const int y_offset)
360 {
361  SDL_Rect result = clipping_rectangle_;
362  result.x += x_offset;
363  result.y += y_offset;
364  return result;
365 }
366 
367 void widget::draw_background(surface& frame_buffer, int x_offset, int y_offset)
368 {
369  assert(visible_ == visibility::visible);
370 
372  const SDL_Rect clipping_rectangle
373  = calculate_clipping_rectangle(x_offset, y_offset);
374 
375  clip_rect_setter clip(frame_buffer, &clipping_rectangle);
376  draw_debug_border(x_offset, y_offset);
377  impl_draw_background(frame_buffer, x_offset, y_offset);
378  } else {
379  draw_debug_border(x_offset, y_offset);
380  impl_draw_background(frame_buffer, x_offset, y_offset);
381  }
382 }
383 
384 void widget::draw_children(surface& frame_buffer, int x_offset, int y_offset)
385 {
386  assert(visible_ == visibility::visible);
387 
389  const SDL_Rect clipping_rectangle
390  = calculate_clipping_rectangle(x_offset, y_offset);
391 
392  clip_rect_setter clip(frame_buffer, &clipping_rectangle);
393  impl_draw_children(frame_buffer, x_offset, y_offset);
394  } else {
395  impl_draw_children(frame_buffer, x_offset, y_offset);
396  }
397 }
398 
399 void widget::draw_foreground(surface& frame_buffer, int x_offset, int y_offset)
400 {
401  assert(visible_ == visibility::visible);
402 
404  const SDL_Rect clipping_rectangle
405  = calculate_clipping_rectangle(x_offset, y_offset);
406 
407  clip_rect_setter clip(frame_buffer, &clipping_rectangle);
408  impl_draw_foreground(frame_buffer, x_offset, y_offset);
409  } else {
410  impl_draw_foreground(frame_buffer, x_offset, y_offset);
411  }
412 }
413 
415  std::vector<widget*>& call_stack)
416 {
417  assert(call_stack.empty() || call_stack.back() != this);
418 
420  return;
421  }
422 
424  return;
425  }
426 
427  call_stack.push_back(this);
428  if(is_dirty_) {
429  caller.add_to_dirty_list(call_stack);
430  } else {
431  // virtual function which only does something for container items.
432  child_populate_dirty_list(caller, call_stack);
433  }
434 }
435 
436 void
438  ,
439  const std::vector<widget*>& /*call_stack*/)
440 {
441  /* DO NOTHING */
442 }
443 
445 {
448 }
449 
450 void widget::set_visible_rectangle(const SDL_Rect& rectangle)
451 {
453 
456  } else if(clipping_rectangle_ == sdl::empty_rect) {
458  } else {
460  }
461 }
462 
463 void widget::set_is_dirty(const bool is_dirty)
464 {
465  is_dirty_ = is_dirty;
466 }
467 
469 {
470  return is_dirty_;
471 }
472 
473 void widget::set_visible(const visibility visible)
474 {
475  if(visible == visible_) {
476  return;
477  }
478 
479  // Switching to or from invisible should invalidate the layout
480  // if the widget has already been laid out.
481  const bool need_resize = visible_ == visibility::invisible
482  || (visible == visibility::invisible && get_size() != point());
483  visible_ = visible;
484 
485  if(need_resize) {
486  if(visible == visibility::visible && new_widgets) {
488  fire(event::REQUEST_PLACEMENT, *this, message);
489  } else {
490  window* window = get_window();
491  if(window) {
492  window->invalidate_layout();
493  }
494  }
495  } else {
496  set_is_dirty(true);
497  }
498 }
499 
501 {
502  return visible_;
503 }
504 
506 {
507  return (width_ == 0 || height_ == 0) ? redraw_action::none
508  : redraw_action_;
509 }
510 
511 void widget::set_debug_border_mode(const unsigned debug_border_mode)
512 {
513  debug_border_mode_ = debug_border_mode;
514 }
515 
516 void widget::set_debug_border_color(const color_t debug_border_color)
517 {
518  debug_border_color_ = debug_border_color;
519 }
520 
522 {
524  : get_rectangle();
525 
526  switch(debug_border_mode_) {
527  case 0:
528  /* DO NOTHING */
529  break;
530  case 1:
532  break;
533 
534  case 2:
536  break;
537 
538  default:
539  assert(false);
540  }
541 }
542 
543 void
544 widget::draw_debug_border(int x_offset, int y_offset)
545 {
546  SDL_Rect r = redraw_action_ == redraw_action::partly
547  ? calculate_clipping_rectangle(x_offset, y_offset)
548  : calculate_blitting_rectangle(x_offset, y_offset);
549 
550  switch(debug_border_mode_) {
551  case 0:
552  /* DO NOTHING */
553  break;
554 
555  case 1:
557  break;
558 
559  case 2:
561  break;
562 
563  default:
564  assert(false);
565  }
566 }
567 
568 /***** ***** ***** ***** Query functions ***** ***** ***** *****/
569 
570 widget* widget::find_at(const point& coordinate, const bool must_be_active)
571 {
572  return is_at(coordinate, must_be_active) ? this : nullptr;
573 }
574 
576  const bool must_be_active) const
577 {
578  return is_at(coordinate, must_be_active) ? this : nullptr;
579 }
580 
581 widget* widget::find(const std::string& id, const bool /*must_be_active*/)
582 {
583  return id_ == id ? this : nullptr;
584 }
585 
586 const widget* widget::find(const std::string& id,
587  const bool /*must_be_active*/) const
588 {
589  return id_ == id ? this : nullptr;
590 }
591 
592 bool widget::has_widget(const widget& widget) const
593 {
594  return &widget == this;
595 }
596 
597 bool widget::is_at(const point& coordinate) const
598 {
599  return is_at(coordinate, true);
600 }
601 
602 bool widget::recursive_is_visible(const widget* widget, const bool must_be_active) const
603 {
604  while(widget) {
605  if(widget->visible_ == visibility::invisible
606  || (widget->visible_ == visibility::hidden && must_be_active)) {
607  return false;
608  }
609 
610  widget = widget->parent_;
611  }
612 
613  return true;
614 }
615 
616 bool widget::is_at(const point& coordinate, const bool must_be_active) const
617 {
618  if(!recursive_is_visible(this, must_be_active)) {
619  return false;
620  }
621 
622  return sdl::point_in_rect(coordinate, get_rectangle());
623 }
624 
625 } // 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:21
grid * get_parent_grid()
Get the parent grid.
Definition: widget.cpp:142
int get_x() const
Definition: widget.cpp:312
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:152
virtual bool is_at(const point &coordinate) const override
See event::dispatcher::is_at.
Definition: widget.cpp:597
void set_debug_border_mode(const unsigned debug_border_mode)
Definition: widget.cpp:511
virtual void layout_initialize(const bool full_initialization)
How the layout engine works.
Definition: widget.cpp:164
void set_layout_size(const point &size)
Definition: widget.cpp:332
redraw_action
Visibility set by the engine.
Definition: widget.hpp:102
SDL_Rect calculate_blitting_rectangle(const int x_offset, const int y_offset)
Calculates the blitting rectangle of the widget.
Definition: widget.cpp:349
virtual widget * find(const std::string &id, const bool must_be_active)
Returns a widget with the wanted id.
Definition: widget.cpp:581
virtual void impl_draw_foreground(surface &, int, int)
See draw_foreground.
Definition: widget.hpp:611
visibility get_visible() const
Definition: widget.cpp:500
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:722
widget * parent_
The parent widget.
Definition: widget.hpp:207
const std::string & id() const
Definition: widget.cpp:107
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:470
redraw_action get_drawing_action() const
Definition: widget.cpp:505
SDL_Rect get_rectangle() const
Gets the bounding rectangle of the widget on the screen.
Definition: widget.cpp:307
Base class for all widgets.
Definition: widget.hpp:47
virtual void set_visible_rectangle(const SDL_Rect &rectangle)
Sets the visible rectangle for a widget.
Definition: widget.cpp:450
unsigned get_height() const
Definition: widget.cpp:327
redraw_action redraw_action_
Field for the action to do on a drawing request.
Definition: widget.hpp:706
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:180
virtual ~widget() override
Definition: widget.cpp:74
void draw_debug_border()
Definition: widget.cpp:521
virtual void demand_reduce_width(const unsigned maximum_width)
Tries to reduce the width of a widget.
Definition: widget.cpp:175
std::string id_
The id is the unique name of the widget in a certain context.
Definition: widget.hpp:168
unsigned get_width() const
Definition: widget.cpp:322
visibility visible_
Field for the status of the visibility.
Definition: widget.hpp:703
virtual void set_horizontal_alignment(const std::string &alignment)
Sets the horizontal alignment of the widget within its parent grid.
Definition: widget.cpp:266
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:396
The message callbacks hold a reference to a message.
Definition: message.hpp:46
static const char * name(const std::vector< SDL_Joystick *> &joysticks, const std::size_t index)
Definition: joystick.cpp:48
Base container class.
Definition: grid.hpp:30
virtual void impl_draw_background(surface &)
See draw_background.
Definition: widget.hpp:590
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:414
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
Definition: unicode.cpp:86
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:444
point get_best_size() const
Gets the best size for the widget.
Definition: widget.cpp:190
virtual void demand_reduce_height(const unsigned maximum_height)
Tries to reduce the height of a widget.
Definition: widget.cpp:185
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:235
The widget is fully visible.
void set_visible(const visibility visible)
Definition: widget.cpp:473
void set_is_dirty(const bool is_dirty)
Definition: widget.cpp:463
virtual void set_origin(const point &origin)
Sets the origin of the widget.
Definition: widget.cpp:218
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:157
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:592
This file contains the definitions for the gui2::event::message class.
point layout_size_
The best size for the widget.
Definition: widget.hpp:482
void draw_background(surface &frame_buffer, int x_offset, int y_offset)
Draws the background of a widget.
Definition: widget.cpp:367
std::string linked_group_
The linked group the widget belongs to.
Definition: widget.hpp:506
int y_
The y-coordinate of the widget on the screen.
Definition: widget.hpp:464
virtual void impl_draw_children(surface &, int, int)
See draw_children.
Definition: widget.hpp:602
int get_y() const
Definition: widget.cpp:317
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:849
void add_to_dirty_list(const std::vector< widget *> &call_stack)
Adds an item to the dirty_list_.
Definition: window.hpp:161
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:725
window * get_window()
Get the parent window.
Definition: widget.cpp:114
visibility
Visibility settings done by the user.
Definition: widget.hpp:57
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:292
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:602
bool get_is_dirty() const
Definition: widget.cpp:468
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:302
SDL_Rect clipping_rectangle_
The clipping rectangle if a widget is partly visible.
Definition: widget.hpp:709
unsigned width_
The width of the widget.
Definition: widget.hpp:467
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:260
void set_id(const std::string &id)
Definition: widget.cpp:95
void set_debug_border_color(const color_t debug_border_color)
Definition: widget.cpp:516
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:399
bool fire(const ui_event event, widget &target)
Fires an event which has no extra parameters.
Definition: dispatcher.cpp:120
virtual void set_size(const point &size)
Sets the size of the widget.
Definition: widget.cpp:224
const point & layout_size() const
Definition: widget.cpp:337
void invalidate_layout()
Updates the size of the window.
Definition: window.cpp:806
virtual void set_vertical_alignment(const std::string &alignment)
Sets the horizontal alignment of the widget within its parent grid.
Definition: widget.cpp:279
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:700
virtual widget * find_at(const point &coordinate, const bool must_be_active)
Returns the widget at the wanted coordinates.
Definition: widget.cpp:570
void draw_children(surface &frame_buffer, int x_offset, int y_offset)
Draws the children of a widget.
Definition: widget.cpp:384
void remove_linked_widget(const std::string &id, const widget *widget)
Removes a widget from a linked size group.
Definition: window.cpp:863
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:213
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:63
int x_
The x-coordinate of the widget on the screen.
Definition: widget.hpp:461
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:437
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:358
point get_origin() const
Returns the screen origin of the widget.
Definition: widget.cpp:297
void set_linked_group(const std::string &linked_group)
Definition: widget.cpp:342