CtrlLib: ColorPusher, TreeCtrl, ColumnList types now in .usc

git-svn-id: svn://ultimatepp.org/upp/trunk@14041 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2020-02-19 11:46:11 +00:00
parent aad9824174
commit e17de4f5f2
6 changed files with 112 additions and 22 deletions

View file

@ -1,11 +1,9 @@
- Inactive doc icon is not updated - [B] does not blink anymore
- Make allocator work
- MacOS crash when adding Label to TestChStyles
- Mingw: Make things run with F5 even in release mode, "Failed to obtain" should only be shown when debugger stops and even then things should work
- Mingw: Release mode theide crash, symptom missing doc points
- LayDes menu background color
- usc color pusher
- usc treectrl
- usc columnlist
- Remove ClassicCtrls, AmbientCtrls
NTH:
@ -13,6 +11,8 @@ NTH:
DONE:
- usc columnlist
- usc color pusher
- UHD tree [-] [+]
- InsetFrame vs DefaultFrame
- LayDes .usc: Small defect in slider thumb in SD mode
@ -25,6 +25,8 @@ DONE:
- ClassicCtrlsImg
- Ide: When dark editor in light theme, svn history is invisible (as text is white)
- Unknown layout type should have better visual
- LayDes menu background color
- usc treectrl
macos done:

View file

@ -340,6 +340,39 @@ ctrl DataPusher {
}
};
ctrl ColorPusher {
group "Push";
GetStdSize() { return Size(64, 24); }
>Base;
Frame SetFrame = default;
bool SetEditable = true @1;
Text Tip;
bool NotNull = false;
bool WithVoid = false;
bool SColors = false;
bool WithText = false;
bool WithHex = false;
bool Track = false;
bool NoRampWheel = false;
Text NullText;
Text VoidText;
Paint(w) {
r = GetRect();
DrawCtrlFrame(w, r, .SetFrame);
w.DrawRect(r, :SWhite);
DeflateRect(r);
w.DrawRect(r, :LtBlue);
DrawFrame(w, r, :SBlack, :SBlack);
if(.WithText || .WithHex) {
text = .WithText ? "LtBlue" : "#0000FF";
w.DrawText(r.left + 6, (r.top + r.bottom - GetSmartTextSize(text, StdFont()).cy) / 2,
text, StdFont(), :White);
}
}
};
ctrl Button {
group "Push";
@ -350,7 +383,7 @@ ctrl Button {
Text SetLabel ? "Button label";
Font SetFont = StdFont();
Frame SetFrame @1;
Text Tip;
Text Tip;
Paint(w) {
r = GetRect();
@ -1009,6 +1042,62 @@ ctrl ArrayCtrl {
w.DrawRect(r.left + i * third - 1, celltop, 1, cellht, :SLtGray);
}
w.DrawRect(r.left, cellbot, wd, r.bottom - cellbot, :SWhite.r < 50 ? Color(90, 90, 90) : Color(160, 160, 160));
w.DrawText(3, r.bottom - fontcy, "ArrayCtrl", Arial(10), :SMagenta);
}
};
fn DrawTreeItem(w, x, y, text, kind)
{
osz = OptionSize();
textsize = GetTextSize(text);
if(kind)
DrawOption(w, x, y + (textsize.cy - osz) / 2, 1);
w.DrawText(x + osz + 2, y, text, StdFont(), :SBlack);
}
ctrl TreeCtrl {
group "Complex";
GetStdSize() { return Size(150, 100); }
Frame SetFrame = default @1;
// Qtf SetInfo @1 ? "Info of control" ;
Paint(w) {
r = GetRect();
w.DrawRect(r, :SWhite);
fontcy = GetTextSize("X").cy;
DrawCtrlFrame(w, r, .SetFrame);
rsb = r;
r.right = rsb.left = rsb.right - fontcy - 4;
PaintVScrollBar(w, rsb);
w.DrawText(3, r.bottom - fontcy, "TreeCtrl", Arial(10), :SMagenta);
DeflateRect(r);
DeflateRect(r);
DrawTreeItem(w, r.left + 2 + 0 * fontcy, r.top + 2 + 0 * fontcy, "Root", 1);
DrawTreeItem(w, r.left + 2 + 1 * fontcy, r.top + 2 + 1 * fontcy, "Node 1", 0);
DrawTreeItem(w, r.left + 2 + 1 * fontcy, r.top + 2 + 2 * fontcy, "Node 2", 1);
DrawTreeItem(w, r.left + 2 + 2 * fontcy, r.top + 2 + 3 * fontcy, "Node 3", 0);
}
};
ctrl ColumnList {
group "Complex";
GetStdSize() { return Size(150, 100); }
Frame SetFrame = default @1;
// Qtf SetInfo @1 ? "Info of control" ;
Paint(w) {
r = GetRect();
w.DrawRect(r, :SWhite);
fontcy = GetTextSize("X").cy;
DrawCtrlFrame(w, r, .SetFrame);
rsb = r;
r.right = rsb.left = rsb.right - fontcy - 4;
PaintVScrollBar(w, rsb);
w.DrawText(3, 3, "ColumnList", Arial(10), :SMagenta);
}
};

View file

@ -30,7 +30,6 @@ private:
int LevelToClient(int l) const;
private:
// double gamma;
bool ramp;
Color color;
Color normalized_color;
@ -240,8 +239,8 @@ public:
ColorPusher& WithVoid(bool b = true) { colors.WithVoid(b); return *this; }
ColorPusher& VoidText(const char *s) { voidtext = s; colors.VoidText(s); Refresh(); return *this; }
ColorPusher& SColors(bool b = true) { colors.SColors(b); return *this; }
ColorPusher& WithText() { withtext = true; Refresh(); return *this; }
ColorPusher& WithHex() { withhex = true; Refresh(); return *this; }
ColorPusher& WithText(bool b = true) { withtext = b; Refresh(); return *this; }
ColorPusher& WithHex(bool b = true) { withhex = b; Refresh(); return *this; }
ColorPusher& Track(bool b = true) { track = b; return *this; }
ColorPusher& NoTrack() { return Track(false); }
ColorPusher& NoRampWheel(bool b = true) { colors.NoRampWheel(b); return *this; }

View file

@ -1,5 +1,4 @@
topic "Color widgets";
[2 $$0,0#00000000000000000000000000000000:Default]
[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class]
[l288;2 $$2,0#27521748481378242620020725143825:desc]
[0 $$3,0#96390100711032703541132217272105:end]
@ -9,6 +8,7 @@ topic "Color widgets";
[l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param]
[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam]
[b42;2 $$9,9#13035079074754324216151401829390:normal]
[2 $$0,0#00000000000000000000000000000000:Default]
[{_}%EN-US
[ {{10000@3 [s0; [*@(229)4 ColorPopUp]]}}&]
[s3;%- &]
@ -152,16 +152,15 @@ setting is SColors(false).&]
[s7; [*/ Return value]-|`*this.&]
[s3; &]
[s4;%- &]
[s5;:ColorPusher`:`:WithText`(`):%- [_^ColorPusher^ ColorPusher][@(0.0.255) `&]_[* WithText
]()&]
[s2; Setups displaying of text representation of color.&]
[s7; [*/ Return value]-|`*this.&]
[s5;:Upp`:`:ColorPusher`:`:WithText`(bool`):%- [_^Upp`:`:ColorPusher^ ColorPusher][@(0.0.255) `&
]_[* WithText]([@(0.0.255) bool]_[*@3 b]_`=_[@(0.0.255) true])&]
[s2; ColorPusher will display text representation of color (either
known name, or numbers).&]
[s3; &]
[s4;%- &]
[s5;:Upp`:`:ColorPusher`:`:WithHex`(`):%- [_^Upp`:`:ColorPusher^ ColorPusher][@(0.0.255) `&
]_[* WithHex]()&]
[s2; Setups displaying of text representation of color in HTML hexadecimal
format.&]
[s5;:Upp`:`:ColorPusher`:`:WithHex`(bool`):%- [_^Upp`:`:ColorPusher^ ColorPusher][@(0.0.255) `&
]_[* WithHex]([@(0.0.255) bool]_[*@3 b]_`=_[@(0.0.255) true])&]
[s2; ColorPusher will hexadecimal representation of color.&]
[s3;%- &]
[s4;%- &]
[s5;:ColorPusher`:`:Track`(bool`):%- [_^ColorPusher^ ColorPusher][@(0.0.255) `&]_[* Track](

View file

@ -1,4 +1,4 @@
topic "class CtrlMapper";
topic "CtrlMapper";
[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class]
[l288;2 $$2,2#27521748481378242620020725143825:desc]
[0 $$3,0#96390100711032703541132217272105:end]
@ -16,6 +16,7 @@ topic "class CtrlMapper";
[s2;%% Trivial utility class for mapping values to widgets and back.
It is sort of similar to CtrlRetriever, but does immediate transfer
of values based on flag&]
[s2;%% &]
[s3; &]
[ {{10000F(128)G(128)@1 [s0;%% [* Public Method List]]}}&]
[s3; &]

View file

@ -759,7 +759,7 @@ void LayDes::Group(Bar& bar, const String& group)
((MenuBar&)bar).LeftGap(w + 6);
int q = 0;
for(i = 0; i < type.GetCount(); i++) {
bar.Add(type[i], GetTypeIcon(type[i], w, h, 0, SColorFace),
bar.Add(type[i], GetTypeIcon(type[i], w, h, 0, SLtGray),
THISBACK1(CreateCtrl, type[i]));
if((q++ + 2) % 16 == 0)
bar.Break();
@ -781,7 +781,7 @@ void LayDes::TemplateGroup(Bar& bar, TempGroup tg)
((MenuBar&)bar).LeftGap(w + 2);
int q = 0;
for(i = 0; i < type.GetCount(); i++) {
bar.Add(type[i], GetTypeIcon(type[i], w, h, 0, SColorFace),
bar.Add(type[i], GetTypeIcon(type[i], w, h, 0, SLtGray),
THISBACK1(CreateCtrl, tg.temp + '<' + type[i] + '>'));
if((q++ + 2) % 16 == 0)
bar.Break();
@ -817,7 +817,7 @@ void LayDes::Template(Bar& bar, const String& temp)
if((q++ + 2) % 16 == 0)
bar.Break();
for(i = 0; i < type.GetCount(); i++) {
bar.Add(type[i], GetTypeIcon(type[i], w, h, 0, SColorFace),
bar.Add(type[i], GetTypeIcon(type[i], w, h, 0, SLtGray),
THISBACK1(CreateCtrl, temp + '<' + type[i] + '>'));
if((q++ + 2) % 16 == 0)
bar.Break();
@ -876,7 +876,7 @@ void LayDes::RightDown(Point p, dword keyflags)
if((q++ + 2) % 16 == 0)
menu.Break();
for(i = 0; i < type.GetCount(); i++) {
menu.Add(type[i], GetTypeIcon(type[i], w, h, 0, SColorFace),
menu.Add(type[i], GetTypeIcon(type[i], w, h, 0, SLtGray),
THISBACK1(CreateCtrl, type[i]));
if((q++ + 2) % 16 == 0)
menu.Break();