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:
Mark de Wever 2012-04-28 19:16:13 +00:00
parent 8f945cf235
commit af00fd0f2f
2 changed files with 20 additions and 0 deletions

View File

@ -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

View File

@ -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_; }