mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-10 03:44:16 +00:00
Rename ui::Widget::min/max_w/h fields to m_min/maxSize and make them private
This commit is contained in:
parent
80a62f8ed5
commit
7f2cd3b6a9
@ -148,7 +148,8 @@ ColorBar::ColorBar(int align)
|
||||
|
||||
Box* buttonsBox = new HBox();
|
||||
buttonsBox->addChild(&m_buttons);
|
||||
m_buttons.max_h = 15*ui::guiscale();
|
||||
m_buttons.setMaxSize(gfx::Size(m_buttons.maxSize().w,
|
||||
15*ui::guiscale()));
|
||||
|
||||
addChild(buttonsBox);
|
||||
addChild(splitter);
|
||||
|
@ -738,8 +738,8 @@ void SkinTheme::initWidget(Widget* widget)
|
||||
button->border_width.r = 0;
|
||||
button->border_width.b = 0;
|
||||
button->child_spacing = 0;
|
||||
button->min_w = 15 * guiscale();
|
||||
button->min_h = 16 * guiscale();
|
||||
button->setMinSize(gfx::Size(15 * guiscale(),
|
||||
16 * guiscale()));
|
||||
|
||||
static_cast<ButtonBase*>(button)->setIconInterface
|
||||
(new ButtonIconImpl(static_cast<SkinTheme*>(button->getTheme()),
|
||||
|
@ -58,19 +58,19 @@ void View::makeVisibleAllScrollableArea()
|
||||
{
|
||||
Size reqSize = m_viewport.calculateNeededSize();
|
||||
|
||||
this->min_w =
|
||||
+ this->border_width.l
|
||||
+ m_viewport.border_width.l
|
||||
+ reqSize.w
|
||||
+ m_viewport.border_width.r
|
||||
+ this->border_width.r;
|
||||
setMinSize(
|
||||
gfx::Size(
|
||||
+ this->border_width.l
|
||||
+ m_viewport.border_width.l
|
||||
+ reqSize.w
|
||||
+ m_viewport.border_width.r
|
||||
+ this->border_width.r,
|
||||
|
||||
this->min_h =
|
||||
+ this->border_width.t
|
||||
+ m_viewport.border_width.t
|
||||
+ reqSize.h
|
||||
+ m_viewport.border_width.b
|
||||
+ this->border_width.b;
|
||||
+ this->border_width.t
|
||||
+ m_viewport.border_width.t
|
||||
+ reqSize.h
|
||||
+ m_viewport.border_width.b
|
||||
+ this->border_width.b));
|
||||
}
|
||||
|
||||
void View::hideScrollBars()
|
||||
|
@ -62,6 +62,8 @@ WidgetType register_widget_type()
|
||||
|
||||
Widget::Widget(WidgetType type)
|
||||
: m_bounds(0, 0, 0, 0)
|
||||
, m_minSize(0, 0)
|
||||
, m_maxSize(INT_MAX, INT_MAX)
|
||||
{
|
||||
addWidget(this);
|
||||
|
||||
@ -72,10 +74,6 @@ Widget::Widget(WidgetType type)
|
||||
this->border_width.b = 0;
|
||||
this->child_spacing = 0;
|
||||
this->flags = 0;
|
||||
this->min_w = 0;
|
||||
this->min_h = 0;
|
||||
this->max_w = INT_MAX;
|
||||
this->max_h = INT_MAX;
|
||||
this->m_parent = NULL;
|
||||
this->m_theme = CurrentTheme::get();
|
||||
|
||||
@ -875,14 +873,12 @@ void Widget::getTextIconInfo(
|
||||
|
||||
void Widget::setMinSize(const gfx::Size& sz)
|
||||
{
|
||||
min_w = sz.w;
|
||||
min_h = sz.h;
|
||||
m_minSize = sz;
|
||||
}
|
||||
|
||||
void Widget::setMaxSize(const gfx::Size& sz)
|
||||
{
|
||||
max_w = sz.w;
|
||||
max_h = sz.h;
|
||||
m_maxSize = sz;
|
||||
}
|
||||
|
||||
void Widget::flushRedraw()
|
||||
@ -1174,8 +1170,8 @@ Size Widget::getPreferredSize()
|
||||
onPreferredSize(ev);
|
||||
|
||||
Size sz(ev.getPreferredSize());
|
||||
sz.w = MID(this->min_w, sz.w, this->max_w);
|
||||
sz.h = MID(this->min_h, sz.h, this->max_h);
|
||||
sz.w = MID(m_minSize.w, sz.w, m_maxSize.w);
|
||||
sz.h = MID(m_minSize.h, sz.h, m_maxSize.h);
|
||||
return sz;
|
||||
}
|
||||
}
|
||||
@ -1203,8 +1199,8 @@ Size Widget::getPreferredSize(const Size& fitIn)
|
||||
onPreferredSize(ev);
|
||||
|
||||
Size sz(ev.getPreferredSize());
|
||||
sz.w = MID(this->min_w, sz.w, this->max_w);
|
||||
sz.h = MID(this->min_h, sz.h, this->max_h);
|
||||
sz.w = MID(m_minSize.w, sz.w, m_maxSize.w);
|
||||
sz.h = MID(m_minSize.h, sz.h, m_maxSize.h);
|
||||
return sz;
|
||||
}
|
||||
}
|
||||
@ -1409,7 +1405,7 @@ void Widget::onInvalidateRegion(const Region& region)
|
||||
|
||||
void Widget::onPreferredSize(PreferredSizeEvent& ev)
|
||||
{
|
||||
ev.setPreferredSize(Size(min_w, min_h));
|
||||
ev.setPreferredSize(m_minSize);
|
||||
}
|
||||
|
||||
void Widget::onLoadLayout(LoadLayoutEvent& ev)
|
||||
|
@ -52,10 +52,6 @@ namespace ui {
|
||||
// Flags
|
||||
int flags;
|
||||
|
||||
// Widget size limits
|
||||
int min_w, min_h;
|
||||
int max_w, max_h;
|
||||
|
||||
public:
|
||||
|
||||
// ===============================================================
|
||||
@ -254,6 +250,8 @@ namespace ui {
|
||||
// generating recursive onResize() events.
|
||||
void setBoundsQuietly(const gfx::Rect& rc);
|
||||
|
||||
const gfx::Size& minSize() const { return m_minSize; }
|
||||
const gfx::Size& maxSize() const { return m_maxSize; }
|
||||
void setMinSize(const gfx::Size& sz);
|
||||
void setMaxSize(const gfx::Size& sz);
|
||||
|
||||
@ -391,6 +389,9 @@ namespace ui {
|
||||
gfx::Size* m_preferredSize;
|
||||
bool m_doubleBuffered;
|
||||
bool m_transparent;
|
||||
|
||||
// Widget size limits
|
||||
gfx::Size m_minSize, m_maxSize;
|
||||
};
|
||||
|
||||
WidgetType register_widget_type();
|
||||
|
Loading…
x
Reference in New Issue
Block a user