mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-25 14:22:54 -06:00
CtrlCore, CtrlLib: Modify flag refactored, dark mode improvements
git-svn-id: svn://ultimatepp.org/upp/trunk@14009 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
785714e444
commit
e137b53a2d
9 changed files with 85 additions and 62 deletions
|
|
@ -334,6 +334,7 @@ Ctrl& Ctrl::SetEditable(bool aeditable) {
|
|||
|
||||
void Ctrl::SetModify()
|
||||
{
|
||||
GuiLock __;
|
||||
modify = true;
|
||||
}
|
||||
|
||||
|
|
@ -341,14 +342,27 @@ void Ctrl::ClearModify()
|
|||
{
|
||||
GuiLock __;
|
||||
modify = false;
|
||||
}
|
||||
|
||||
void Ctrl::ClearModifyDeep()
|
||||
{
|
||||
GuiLock __;
|
||||
ClearModify();
|
||||
for(Ctrl *q = firstchild; q; q = q->next)
|
||||
q->ClearModify();
|
||||
}
|
||||
|
||||
|
||||
bool Ctrl::IsModified() const
|
||||
{
|
||||
GuiLock __;
|
||||
if(IsModifySet()) return true;
|
||||
return modify;
|
||||
}
|
||||
|
||||
bool Ctrl::IsModifiedDeep() const
|
||||
{
|
||||
GuiLock __;
|
||||
if(IsModified()) return true;
|
||||
for(Ctrl *q = firstchild; q; q = q->next)
|
||||
if(q->IsModified()) return true;
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1111,8 +1111,9 @@ public:
|
|||
bool IsEditable() const { return editable; }
|
||||
bool IsReadOnly() const { return !editable; }
|
||||
|
||||
void ResetModify() { modify = false; }
|
||||
bool IsModifySet() const { return modify; }
|
||||
void ClearModifyDeep();
|
||||
bool IsModifiedDeep() const;
|
||||
bool IsModifySet() const { return modify; } // deprecated
|
||||
|
||||
void UpdateRefresh();
|
||||
void Update();
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
- Win32 menu checkbox
|
||||
- Win32 - always use dark mode, always use UHD
|
||||
|
||||
- Some problem when switching skin should be solved
|
||||
|
||||
NTH:
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -857,15 +857,12 @@ returns Value() `- void value.&]
|
|||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:Ctrl`:`:ClearModify`(`):%- [@(0.0.255) virtual] [@(0.0.255) void]_[* ClearModify]()&]
|
||||
[s2;b17;a17; Clears modification flag. Default implementation is
|
||||
empty.&]
|
||||
[s2;b17;a17; Clears modification flag.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:Ctrl`:`:IsModified`(`)const:%- [@(0.0.255) virtual] [@(0.0.255) bool]_[* IsModified]()
|
||||
_[@(0.0.255) const]&]
|
||||
[s2;b17;a17; Queries modification flag. Default implementation returns
|
||||
false.&]
|
||||
[s7;i1120;a17; [*/ Return value]-|Modification flag.&]
|
||||
[s2;b17;a17; Returns the value modification flag.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:Ctrl`:`:Accept`(`):%- [@(0.0.255) virtual] [@(0.0.255) bool]_[* Accept]()&]
|
||||
|
|
@ -2126,12 +2123,15 @@ can check this flag using IsEditable method and behave accordingly.&]
|
|||
[s2;b17;a17; Same as !IsEditable().&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:Ctrl`:`:ResetModify`(`):%- [@(0.0.255) void]_[* ResetModify]()&]
|
||||
[s2;b17;a17; Resets modify flag.&]
|
||||
[s5;:Upp`:`:Ctrl`:`:ClearModifyDeep`(`):%- [@(0.0.255) void]_[* ClearModifyDeep]()&]
|
||||
[s2; Clear modify flag (by calling ClearModify) for the widgets and
|
||||
all its descendants.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:Ctrl`:`:IsModifySet`(`)const:%- [@(0.0.255) bool]_[* IsModifySet]()_[@(0.0.255) const]&]
|
||||
[s7;i1120;a17; [*/ Return value]-|true if modify flag is set.&]
|
||||
[s5;:Upp`:`:Ctrl`:`:IsModifiedDeep`(`)const:%- [@(0.0.255) bool]_[* IsModifiedDeep]()_[@(0.0.255) c
|
||||
onst]&]
|
||||
[s2; Returns true if widget or any of its descendants have modify
|
||||
flag active.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:Ctrl`:`:UpdateRefresh`(`):%- [@(0.0.255) void]_[* UpdateRefresh]()&]
|
||||
|
|
|
|||
|
|
@ -510,6 +510,10 @@ void ChHostSkin()
|
|||
s.separator.l2 = SColorLight();
|
||||
}
|
||||
Win32Look(s.arealook, XP_REBAR, 0, 1);
|
||||
CtrlImg::Set(CtrlImg::I_MenuCheck0, CtrlsImg::O0());
|
||||
CtrlImg::Set(CtrlImg::I_MenuCheck1, CtrlsImg::O1());
|
||||
CtrlImg::Set(CtrlImg::I_MenuRadio0, CtrlsImg::S0());
|
||||
CtrlImg::Set(CtrlImg::I_MenuRadio1, CtrlsImg::S1());
|
||||
}
|
||||
|
||||
/* CtrlImg::Set("hthumb", XpImage(XP_TRACKBAR, TKP_THUMB, TUS_NORMAL, Null, Size(10, 20)));
|
||||
|
|
|
|||
|
|
@ -43,12 +43,12 @@ fn DrawBorder(w, &r, ...)
|
|||
|
||||
fn DrawButtonFrame(w, &r)
|
||||
{
|
||||
DrawBorder(w, r, :SWhite, :SBlack, :SWhiteGray, :SGray);
|
||||
DrawBorder(w, r, :SWhite, :Black, :WhiteGray, :Gray);
|
||||
}
|
||||
|
||||
fn DrawEdgeButtonFrame(w, &r)
|
||||
{
|
||||
DrawBorder(w, r, :SWhiteGray, :SBlack, :SWhite, :SGray);
|
||||
DrawBorder(w, r, :SWhiteGray, :Black, :White, :Gray);
|
||||
}
|
||||
|
||||
fn DrawEdgeButton(w, &r)
|
||||
|
|
@ -59,7 +59,7 @@ fn DrawEdgeButton(w, &r)
|
|||
|
||||
fn DrawInsetFrame(w, &r)
|
||||
{
|
||||
DrawBorder(w, r, :SGray, :SWhite, :SBlack, :SLtGray);
|
||||
DrawBorder(w, r, :SGray, :White, :SBlack, :LtGray);
|
||||
}
|
||||
|
||||
fn DrawCtrlFrame(w, &r, frame)
|
||||
|
|
@ -69,29 +69,29 @@ fn DrawCtrlFrame(w, &r, frame)
|
|||
switch(frame) {
|
||||
case "FieldFrame()":
|
||||
case "InsetFrame()": DrawInsetFrame(w, r); break;
|
||||
case "OutsetFrame()": DrawBorder(w, r, :SLtGray, :SBlack, :SWhite, :SGray); break;
|
||||
case "OutsetFrame()": DrawBorder(w, r, :LtGray, :Black, :White, :Gray); break;
|
||||
case "ButtonFrame()": DrawButtonFrame(w, r); break;
|
||||
case "ThinInsetFrame()": DrawBorder(w, r, :SGray, :SWhite); break;
|
||||
case "ThinOutsetFrame()": DrawBorder(w, r, :SWhite, :SGray); break;
|
||||
case "ThinInsetFrame()": DrawBorder(w, r, :Gray, :White); break;
|
||||
case "ThinOutsetFrame()": DrawBorder(w, r, :White, :Gray); break;
|
||||
case "BlackFrame()": DrawBorder(w, r, :SBlack, :SBlack); break;
|
||||
case "TopSeparatorFrame()":
|
||||
w.DrawRect(r.left, r.top, width, 1, :SGray);
|
||||
w.DrawRect(r.left, r.top + 1, width, 1, :SWhite);
|
||||
w.DrawRect(r.left, r.top, width, 1, :Gray);
|
||||
w.DrawRect(r.left, r.top + 1, width, 1, :White);
|
||||
r.top += 2;
|
||||
break;
|
||||
case "BottomSeparatorFrame()":
|
||||
w.DrawRect(r.left, r.bottom - 2, width, 1, :SGray);
|
||||
w.DrawRect(r.left, r.bottom - 1, width, 1, :SWhite);
|
||||
w.DrawRect(r.left, r.bottom - 2, width, 1, :Gray);
|
||||
w.DrawRect(r.left, r.bottom - 1, width, 1, :White);
|
||||
r.bottom -= 2;
|
||||
break;
|
||||
case "LeftSeparatorFrame()":
|
||||
w.DrawRect(r.left, r.top, 1, height, :SGray);
|
||||
w.DrawRect(r.left + 1, r.top, 1, height, :SWhite);
|
||||
w.DrawRect(r.left, r.top, 1, height, :Gray);
|
||||
w.DrawRect(r.left + 1, r.top, 1, height, :White);
|
||||
r.left += 2;
|
||||
break;
|
||||
case "RightSeparatorFrame()":
|
||||
w.DrawRect(r.right - 2, r.top, 1, height, :SGray);
|
||||
w.DrawRect(r.right - 1, r.top, 1, height, :SWhite);
|
||||
w.DrawRect(r.right - 2, r.top, 1, height, :Gray);
|
||||
w.DrawRect(r.right - 1, r.top, 1, height, :White);
|
||||
r.right -= 2;
|
||||
break;
|
||||
}
|
||||
|
|
@ -275,24 +275,24 @@ ctrl LabelBox {
|
|||
if(2 * GetSmartTextSize("X").cy > sz.cy) {
|
||||
d = sz.cy / 2;
|
||||
w.DrawSmartText(d, (sz.cy - ts.cy) / 2, .SetLabel, .SetFont, .SetInk, sz.cx);
|
||||
w.DrawRect(1, d, d - 1, 1, :SGray);
|
||||
w.DrawRect(1, d + 1, d - 1, 1, :SWhite);
|
||||
w.DrawRect(1, d, d - 1, 1, :Gray);
|
||||
w.DrawRect(1, d + 1, d - 1, 1, :White);
|
||||
}
|
||||
else {
|
||||
w.DrawSmartText(d, 0, .SetLabel, .SetFont, .SetInk, sz.cx);
|
||||
w.DrawRect(0, d + 2, 1, sz.cy - d - 4, :SGray);
|
||||
w.DrawRect(1, d + 2, 1, sz.cy - d - 4, :SWhite);
|
||||
w.DrawRect(sz.cx - 2, d, 1, sz.cy - d - 2, :SGray);
|
||||
w.DrawRect(sz.cx - 1, d, 1, sz.cy - d - 2, :SWhite);
|
||||
w.DrawRect(0, sz.cy - 2, sz.cx - 1, 1, :SGray);
|
||||
w.DrawRect(0, sz.cy - 1, sz.cx - 1, 1, :SWhite);
|
||||
w.DrawRect(sz.cx - 1, sz.cy - 2, 1, 2, :SWhite);
|
||||
w.DrawRect(1, d, d - 1, 1, :SGray);
|
||||
w.DrawRect(1, d + 1, d - 1, 1, :SWhite);
|
||||
w.DrawRect(0, d, 1, 2, :SGray);
|
||||
w.DrawRect(0, d + 2, 1, sz.cy - d - 4, :Gray);
|
||||
w.DrawRect(1, d + 2, 1, sz.cy - d - 4, :White);
|
||||
w.DrawRect(sz.cx - 2, d, 1, sz.cy - d - 2, :Gray);
|
||||
w.DrawRect(sz.cx - 1, d, 1, sz.cy - d - 2, :White);
|
||||
w.DrawRect(0, sz.cy - 2, sz.cx - 1, 1, :Gray);
|
||||
w.DrawRect(0, sz.cy - 1, sz.cx - 1, 1, :White);
|
||||
w.DrawRect(sz.cx - 1, sz.cy - 2, 1, 2, :White);
|
||||
w.DrawRect(1, d, d - 1, 1, :Gray);
|
||||
w.DrawRect(1, d + 1, d - 1, 1, :White);
|
||||
w.DrawRect(0, d, 1, 2, :Gray);
|
||||
}
|
||||
w.DrawRect(d + ts.cx, d, sz.cx - ts.cx - d - 2, 1, :SGray);
|
||||
w.DrawRect(d + ts.cx, d + 1, sz.cx - ts.cx - d - 2, 1, :SWhite);
|
||||
w.DrawRect(d + ts.cx, d, sz.cx - ts.cx - d - 2, 1, :Gray);
|
||||
w.DrawRect(d + ts.cx, d + 1, sz.cx - ts.cx - d - 2, 1, :White);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -384,19 +384,19 @@ ctrl Option {
|
|||
w.DrawSmartText(imagesize.cx + 14, 0, .SetLabel, .SetFont);
|
||||
|
||||
d = textsize.cy / 2;
|
||||
w.DrawRect(0, d + 2, 1, sz.cy - d - 4, :SGray);
|
||||
w.DrawRect(1, d + 2, 1, sz.cy - d - 4, :SWhite);
|
||||
w.DrawRect(sz.cx - 2, d, 1, sz.cy - d - 2, :SGray);
|
||||
w.DrawRect(sz.cx - 1, d, 1, sz.cy - d - 2, :SWhite);
|
||||
w.DrawRect(0, sz.cy - 2, sz.cx - 1, 1, :SGray);
|
||||
w.DrawRect(0, sz.cy - 1, sz.cx - 1, 1, :SWhite);
|
||||
w.DrawRect(sz.cx - 1, sz.cy - 2, 1, 2, :SWhite);
|
||||
w.DrawRect(1, d, d - 1, 1, :SGray);
|
||||
w.DrawRect(1, d + 1, d - 1, 1, :SWhite);
|
||||
w.DrawRect(0, d, 1, 2, :SGray);
|
||||
w.DrawRect(0, d + 2, 1, sz.cy - d - 4, :Gray);
|
||||
w.DrawRect(1, d + 2, 1, sz.cy - d - 4, :White);
|
||||
w.DrawRect(sz.cx - 2, d, 1, sz.cy - d - 2, :Gray);
|
||||
w.DrawRect(sz.cx - 1, d, 1, sz.cy - d - 2, :White);
|
||||
w.DrawRect(0, sz.cy - 2, sz.cx - 1, 1, :Gray);
|
||||
w.DrawRect(0, sz.cy - 1, sz.cx - 1, 1, :White);
|
||||
w.DrawRect(sz.cx - 1, sz.cy - 2, 1, 2, :White);
|
||||
w.DrawRect(1, d, d - 1, 1, :Gray);
|
||||
w.DrawRect(1, d + 1, d - 1, 1, :White);
|
||||
w.DrawRect(0, d, 1, 2, :Gray);
|
||||
x = textsize.cx + imagesize.cx + 8;
|
||||
w.DrawRect(d + x, d, sz.cx - d - x, 1, :SGray);
|
||||
w.DrawRect(d + x, d + 1, sz.cx - d - x, 1, :SWhite);
|
||||
w.DrawRect(d + x, d, sz.cx - d - x, 1, :Gray);
|
||||
w.DrawRect(d + x, d + 1, sz.cx - d - x, 1, :White);
|
||||
}
|
||||
else {
|
||||
w.DrawImage(0, (sz.cy - imagesize.cy) / 2, img);
|
||||
|
|
|
|||
|
|
@ -210,12 +210,14 @@ const ColorF *WhiteBorder()
|
|||
return data;
|
||||
}
|
||||
|
||||
#define SColorEdge Black // for now
|
||||
|
||||
const ColorF *DefButtonBorder()
|
||||
{
|
||||
static ColorF data[] = {
|
||||
(ColorF)3,
|
||||
&SColorText, &SColorText, &SColorText, &SColorText,
|
||||
&SColorLight, &SColorLight, &SColorText, &SColorText,
|
||||
&SColorEdge, &SColorEdge, &SColorEdge, &SColorEdge,
|
||||
&SColorLight, &SColorLight, &SColorEdge, &SColorEdge,
|
||||
&SColorLtFace, &SColorLtFace, &SColorShadow, &SColorShadow,
|
||||
};
|
||||
return data;
|
||||
|
|
@ -225,7 +227,7 @@ const ColorF *ButtonBorder()
|
|||
{
|
||||
static ColorF data[] = {
|
||||
(ColorF)2,
|
||||
&SColorLight, &SColorLight, &SColorText, &SColorText,
|
||||
&SColorLight, &SColorLight, &SColorEdge, &SColorEdge,
|
||||
&SColorLtFace, &SColorLtFace, &SColorShadow, &SColorShadow,
|
||||
};
|
||||
return data;
|
||||
|
|
@ -235,7 +237,7 @@ const ColorF *EdgeButtonBorder()
|
|||
{
|
||||
static ColorF data[] = {
|
||||
(ColorF)2,
|
||||
&SColorLtFace, &SColorLtFace, &SColorText, &SColorText,
|
||||
&SColorLtFace, &SColorLtFace, &SColorEdge, &SColorEdge,
|
||||
&SColorLight, &SColorLight, &SColorShadow, &SColorShadow,
|
||||
};
|
||||
return data;
|
||||
|
|
@ -245,8 +247,8 @@ const ColorF *ButtonPushBorder()
|
|||
{
|
||||
static ColorF data[] = {
|
||||
(ColorF)2,
|
||||
&SColorText, &SColorText, &SColorText, &SColorText,
|
||||
&SColorShadow, &SColorShadow, &SColorText, &SColorText
|
||||
&SColorEdge, &SColorEdge, &SColorEdge, &SColorEdge,
|
||||
&SColorShadow, &SColorShadow, &SColorEdge, &SColorEdge
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
|
@ -256,7 +258,7 @@ const ColorF *InsetBorder()
|
|||
static ColorF data[] = {
|
||||
(ColorF)2,
|
||||
&SColorShadow, &SColorShadow, &SColorLight, &SColorLight,
|
||||
&SColorText, &SColorText, &SColorFace, &SColorFace
|
||||
&SColorEdge, &SColorEdge, &SColorFace, &SColorFace
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
|
@ -265,7 +267,7 @@ const ColorF *OutsetBorder()
|
|||
{
|
||||
static ColorF data[] = {
|
||||
(ColorF)2,
|
||||
&SColorFace, &SColorFace, &SColorText, &SColorText,
|
||||
&SColorFace, &SColorFace, &SColorEdge, &SColorEdge,
|
||||
&SColorLight, &SColorLight, &SColorShadow, &SColorShadow,
|
||||
};
|
||||
return data;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ CH_COLOR(SColorMark, IsDark(SColorPaper()) ? DarkTheme(LtBlue()) : LtBlue());
|
|||
CH_COLOR(SColorMenuMark, IsDark(SColorMenu()) ? DarkTheme(LtBlue()) : LtBlue());
|
||||
|
||||
CH_COLOR(SColorLtFace, Blend(SColorFace, SColorLight));
|
||||
CH_COLOR(SColorDkShadow, Blend(SColorShadow, SColorText));
|
||||
CH_COLOR(SColorDkShadow, Blend(SColorShadow, Black));
|
||||
CH_COLOR(SColorLabel, SColorText());
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ void LayDes::PaintLayoutItems(Draw& w, int layid, Size size, Index<int>& passed,
|
|||
Rect r = CtrlRectZ(m.pos, size);
|
||||
String dummy;
|
||||
int lr = ParseLayoutRef(m.type, dummy);
|
||||
DrawFrame(w, r, WhiteGray);
|
||||
DrawFrame(w, r, IsDarkTheme() ? Blend(Gray(), Blue()) : Blend(WhiteGray(), LtBlue()));
|
||||
w.Clipoff(r);
|
||||
if(lr < 0)
|
||||
m.Paint(w, r.Size());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue