ExpandFrame/ExpanderCtrl: Fixes fopr horizontal alignment

git-svn-id: svn://ultimatepp.org/upp/trunk@2402 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
mrjt 2010-05-17 10:00:53 +00:00
parent 07c9fd6c83
commit 57d4328721
3 changed files with 19 additions and 5 deletions

View file

@ -37,13 +37,18 @@ void ExpandFrame::ImgButton::Paint(Draw &w)
{
if (p->hasarrow)
w.DrawImage(sz.cx - isz.cx + dx - 5, (sz.cy - isz.cy) / 2 + dy, img);
w.DrawText(4, 1, p->GetTitle());
w.DrawText(4, 1, p->GetTitle(), st->font);
}
else
{
if (p->hasarrow)
w.DrawImage((sz.cx - isz.cx) / 2, sz.cy - isz.cy + dy - 5, img);
w.DrawText(p->TitleSz() - 1, 4, 2700, p->GetTitle());
w.DrawImage((sz.cx - isz.cx) / 2, 5, img);
if (p->type == RIGHT)
w.DrawText(p->TitleSz() - 1, 4 + isz.cy + 5, 2700, p->GetTitle(), st->font);
else {
const WString &s = p->GetTitle();
w.DrawText(1, 4 + GetTextSize(s, st->font).cx + isz.cy + 5, 900, s, st->font);
}
}
}
}

View file

@ -78,7 +78,6 @@ public:
ExpandFrame& Right(Ctrl& c, int size = -1) { return Set(c, (size < 0) ? c.GetMinSize().cx : HorzLayoutZoom(size), RIGHT); }
ExpandFrame& Bottom(Ctrl& c, int size = -1) { return Set(c, (size < 0) ? c.GetMinSize().cy : VertLayoutZoom(size), BOTTOM); }
ExpandFrame& SetStyle(const Style *_style) { style = _style; SetChildPos(); UpdateButton(); RefreshParentLayout(); return *this; }
ExpandFrame& IgnoreFocus(bool ignore = true) { ignorefocus = ignore; if (!childfocus) Refresh(); }
ExpandFrame& Expand(bool _expand = true);
@ -124,6 +123,8 @@ public:
ExpandFrame & AddExpander(Ctrl &c, bool expand, int size = -1);
ExpanderCtrl & SetStyle(const ExpandFrame::Style &s) { style = &s; return *this; }
ExpandFrame & Get(int i) { return exp[i]; }
ExpanderCtrl & Horz(bool v = true);
ExpanderCtrl & Vert(bool v = true) { return Horz(!v); }

View file

@ -37,9 +37,17 @@ ExpandFrame & ExpanderCtrl::AddExpander(Ctrl &c, bool expand, int size)
ExpanderCtrl & ExpanderCtrl::Horz(bool v)
{
ASSERT(!GetCount()); // Don't call unless empty!
if (v == horz) return *this;
horz = v;
scroll.Horz(v);
if (horz)
for (int i = 0; i < exp.GetCount(); i++)
exp[i].Left(*exp[i].GetLastChild());
else
for (int i = 0; i < exp.GetCount(); i++)
exp[i].Top(*exp[i].GetLastChild());
Repos();
return *this;
}