CtrlLib: Fixed issue with DropChoince::Dropping, TopWindow: Default action, if no breaker defined, is now IDCANCEL (not IDYES which requires accept)

git-svn-id: svn://ultimatepp.org/upp/trunk@7721 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-09-23 12:57:55 +00:00
parent 9e781cfda5
commit c11228de5f
4 changed files with 21 additions and 7 deletions

View file

@ -68,9 +68,6 @@ bool TopWindow::IsShowEnabled() const
void TopWindow::DefaultBreak()
{
if(FindAction(IDCANCEL))
RejectBreak(IDCANCEL);
else
if(FindAction(IDNO))
RejectBreak(IDNO);
else
@ -80,7 +77,10 @@ void TopWindow::DefaultBreak()
if(FindAction(IDYES))
AcceptBreak(IDYES);
else
if(FindAction(IDCANCEL))
AcceptBreak(IDOK);
else
RejectBreak(IDCANCEL);
}
void TopWindow::Close()

View file

@ -253,7 +253,7 @@ public:
const MultiButton::Style& StyleDefault() { return select.StyleFrame(); }
WithDropChoice& SetStyle(const MultiButton::Style& s) { select.SetStyle(s); return *this; }
WithDropChoice& Dropping(bool b = true) { select.Show(b); return *this; }
WithDropChoice& Dropping(bool b = true) { select.MainButton().Show(b); return *this; }
WithDropChoice& NoDropping() { return Dropping(false); }
WithDropChoice& NoDropFocus() { select.NoDropFocus(); return *this; }
WithDropChoice& Appending(const String& s = ", ") { appends = s; select.Appending(); return *this; }

View file

@ -38,6 +38,7 @@ MultiButton::SubButton::SubButton()
monoimg = false;
enabled = true;
main = false;
visible = true;
}
void MultiButton::SubButton::Refresh()
@ -99,6 +100,13 @@ MultiButton::SubButton& MultiButton::SubButton::Enable(bool b)
return *this;
}
MultiButton::SubButton& MultiButton::SubButton::Show(bool b)
{
visible = b;
Refresh();
return *this;
}
MultiButton::SubButton& MultiButton::AddButton()
{
SubButton& b = button.Add();
@ -222,9 +230,13 @@ int MultiButton::FindButton(int px)
bool MultiButton::GetPos(SubButton& b, int& lx, int& rx, int& x, int& cx, int px)
{
Size tsz = GetTextSize(b.label, StdFont());
cx = Nvl(b.cx, style->stdwidth + tsz.cx);
if(IsNull(b.cx) && tsz.cx > 0 && !IsNull(b.img))
cx += LB_IMAGE + LB_MARGIN;
if(b.visible) {
cx = Nvl(b.cx, style->stdwidth + tsz.cx);
if(IsNull(b.cx) && tsz.cx > 0 && !IsNull(b.img))
cx += LB_IMAGE + LB_MARGIN;
}
else
cx = 0;
if(b.left) {
x = lx;
lx += cx;

View file

@ -53,6 +53,7 @@ public:
bool left;
bool monoimg;
bool enabled;
bool visible;
String label;
@ -69,6 +70,7 @@ public:
SubButton& Left(bool b = true);
SubButton& Width(int w);
SubButton& Enable(bool b);
SubButton& Show(bool b);
SubButton& Tip(const char *s) { tip = s; return *this; }
SubButton& Main(bool b = true);