diff --git a/uppsrc/CtrlLib/CtrlLib.usc b/uppsrc/CtrlLib/CtrlLib.usc index 74ee7f4ae..f84f68dc2 100644 --- a/uppsrc/CtrlLib/CtrlLib.usc +++ b/uppsrc/CtrlLib/CtrlLib.usc @@ -245,13 +245,13 @@ ctrl StaticText { Paint(w) { sz = ViewSize(w); - textsize = GetTextSize(.SetText, .SetFont); + textsize = GetSmartTextSize(.SetText, .SetFont); px = 0; if(.SetAlign == "ALIGN_CENTER") px = (sz.cx - textsize.cx) / 2; if(.SetAlign == "ALIGN_RIGHT") px = sz.cx - textsize.cx; - w.DrawText(px, (sz.cy - textsize.cy) / 2, .SetText, .SetFont, .SetInk); + w.DrawSmartText(px, (sz.cy - textsize.cy) / 2, .SetText, .SetFont, .SetInk); } Sample() { .SetText = "Text"; diff --git a/uppsrc/CtrlLib/PushCtrl.h b/uppsrc/CtrlLib/PushCtrl.h index 3a7ac2ff5..56c1dcf9b 100644 --- a/uppsrc/CtrlLib/PushCtrl.h +++ b/uppsrc/CtrlLib/PushCtrl.h @@ -42,7 +42,7 @@ public: Pusher& SetLabel(const char *text); Pusher& ClickFocus(bool cf = true); Pusher& NoClickFocus() { return ClickFocus(false); } - bool IsClickFocus() const { return clickfocus; } + bool IsClickFocus() const { return clickfocus; } Font GetFont() const { return font; } String GetLabel() const { return label; } @@ -295,6 +295,7 @@ private: int linecy; int light; int mincy; + int direction; int GetIndex() const; int GetIndex(Point p); @@ -331,6 +332,9 @@ public: Switch& SetFont(Font f) { font = f; Refresh(); return *this; } Font GetFont() const { return font; } Switch& MinCaseHeight(int cy) { mincy = cy; Refresh(); return *this; } + Switch& SetAutoDirection() { direction = 0; return *this; } + Switch& SetHorizontal() { direction = 1; return *this; } + Switch& SetVertical() { direction = -1; return *this; } Switch(); virtual ~Switch(); diff --git a/uppsrc/CtrlLib/Switch.cpp b/uppsrc/CtrlLib/Switch.cpp index 4405ae592..86fe0f129 100644 --- a/uppsrc/CtrlLib/Switch.cpp +++ b/uppsrc/CtrlLib/Switch.cpp @@ -159,6 +159,10 @@ void Switch::Paint(Draw& w) { int y = 0; int x = 0; bool horz = linecy * cs.GetCount() > sz.cy; + + if (direction == 1) horz = true; + else if (direction == -1) horz = false; + if(horz) { posx.SetCount(cs.GetCount()); linecy = sz.cy; @@ -308,6 +312,7 @@ void Switch::CancelMode() { } Switch::Switch() { + direction = 0; linecy = 16; mincy = 0; Transparent(); diff --git a/uppsrc/CtrlLib/src.tpp/Pusher$en-us.tpp b/uppsrc/CtrlLib/src.tpp/Pusher$en-us.tpp index 83727ba67..5a1ade18e 100644 --- a/uppsrc/CtrlLib/src.tpp/Pusher$en-us.tpp +++ b/uppsrc/CtrlLib/src.tpp/Pusher$en-us.tpp @@ -146,6 +146,11 @@ lickFocus]([@(0.0.255) bool]_[*@3 cf]_`=_[@(0.0.255) true])&] lickFocus](false).&] [s3; &] [s4; &] +[s5;:Pusher`:`:IsClickFocus`(`)const: [@(0.0.255) bool]_[* IsClickFocus]()_[@(0.0.255) cons +t]&] +[s2;%% Retrieves the value of ClickFocus.&] +[s3; &] +[s4; &] [s5;:Pusher`:`:GetFont`(`)const: [_^Font^ Font]_[* GetFont]()_[@(0.0.255) const]&] [s2;%% Returns the font that should be used in painting the concrete derived Pusher class. Pusher itself does not use this font anywhere, @@ -166,4 +171,4 @@ onst]&] [s7;%% CTRL`_PRESSED-|pusher is enabled and pressed&] [s7;%% CTRL`_DISABLED-|pusher is disabled&] [s3; &] -[s0; ] \ No newline at end of file +[s0; ]] \ No newline at end of file diff --git a/uppsrc/CtrlLib/src.tpp/Switch$en-us.tpp b/uppsrc/CtrlLib/src.tpp/Switch$en-us.tpp index ded872d2f..68d31de82 100644 --- a/uppsrc/CtrlLib/src.tpp/Switch$en-us.tpp +++ b/uppsrc/CtrlLib/src.tpp/Switch$en-us.tpp @@ -18,34 +18,11 @@ rl]&] [s0; &] [s2; @@image:1287&131 -΀Ƙ䪔ܼϹԼ谅ɑⰋÚ -弑ٝǣ䆇̻ҀҠ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vr5r/0dFv+f3SHLtyMjKUoJ3qnxlcN3+tA/0X+c8Qd5m3+73T46+hI0C09OB0EUx4lIpTbRP9F/vPEH/06ns7HxPpPZCpLgG+cnJXDJHxuYAvR/9E/0H6sEnPzr9e/49PCw+o8k8JKTzb5E/0f/RP9B/Tr5T00t53KvvbcQngu+5ew65lvOFvD8Qv9H/0T/Qf0i/5E/iL8v/9gCzy/0f1Qu+g9ekf/e/HHFkHthCgjEAcIvRM6/V79ghuvtfNuXyy9gvVqWyzR+IQwfvhKcfqFwUpj5OJM+Tid3kzsXOwS/EJIPXwlOvwD+e9pe/ls+e50d/jBM8AtkPt4cC1p1eM/7HpNh+4WyVEb8Lf6zX2cHdwdlVQ7yC2T+ruOgM4QrfZdYQbD9gnKvIH8s/slqcuDdgNEygvwC4fvpRfFaxDr9wvbFNvIH8Qf//et9gl8g/AQvCfQqXH7h4fFBUiUr/pR+IfJEMln9AmGNGqacXbdQ5pL5//mFnpDwjMiVCgiQIfxC5PwZ9hfCNBm+fYl5fyHMj/KVwLy/EB8JzPsLhCwKs8DwPSYjzP6Cb0j7v8xj218gZIXvqq9XCZTkLbDtL/RBAr0KLvsL0SaSyeQXTOL/SGHK2XULZS6Zwi9wAvOzXkCAAX8A/IJmnw==) &] [s9; Options can be visually aligned horizontally or vertically `- U`+`+ choses alignment based on size of options and Ctrl rectangle. @@ -203,7 +180,21 @@ onst]_[_^Value^ Value][@(0.0.255) `&]_[*@3 v])&] [s7; [%-*C@3 f]-|Font to be used.&] [s7; [*/ Return value]-|`*this for chaining.&] [s3; &] -[s0; &] +[s4;%- &] +[s5;:Switch`:`:SetAutoDirection`(`):%- [_^Switch^ Switch][@(0.0.255) `&]_[* SetAutoDirectio +n]()&] +[s2; Sets Switch layout to automatic mode, where items are layed +out depending on the available area for switch (vertically is +the are is high enough, horizontally otherwise).&] +[s3;%- &] +[s4;%- &] +[s5;:Switch`:`:SetHorizontal`(`):%- [_^Switch^ Switch][@(0.0.255) `&]_[* SetHorizontal]()&] +[s2; Forces horizontal layout.&] +[s3;%- &] +[s4;%- &] +[s5;:Switch`:`:SetVertical`(`):%- [_^Switch^ Switch][@(0.0.255) `&]_[* SetVertical]()&] +[s2; Forces vertical layout.&] +[s3; &] [s0; &] [s0;%- &] [ {{10000@3 [s0; [*@(229)4 Switch`::Case]]}}&] @@ -218,7 +209,7 @@ witch`::GetCases] method.&] [s3;%- &] [s5;:Switch`:`:Case`:`:label:%- [_^String^ String]_[* label]&] [s2; Text of the case.&] -[s3; &] +[s3;%- &] [s4;%- &] [s5;:Switch`:`:Case`:`:value:%- [_^Value^ Value]_[* value]&] [s2; Value of the case.&] @@ -231,4 +222,4 @@ witch`::GetCases] method.&] [s5;:Switch`:`:Case`:`:enabled:%- [@(0.0.255) bool]_[* enabled]&] [s2; Enable flag.&] [s3; &] -[s0; ] \ No newline at end of file +[s0; ]] \ No newline at end of file