The Battle for Wesnoth  1.17.0-dev
widget.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2007 - 2021
3  by Mark de Wever <koraq@xs4all.nl>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #define GETTEXT_DOMAIN "wesnoth-lib"
17 
18 #include "gui/widgets/grid.hpp"
19 #include "gui/widgets/settings.hpp"
20 #include "gui/widgets/window.hpp"
22 #include "gui/core/log.hpp"
24 #include "sdl/rect.hpp"
25 
26 namespace gui2
27 {
28 
29 /***** ***** ***** Constructor and destructor. ***** ***** *****/
30 
32  : enable_lua_ptr<widget>(this)
33  , id_("")
34  , parent_(nullptr)
35  , x_(-1)
36  , y_(-1)
37  , width_(0)
38  , height_(0)
39  , layout_size_()
40 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
41  , last_best_size_()
42 #endif
43  , linked_group_()
44  , is_dirty_(true)
45  , visible_(visibility::visible)
46  , redraw_action_(redraw_action::full)
47  , clipping_rectangle_()
48  , debug_border_mode_(debug_border::none)
49  , debug_border_color_(0,0,0,0)
50 {
51  DBG_GUI_LF << "widget create: " << static_cast<void*>(this) << "\n";
52 }
53 
55  : enable_lua_ptr<widget>(this)
56  , id_(builder.id)
57  , parent_(nullptr)
58  , x_(-1)
59  , y_(-1)
60  , width_(0)
61  , height_(0)
62  , layout_size_()
63 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
64  , last_best_size_()
65 #endif
66  , linked_group_(builder.linked_group)
67  , is_dirty_(true)
68  , visible_(visibility::visible)
71  , debug_border_mode_(builder.debug_border_mode)
72  , debug_border_color_(builder.debug_border_color)
73 {
74  DBG_GUI_LF << "widget create: " << static_cast<void*>(this) << "\n";
75 }
76 
78 {
80  << "widget destroy: " << static_cast<void*>(this) << " (id: " << id_
81  << ")\n";
82 
83  widget* p = parent();
84  while(p) {
85  fire(event::NOTIFY_REMOVAL, *p, nullptr);
86  p = p->parent();
87  }
88 
89  if(!linked_group_.empty()) {
90  if(window* window = get_window()) {
92  }
93  }
94 }
95 
96 /***** ***** ***** ***** ID functions. ***** ***** ***** *****/
97 
98 void widget::set_id(const std::string& id)
99 {
100  styled_widget* this_ctrl = dynamic_cast<styled_widget*>(this);
101 
102  DBG_GUI_LF
103  << "set id of " << static_cast<void*>(this) << " to '" << id << "' "
104  << "(was '" << id_ << "'). Widget type: "
105  << (this_ctrl ? this_ctrl->get_control_type() : typeid(widget).name()) << "\n";
106 
107  id_ = id;
108 }
109 
110 const std::string& widget::id() const
111 {
112  return id_;
113 }
114 
115 /***** ***** ***** ***** Parent functions ***** ***** ***** *****/
116 
118 {
119  // Go up into the parent tree until we find the top level
120  // parent, we can also be the toplevel so start with
121  // ourselves instead of our parent.
122  widget* result = this;
123  while(result->parent_) {
124  result = result->parent_;
125  }
126 
127  // on error dynamic_cast returns nullptr which is what we want.
128  return dynamic_cast<window*>(result);
129 }
130 
132 {
133  // Go up into the parent tree until we find the top level
134  // parent, we can also be the toplevel so start with
135  // ourselves instead of our parent.
136  const widget* result = this;
137  while(result->parent_) {
138  result = result->parent_;
139  }
140 
141  // on error dynamic_cast returns nullptr which is what we want.
142  return dynamic_cast<const window*>(result);
143 }
144 
146 {
147  widget* result = parent_;
148  while(result && dynamic_cast<grid*>(result) == nullptr) {
149  result = result->parent_;
150  }
151 
152  return result ? dynamic_cast<grid*>(result) : nullptr;
153 }
154 
156 {
157  parent_ = parent;
158 }
159 
161 {
162  return parent_;
163 }
164 
165 /***** ***** ***** ***** Size and layout functions. ***** ***** ***** *****/
166 
167 void widget::layout_initialize(const bool /*full_initialization*/)
168 {
169  assert(visible_ != visibility::invisible);
170  assert(get_window());
171 
172  layout_size_ = point();
173  if(!linked_group_.empty()) {
175  }
176 }
177 
178 void widget::demand_reduce_width(const unsigned /*maximum_width*/)
179 {
180  /* DO NOTHING */
181 }
182 
183 void widget::request_reduce_height(const unsigned /*maximum_height*/)
184 {
185  /* DO NOTHING */
186 }
187 
188 void widget::demand_reduce_height(const unsigned /*maximum_height*/)
189 {
190  /* DO NOTHING */
191 }
192 
194 {
195  assert(visible_ != visibility::invisible);
196 
197  point result = layout_size_;
198  if(result == point()) {
199  result = calculate_best_size();
200  //Adjust to linked widget size if linked widget size was already calculated.
201  if(!get_window()->get_need_layout() && !linked_group_.empty())
202  {
203  point linked_size = get_window()->get_linked_size(linked_group_);
204  result.x = std::max(result.x, linked_size.x);
205  result.y = std::max(result.y, linked_size.y);
206  }
207  }
208 
209 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
210  last_best_size_ = result;
211 #endif
212 
213  return result;
214 }
215 
216 bool widget::can_wrap() const
217 {
218  return false;
219 }
220 
221 void widget::set_origin(const point& origin)
222 {
223  x_ = origin.x;
224  y_ = origin.y;
225 }
226 
228 {
229  assert(size.x >= 0);
230  assert(size.y >= 0);
231 
232  width_ = size.x;
233  height_ = size.y;
234 
235  set_is_dirty(true);
236 }
237 
238 void widget::place(const point& origin, const point& size)
239 {
240  assert(size.x >= 0);
241  assert(size.y >= 0);
242 
243  x_ = origin.x;
244  y_ = origin.y;
245  width_ = size.x;
246  height_ = size.y;
247 
248 #if 0
249  std::cerr
250  << "Id " << id()
251  << " rect " << get_rectangle()
252  << " parent "
253  << (parent ? parent->get_x() : 0)
254  << ','
255  << (parent ? parent->get_y() : 0)
256  << " screen origin " << x_ << ',' << y_
257  << ".\n";
258 #endif
259 
260  set_is_dirty(true);
261 }
262 
263 void widget::move(const int x_offset, const int y_offset)
264 {
265  x_ += x_offset;
266  y_ += y_offset;
267 }
268 
269 void widget::set_horizontal_alignment(const std::string& alignment)
270 {
271  grid* parent_grid = get_parent_grid();
272  if(!parent_grid) {
273  return;
274  }
275 
277 
278  // TODO: evaluate necessity
279  //get_window()->invalidate_layout();
280 }
281 
282 void widget::set_vertical_alignment(const std::string& alignment)
283 {
284  grid* parent_grid = get_parent_grid();
285  if(!parent_grid) {
286  return;
287  }
288 
290 
291  // TODO: evaluate necessity
292  //get_window()->invalidate_layout();
293 }
294 
296 {
297  /* DO NOTHING */
298 }
299 
301 {
302  return point(x_, y_);
303 }
304 
306 {
307  return point(width_, height_);
308 }
309 
310 SDL_Rect widget::get_rectangle() const
311 {
312  return create_rect(get_origin(), get_size());
313 }
314 
315 int widget::get_x() const
316 {
317  return x_;
318 }
319 
320 int widget::get_y() const
321 {
322  return y_;
323 }
324 
325 unsigned widget::get_width() const
326 {
327  return width_;
328 }
329 
330 unsigned widget::get_height() const
331 {
332  return height_;
333 }
334 
336 {
337  layout_size_ = size;
338 }
339 
341 {
342  return layout_size_;
343 }
344 
345 void widget::set_linked_group(const std::string& linked_group)
346 {
347  linked_group_ = linked_group;
348 }
349 
350 /***** ***** ***** ***** Drawing functions. ***** ***** ***** *****/
351 
352 SDL_Rect widget::calculate_blitting_rectangle(const int x_offset,
353  const int y_offset)
354 {
355  SDL_Rect result = get_rectangle();
356  result.x += x_offset;
357  result.y += y_offset;
358  return result;
359 }
360 
361 SDL_Rect widget::calculate_clipping_rectangle(const int x_offset,
362  const int y_offset)
363 {
364  SDL_Rect result = clipping_rectangle_;
365  result.x += x_offset;
366  result.y += y_offset;
367  return result;
368 }
369 
370 void widget::draw_background(surface& frame_buffer, int x_offset, int y_offset)
371 {
372  assert(visible_ == visibility::visible);
373 
375  const SDL_Rect clipping_rectangle
376  = calculate_clipping_rectangle(x_offset, y_offset);
377 
378  clip_rect_setter clip(frame_buffer, &clipping_rectangle);
379  draw_debug_border(x_offset, y_offset);
380  impl_draw_background(frame_buffer, x_offset, y_offset);
381  } else {
382  draw_debug_border(x_offset, y_offset);
383  impl_draw_background(frame_buffer, x_offset, y_offset);
384  }
385 }
386 
387 void widget::draw_children(surface& frame_buffer, int x_offset, int y_offset)
388 {
389  assert(visible_ == visibility::visible);
390 
392  const SDL_Rect clipping_rectangle
393  = calculate_clipping_rectangle(x_offset, y_offset);
394 
395  clip_rect_setter clip(frame_buffer, &clipping_rectangle);
396  impl_draw_children(frame_buffer, x_offset, y_offset);
397  } else {
398  impl_draw_children(frame_buffer, x_offset, y_offset);
399  }
400 }
401 
402 void widget::draw_foreground(surface& frame_buffer, int x_offset, int y_offset)
403 {
404  assert(visible_ == visibility::visible);
405 
407  const SDL_Rect clipping_rectangle
408  = calculate_clipping_rectangle(x_offset, y_offset);
409 
410  clip_rect_setter clip(frame_buffer, &clipping_rectangle);
411  impl_draw_foreground(frame_buffer, x_offset, y_offset);
412  } else {
413  impl_draw_foreground(frame_buffer, x_offset, y_offset);
414  }
415 }
416 
418  std::vector<widget*>& call_stack)
419 {
420  assert(call_stack.empty() || call_stack.back() != this);
421 
423  return;
424  }
425 
427  return;
428  }
429 
430  call_stack.push_back(this);
431  if(is_dirty_) {
432  caller.add_to_dirty_list(call_stack);
433  } else {
434  // virtual function which only does something for container items.
435  child_populate_dirty_list(caller, call_stack);
436  }
437 }
438 
439 void
441  ,
442  const std::vector<widget*>& /*call_stack*/)
443 {
444  /* DO NOTHING */
445 }
446 
448 {
451 }
452 
453 void widget::set_visible_rectangle(const SDL_Rect& rectangle)
454 {
456 
459  } else if(clipping_rectangle_ == sdl::empty_rect) {
461  } else {
463  }
464 }
465 
466 void widget::set_is_dirty(const bool is_dirty)
467 {
468  is_dirty_ = is_dirty;
469 }
470 
472 {
473  return is_dirty_;
474 }
475 
476 void widget::set_visible(const visibility visible)
477 {
478  if(visible == visible_) {
479  return;
480  }
481 
482  // Switching to or from invisible should invalidate the layout
483  // if the widget has already been laid out.
484  const bool need_resize = visible_ == visibility::invisible
485  || (visible == visibility::invisible && get_size() != point());
486  visible_ = visible;
487 
488  if(need_resize) {
489  if(visible == visibility::visible && new_widgets) {
491  fire(event::REQUEST_PLACEMENT, *this, message);
492  } else {
493  window* window = get_window();
494  if(window) {
495  window->invalidate_layout();
496  }
497  }
498  } else {
499  set_is_dirty(true);
500  }
501 }
502 
504 {
505  return visible_;
506 }
507 
509 {
510  return (width_ == 0 || height_ == 0) ? redraw_action::none
511  : redraw_action_;
512 }
513 
514 void widget::set_debug_border_mode(const debug_border debug_border_mode)
515 {
516  debug_border_mode_ = debug_border_mode;
517 }
518 
519 void widget::set_debug_border_color(const color_t debug_border_color)
520 {
521  debug_border_color_ = debug_border_color;
522 }
523 
525 {
527  : get_rectangle();
528 
529  switch(debug_border_mode_) {
530  case debug_border::none:
531  /* DO NOTHING */
532  break;
535  break;
536 
537  case debug_border::fill:
539  break;
540 
541  default:
542  assert(false);
543  }
544 }
545 
546 void
547 widget::draw_debug_border(int x_offset, int y_offset)
548 {
549  SDL_Rect r = redraw_action_ == redraw_action::partly
550  ? calculate_clipping_rectangle(x_offset, y_offset)
551  : calculate_blitting_rectangle(x_offset, y_offset);
552 
553  switch(debug_border_mode_) {
554  case debug_border::none:
555  /* DO NOTHING */
556  break;
557 
560  break;
561 
562  case debug_border::fill:
564  break;
565 
566  default:
567  assert(false);
568  }
569 }
570 
571 /***** ***** ***** ***** Query functions ***** ***** ***** *****/
572 
573 widget* widget::find_at(const point& coordinate, const bool must_be_active)
574 {
575  return is_at(coordinate, must_be_active) ? this : nullptr;
576 }
577 
579  const bool must_be_active) const
580 {
581  return is_at(coordinate, must_be_active) ? this : nullptr;
582 }
583 
584 widget* widget::find(const std::string& id, const bool /*must_be_active*/)
585 {
586  return id_ == id ? this : nullptr;
587 }
588 
589 const widget* widget::find(const std::string& id,
590  const bool /*must_be_active*/) const
591 {
592  return id_ == id ? this : nullptr;
593 }
594 
595 bool widget::has_widget(const widget& widget) const
596 {
597  return &widget == this;
598 }
599 
600 bool widget::is_at(const point& coordinate) const
601 {
602  return is_at(coordinate, true);
603 }
604 
605 bool widget::recursive_is_visible(const widget* widget, const bool must_be_active) const
606 {
607  while(widget) {
608  if(widget->visible_ == visibility::invisible
609  || (widget->visible_ == visibility::hidden && must_be_active)) {
610  return false;
611  }
612 
613  widget = widget->parent_;
614  }
615 
616  return true;
617 }
618 
619 bool widget::is_at(const point& coordinate, const bool must_be_active) const
620 {
621  if(!recursive_is_visible(this, must_be_active)) {
622  return false;
623  }
624 
625  return sdl::point_in_rect(coordinate, get_rectangle());
626 }
627 
628 } // namespace gui2
Define the common log macros for the gui toolkit.
void set_debug_border_mode(const debug_border debug_border_mode)
Definition: widget.cpp:514
#define DBG_GUI_LF
Definition: log.hpp:62
Contains the info needed to instantiate a widget.
bool new_widgets
Do we wish to use the new library or not.
Definition: settings.cpp:25
grid * get_parent_grid()
Get the parent grid.
Definition: widget.cpp:145
int get_x() const
Definition: widget.cpp:315
SDL_Rect create_rect(const point &origin, const point &size)
Creates a rectangle.
Definition: helper.cpp:33
void set_parent(widget *parent)
Definition: widget.cpp:155
virtual bool is_at(const point &coordinate) const override
See event::dispatcher::is_at.
Definition: widget.cpp:600
virtual void layout_initialize(const bool full_initialization)
How the layout engine works.
Definition: widget.cpp:167
void set_layout_size(const point &size)
Definition: widget.cpp:335
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:352
virtual widget * find(const std::string &id, const bool must_be_active)
Returns a widget with the wanted id.
Definition: widget.cpp:584
virtual void impl_draw_foreground(surface &, int, int)
See draw_foreground.
Definition: widget.hpp:619
visibility get_visible() const
Definition: widget.cpp:503
Main class to show messages to the user.
Definition: message.hpp:35
widget * parent_
The parent widget.
Definition: widget.hpp:217
const std::string & id() const
Definition: widget.cpp:110
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:478
redraw_action get_drawing_action() const
Definition: widget.cpp:508
SDL_Rect get_rectangle() const
Gets the bounding rectangle of the widget on the screen.
Definition: widget.cpp:310
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:453
unsigned get_height() const
Definition: widget.cpp:330
redraw_action redraw_action_
Field for the action to do on a drawing request.
Definition: widget.hpp:714
SDL_Rect intersect_rects(const SDL_Rect &rect1, const SDL_Rect &rect2)
Calculates the intersection of two rectangles.
Definition: rect.cpp:40
static const unsigned HORIZONTAL_MASK
Definition: grid.hpp:60
virtual void request_reduce_height(const unsigned maximum_height)
Tries to reduce the height of a widget.
Definition: widget.cpp:183
virtual ~widget() override
Definition: widget.cpp:77
void draw_debug_border()
Definition: widget.cpp:524
virtual void demand_reduce_width(const unsigned maximum_width)
Tries to reduce the width of a widget.
Definition: widget.cpp:178
Flood-filled rectangle.
std::string id_
The id is the unique name of the widget in a certain context.
Definition: widget.hpp:178
unsigned get_width() const
Definition: widget.cpp:325
visibility visible_
Field for the status of the visibility.
Definition: widget.hpp:711
virtual void set_horizontal_alignment(const std::string &alignment)
Sets the horizontal alignment of the widget within its parent grid.
Definition: widget.cpp:269
int x
x coordinate.
Definition: point.hpp:45
Generic file dialog.
Definition: field-fwd.hpp:23
point get_linked_size(const std::string &linked_group_id) const
Definition: window.hpp:390
The message callbacks hold a reference to a message.
Definition: message.hpp:45
Base container class.
Definition: grid.hpp:31
virtual void impl_draw_background(surface &)
See draw_background.
Definition: widget.hpp:598
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:417
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
Definition: unicode.cpp:87
Request to place the widget.
Definition: handler.hpp:95
SDL_Rect get_dirty_rectangle() const
Gets the dirty rectangle of the widget.
Definition: widget.cpp:447
point get_best_size() const
Gets the best size for the widget.
Definition: widget.cpp:193
virtual void demand_reduce_height(const unsigned maximum_height)
Tries to reduce the height of a widget.
Definition: widget.cpp:188
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:238
The widget is fully visible.
void set_visible(const visibility visible)
Definition: widget.cpp:476
void set_is_dirty(const bool is_dirty)
Definition: widget.cpp:466
virtual void set_origin(const point &origin)
Sets the origin of the widget.
Definition: widget.cpp:221
Sent by a widget to notify others it&#39;s being destroyed.
Definition: handler.hpp:88
void draw_rectangle(const SDL_Rect &rect, const color_t &color)
Draw a rectangle outline.
Definition: rect.cpp:58
widget * parent()
Definition: widget.cpp:160
The widget is not visible.
virtual point calculate_best_size() const =0
Calculates the best size.
static thread_local std::deque< std::string > call_stack
For printing error messages when WFL parsing or evaluation fails, this contains the names of the WFL ...
Definition: function.cpp:47
virtual bool has_widget(const widget &widget) const
Does the widget contain the widget.
Definition: widget.cpp:595
This file contains the definitions for the gui2::event::message class.
point layout_size_
The best size for the widget.
Definition: widget.hpp:490
void draw_background(surface &frame_buffer, int x_offset, int y_offset)
Draws the background of a widget.
Definition: widget.cpp:370
std::string linked_group_
The linked group the widget belongs to.
Definition: widget.hpp:514
int y_
The y-coordinate of the widget on the screen.
Definition: widget.hpp:472
virtual void impl_draw_children(surface &, int, int)
See draw_children.
Definition: widget.hpp:610
int get_y() const
Definition: widget.cpp:320
bool point_in_rect(int x, int y, const SDL_Rect &rect)
Tests whether a point is inside a rectangle.
Definition: rect.cpp:23
void add_linked_widget(const std::string &id, widget *widget)
Adds a widget to a linked size group.
Definition: window.cpp:842
void add_to_dirty_list(const std::vector< widget *> &call_stack)
Adds an item to the dirty_list_.
Definition: window.hpp:163
mock_party p
debug_border debug_border_mode_
Mode for drawing the debug border.
Definition: widget.hpp:725
The user set the widget invisible, that means:
color_t debug_border_color_
The color for the debug border.
Definition: widget.hpp:728
window * get_window()
Get the parent window.
Definition: widget.cpp:117
visibility
Visibility settings done by the user.
Definition: widget.hpp:59
Holds a 2D point.
Definition: point.hpp:24
static const unsigned VERTICAL_MASK
Definition: grid.hpp:53
virtual void layout_children()
Allows a widget to update its children.
Definition: widget.cpp:295
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:605
bool get_is_dirty() const
Definition: widget.cpp:471
unsigned get_v_align(const std::string &v_align)
Returns the vertical alignment.
Definition: helper.cpp:38
point get_size() const
Returns the size of the widget.
Definition: widget.cpp:305
SDL_Rect clipping_rectangle_
The clipping rectangle if a widget is partly visible.
Definition: widget.hpp:717
unsigned width_
The width of the widget.
Definition: widget.hpp:475
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:944
constexpr const SDL_Rect empty_rect
Definition: rect.hpp:32
virtual void move(const int x_offset, const int y_offset)
Moves a widget.
Definition: widget.cpp:263
void set_id(const std::string &id)
Definition: widget.cpp:98
void set_debug_border_color(const color_t debug_border_color)
Definition: widget.cpp:519
void fill_rectangle(const SDL_Rect &rect, const color_t &color)
Draws a filled rectangle.
Definition: rect.cpp:66
void draw_foreground(surface &frame_buffer, int x_offset, int y_offset)
Draws the foreground of the widget.
Definition: widget.cpp:402
bool fire(const ui_event event, widget &target)
Fires an event which has no extra parameters.
Definition: dispatcher.cpp:69
virtual void set_size(const point &size)
Sets the size of the widget.
Definition: widget.cpp:227
const point & layout_size() const
Definition: widget.cpp:340
void invalidate_layout()
Updates the size of the window.
Definition: window.cpp:799
virtual void set_vertical_alignment(const std::string &alignment)
Sets the horizontal alignment of the widget within its parent grid.
Definition: widget.cpp:282
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:708
virtual widget * find_at(const point &coordinate, const bool must_be_active)
Returns the widget at the wanted coordinates.
Definition: widget.cpp:573
void draw_children(surface &frame_buffer, int x_offset, int y_offset)
Draws the children of a widget.
Definition: widget.cpp:387
void remove_linked_widget(const std::string &id, const widget *widget)
Removes a widget from a linked size group.
Definition: window.cpp:856
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:216
unsigned get_h_align(const std::string &h_align)
Returns the horizontal alignment.
Definition: helper.cpp:53
The widget is partly visible.
int y
y coordinate.
Definition: point.hpp:48
base class of top level items, the only item which needs to store the final canvases to draw on...
Definition: window.hpp:65
int x_
The x-coordinate of the widget on the screen.
Definition: widget.hpp:469
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:440
SDL_Rect calculate_clipping_rectangle(const int x_offset, const int y_offset)
Calculates the clipping rectangle of the widget.
Definition: widget.cpp:361
point get_origin() const
Returns the screen origin of the widget.
Definition: widget.cpp:300
void set_linked_group(const std::string &linked_group)
Definition: widget.cpp:345