mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-07 21:35:37 +00:00
Add a move function for widgets.
The code is used to experiment with a different approach of the implementation of a listbox.
This commit is contained in:
parent
8f945cf235
commit
af00fd0f2f
@ -156,6 +156,12 @@ SDL_Rect twidget::get_dirty_rect() const
|
||||
: clip_rect_;
|
||||
}
|
||||
|
||||
void twidget::move(const int x_offset, const int y_offset)
|
||||
{
|
||||
x_ += x_offset;
|
||||
y_ += y_offset;
|
||||
}
|
||||
|
||||
twindow* twidget::get_window()
|
||||
{
|
||||
// Go up into the parent tree until we find the top level
|
||||
|
@ -409,6 +409,20 @@ public:
|
||||
y_ = origin.y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves a widget.
|
||||
*
|
||||
* This function can be used to move the widget without dirtying it.
|
||||
*
|
||||
* @todo Implement the function to all inherited classes.
|
||||
*
|
||||
* @param x_offset The amount of pixels to move the widget in
|
||||
* the x direction.
|
||||
* @param y_offset The amount of pixels to move the widget in
|
||||
* the y direction.
|
||||
*/
|
||||
virtual void move(const int x_offset, const int y_offset);
|
||||
|
||||
int get_x() const { return x_; }
|
||||
|
||||
int get_y() const { return y_; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user