CtrlLib: Gtk3 ch improved focus look

git-svn-id: svn://ultimatepp.org/upp/trunk@13940 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2020-01-23 17:34:01 +00:00
parent 63cb1bd86f
commit 7f913eefe8
5 changed files with 9 additions and 2 deletions

View file

@ -76,3 +76,5 @@ DONE:
- WithDropChoice ch issue (again...)
- Problem with multibutton is back again
- Redmond scrollbars width
- Improve focus visuals

View file

@ -458,6 +458,7 @@ void ChStdSkin()
for(int pass = 0; pass < 2; pass++) {
Button::Style& s = pass ? Button::StyleOk().Write() : Button::StyleNormal().Write();
int roundness = DPI(3);
s.focusmargin = DPI(4);
for(int i = 0; i < 4; i++) {
static int adj[] = { 10, 80, -5, -10 };
Color f = Adjust(SColorFace(), adj[i]);

View file

@ -307,6 +307,7 @@ void ChHostSkin()
Image button[4];
for(int pass = 0; pass < 2; pass++) {
Button::Style& s = pass ? Button::StyleOk().Write() : Button::StyleNormal().Write();
s.focusmargin = DPI(4);
for(int i = 0; i < 4; i++) {
Gtk_State(i);
s.look[i] = Hot3(CairoImage());

View file

@ -395,11 +395,11 @@ void DrawFocus(Draw& w, int x, int y, int cx, int cy, Color c) {
w.Clipoff(x, y, cx, cy);
for(int a = 0; a < cx; a += CtrlImg::focus_h().GetWidth()) {
w.DrawImage(a, 0, CtrlImg::focus_h(), c);
w.DrawImage(a, cy - 1, CtrlImg::focus_h(), c);
w.DrawImage(a, cy - DPI(1), CtrlImg::focus_h(), c);
}
for(int a = 0; a < cy; a += CtrlImg::focus_v().GetHeight()) {
w.DrawImage(0, a, CtrlImg::focus_v(), c);
w.DrawImage(cx - 1, a, CtrlImg::focus_v(), c);
w.DrawImage(cx - DPI(1), a, CtrlImg::focus_v(), c);
}
w.End();
}

View file

@ -373,6 +373,7 @@ Rect MultiButton::Paint0(Draw& w, bool getcr)
if(HasFocus()) {
fpaper = SColorHighlight();
text = SColorHighlightText();
hotpressed = true;
}
else
fpaper = IsEnabled() && IsEditable() ? SColorPaper() : SColorFace();
@ -386,6 +387,8 @@ Rect MultiButton::Paint0(Draw& w, bool getcr)
}
ChPaint(w, sz, style->edge[style->activeedge ? mst : 0]);
Color p = paper;
if(frm && style->activeedge && HasFocus())
p = SColorHighlight();
if(hotpressed && (WhenPush || WhenClick))
p = Nvl(fpaper, paper);
if(!IsNull(p) && !IsNull(style->coloredge))