From c0dba90406367be3f5b6960f234f7d8d7131c03d Mon Sep 17 00:00:00 2001 From: cxl Date: Sat, 7 Feb 2009 22:40:10 +0000 Subject: [PATCH] SColorLabel git-svn-id: svn://ultimatepp.org/upp/trunk@843 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlLib/Button.cpp | 2 +- uppsrc/CtrlLib/ChGtk.cpp | 18 ++++++++++++---- uppsrc/CtrlLib/LabelBase.cpp | 2 +- uppsrc/CtrlLib/SSettings.cpp | 42 ++++++++++++++++++++++++++++++++++++ uppsrc/CtrlLib/Switch.cpp | 2 +- uppsrc/Draw/Draw.h | 2 ++ uppsrc/Draw/SSettings.cpp | 1 + 7 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 uppsrc/CtrlLib/SSettings.cpp diff --git a/uppsrc/CtrlLib/Button.cpp b/uppsrc/CtrlLib/Button.cpp index 8ede4c18a..6af9e0bf9 100644 --- a/uppsrc/CtrlLib/Button.cpp +++ b/uppsrc/CtrlLib/Button.cpp @@ -567,7 +567,7 @@ void Option::Paint(Draw& w) { if(showlabel) { bool ds = !IsShowEnabled(); DrawSmartText(w, isz.cx + 4, ty, tsz.cx, label, font, - ds || IsReadOnly() ? SColorDisabled : SColorText, + ds || IsReadOnly() ? SColorDisabled : SColorLabel, //////// VisibleAccessKeys() ? accesskey : 0); if(HasFocus()) DrawFocus(w, RectC(isz.cx + 2, ty - 1, tsz.cx + 3, tsz.cy + 2) & sz); diff --git a/uppsrc/CtrlLib/ChGtk.cpp b/uppsrc/CtrlLib/ChGtk.cpp index 8080e863d..08a0a4c83 100644 --- a/uppsrc/CtrlLib/ChGtk.cpp +++ b/uppsrc/CtrlLib/ChGtk.cpp @@ -600,6 +600,14 @@ void ChHostSkin() for(int i = 0; i < __countof(col); i++) (*col[i].set)(ChGtkColor(col[i].ii, gtk__parent())); + //////// + GtkWidget *label = gtk_label_new("Ch"); + Setup(label); + Color ch_ink = ChGtkColor(0, label); + gtk_widget_destroy(label); + SColorLabel_Write(ch_ink); + + /////// CtrlsImg::Reset(); ColoredOverride(CtrlsImg::Iml(), CtrlsImg::Iml()); @@ -1059,11 +1067,13 @@ void ChHostSkin() GTK_WIDGET_FLAGS (w) &= GTK_SENSITIVE; if(i == 0) { img = GetGTK(w, GTK_STATE_NORMAL, GTK_SHADOW_IN, "entry", GTK_SHADOW, 20, 20); - efm = minmax(ImageMarginV(img, 4, 0), 1, 5); + efm = max(ImageMargin(img, 4, 0), 1); } - s.edge[i] = WithHotSpot(GetGTK(w, GTK_STATE_NORMAL, GTK_SHADOW_IN, - "entry", GTK_SHADOW, 2 * efm + 5, 2 * efm + 5), efm, efm); - LOGPNG(s.edge[i]); + img = GetGTK(w, GTK_STATE_NORMAL, GTK_SHADOW_IN, + "entry", GTK_SHADOW, 2 * efm + 3, 2 * efm + 3); + ImageBuffer eb(img); + eb.SetHotSpot(Point(efm, efm)); + s.edge[i] = Image(eb); s.activeedge = true; gtk_widget_destroy(w); } diff --git a/uppsrc/CtrlLib/LabelBase.cpp b/uppsrc/CtrlLib/LabelBase.cpp index d1c023e59..54a1014b6 100644 --- a/uppsrc/CtrlLib/LabelBase.cpp +++ b/uppsrc/CtrlLib/LabelBase.cpp @@ -240,7 +240,7 @@ Size DrawLabel::Paint(Draw& w, const Rect& r, bool visibleaccesskey) const p.y = (r.bottom + r.top - txtsz.cy) / 2; Color color = ink; if(IsNull(color)) - color = disabled ? SColorDisabled : SColorText; + color = disabled ? SColorDisabled : SColorLabel; ///////// int ix; if(IsNull(lspc)) ix = r.left + push; diff --git a/uppsrc/CtrlLib/SSettings.cpp b/uppsrc/CtrlLib/SSettings.cpp new file mode 100644 index 000000000..4bc8889ee --- /dev/null +++ b/uppsrc/CtrlLib/SSettings.cpp @@ -0,0 +1,42 @@ +#include "Draw.h" + +NAMESPACE_UPP + +CH_COLOR(SBlack, Black()); +CH_COLOR(SGray, Gray()); +CH_COLOR(SLtGray, LtGray()); +CH_COLOR(SWhiteGray, WhiteGray()); +CH_COLOR(SWhite, White()); +CH_COLOR(SRed, Red()); +CH_COLOR(SGreen, Green()); +CH_COLOR(SBrown, Brown()); +CH_COLOR(SBlue, Blue()); +CH_COLOR(SMagenta, Magenta()); +CH_COLOR(SCyan, Cyan()); +CH_COLOR(SYellow, Yellow()); +CH_COLOR(SLtRed, LtRed()); +CH_COLOR(SLtGreen, LtGreen()); +CH_COLOR(SLtYellow, LtYellow()); +CH_COLOR(SLtBlue, LtBlue()); +CH_COLOR(SLtMagenta, LtMagenta()); +CH_COLOR(SLtCyan, LtCyan()); + +CH_COLOR(SColorPaper, White()); +CH_COLOR(SColorFace, LtGray()); +CH_COLOR(SColorText, Black()); +CH_COLOR(SColorHighlight, Blue()); +CH_COLOR(SColorHighlightText, White()); +CH_COLOR(SColorMenu, LtGray()); +CH_COLOR(SColorMenuText, Black()); +CH_COLOR(SColorInfo, LtYellow()); +CH_COLOR(SColorInfoText, Black()); +CH_COLOR(SColorDisabled, Gray()); +CH_COLOR(SColorLight, White()); +CH_COLOR(SColorShadow, Gray()); +CH_COLOR(SColorMark, LtBlue()); +CH_COLOR(SColorLabel, Black()); ////////////// + +CH_COLOR(SColorLtFace, Blend(SColorFace, SColorLight)); +CH_COLOR(SColorDkShadow, Blend(SColorShadow, SColorText)); + +END_UPP_NAMESPACE diff --git a/uppsrc/CtrlLib/Switch.cpp b/uppsrc/CtrlLib/Switch.cpp index b41199f23..4797f7085 100644 --- a/uppsrc/CtrlLib/Switch.cpp +++ b/uppsrc/CtrlLib/Switch.cpp @@ -187,7 +187,7 @@ void Switch::Paint(Draw& w) { img = CtrlsImg::Get((v.value == value ? CtrlsImg::I_S1 : CtrlsImg::I_S0) + q); w.DrawImage(x, y + iy, img); DrawSmartText(w, x + isz.cx + 4, y + ty, sz.cx, v.label, font, - dv || IsReadOnly() ? SColorDisabled : SColorText, + dv || IsReadOnly() ? SColorDisabled : SColorLabel, /////// VisibleAccessKeys() ? v.accesskey : 0); if(HasFocus() && (pushindex == i || v.value == value && pushindex < 0)) DrawFocus(w, RectC(x + isz.cx + 2, y + ty - 1, tsz.cx + 3, tsz.cy + 2) & sz); diff --git a/uppsrc/Draw/Draw.h b/uppsrc/Draw/Draw.h index 045e32b8d..ccef906f4 100644 --- a/uppsrc/Draw/Draw.h +++ b/uppsrc/Draw/Draw.h @@ -429,6 +429,7 @@ Color SColorMark(); Color SColorDisabled(); Color SColorLight(); Color SColorFace(); +Color SColorLabel(); Color SColorShadow(); Color SColorLtFace(); @@ -466,6 +467,7 @@ void SColorMark_Write(Color c); void SColorDisabled_Write(Color c); void SColorLight_Write(Color c); void SColorFace_Write(Color c); +void SColorLabel_Write(Color c); void SColorShadow_Write(Color c); void SColorLtFace_Write(Color c); diff --git a/uppsrc/Draw/SSettings.cpp b/uppsrc/Draw/SSettings.cpp index 2e58e6e34..6ffd4eae2 100644 --- a/uppsrc/Draw/SSettings.cpp +++ b/uppsrc/Draw/SSettings.cpp @@ -37,5 +37,6 @@ CH_COLOR(SColorMark, LtBlue()); CH_COLOR(SColorLtFace, Blend(SColorFace, SColorLight)); CH_COLOR(SColorDkShadow, Blend(SColorShadow, SColorText)); +CH_COLOR(SColorLabel, SColorText()); END_UPP_NAMESPACE