invalidating children elements upon Element::layout.

This commit is contained in:
rachytski 2013-01-31 15:50:35 +03:00 committed by Alex Zolotarev
parent 26e5d676e4
commit 011030657d
6 changed files with 30 additions and 0 deletions

View file

@ -97,6 +97,9 @@ namespace gui
void Balloon::layout()
{
m_textView->setIsDirtyLayout(true);
m_imageView->setIsDirtyLayout(true);
m2::RectD tr = m_textView->roughBoundRect();
m2::RectD ir = m_imageView->roughBoundRect();

View file

@ -7,6 +7,11 @@
namespace gui
{
Button::Params::Params()
: m_minWidth(10),
m_minHeight(10)
{}
Button::Button(Params const & p) : Element(p)
{
TextView::Params tp;
@ -140,6 +145,11 @@ namespace gui
m_textView->purge();
}
void Button::layout()
{
m_textView->setIsDirtyLayout(true);
}
vector<m2::AnyRectD> const & Button::boundRects() const
{
if (isDirtyRect())

View file

@ -48,6 +48,7 @@ namespace gui
unsigned m_minWidth;
unsigned m_minHeight;
string m_text;
Params();
};
Button(Params const & p);
@ -81,6 +82,7 @@ namespace gui
void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
void purge();
void layout();
/// @}
};

View file

@ -74,9 +74,17 @@ struct ButtonTest
bp.m_pivot = m2::PointD(200, 200);
bp.m_position = graphics::EPosAbove;
bp.m_text = "TestButton";
bp.m_minWidth = 200;
bp.m_minHeight = 40;
m_button.reset(new gui::Button(bp));
m_button->setFont(gui::Element::EActive, graphics::FontDesc(16, graphics::Color(255, 255, 255, 255)));
m_button->setFont(gui::Element::EPressed, graphics::FontDesc(16, graphics::Color(255, 255, 255, 255)));
m_button->setColor(gui::Element::EActive, graphics::Color(graphics::Color(0, 0, 0, 0.6 * 255)));
m_button->setColor(gui::Element::EPressed, graphics::Color(graphics::Color(0, 0, 0, 0.4 * 255)));
c->AddElement(m_button);
}

View file

@ -45,6 +45,12 @@ void CountryStatusDisplay::SetStatusMessage(string const & msgID, T1 const * t1,
m_statusMsg->setText(msg);
}
void CountryStatusDisplay::layout()
{
m_downloadButton->setIsDirtyLayout(true);
m_statusMsg->setIsDirtyLayout(true);
}
void CountryStatusDisplay::purge()
{
m_downloadButton->purge();

View file

@ -51,6 +51,7 @@ private:
/// caching resources for fast rendering.
void cache();
void purge();
void layout();
string const displayName() const;