add resize_fixed() function for widgets
This commit is contained in:
parent
88849ea766
commit
0b4b3b1332
2 changed files with 18 additions and 0 deletions
|
@ -41,6 +41,23 @@ bool Widget::resize(double width, double height) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Widget::resize_fixed(double width, double height) {
|
||||||
|
if (m_rect.width() == width && m_rect.height() == height)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (width < 0 || height < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
m_rect.set_max_width(width);
|
||||||
|
m_rect.set_max_height(height);
|
||||||
|
m_rect.set_min_width(width);
|
||||||
|
m_rect.set_min_height(height);
|
||||||
|
m_rect.set_width(width);
|
||||||
|
m_rect.set_height(height);
|
||||||
|
reflow();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void Widget::move_to(double x, double y) {
|
void Widget::move_to(double x, double y) {
|
||||||
if (m_rect.x() == x && m_rect.y() == y)
|
if (m_rect.x() == x && m_rect.y() == y)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -48,6 +48,7 @@ public:
|
||||||
|
|
||||||
void move_to(double x, double y);
|
void move_to(double x, double y);
|
||||||
bool resize(double width, double height);
|
bool resize(double width, double height);
|
||||||
|
bool resize_fixed(double width, double height);
|
||||||
bool resize(Point &point) { return resize(point.x(), point.y()); }
|
bool resize(Point &point) { return resize(point.x(), point.y()); }
|
||||||
|
|
||||||
std::vector<std::shared_ptr<Widget>> &children() { return m_children; }
|
std::vector<std::shared_ptr<Widget>> &children() { return m_children; }
|
||||||
|
|
Loading…
Reference in a new issue