From eb1d0abb534d5c846092913cb44998dec2efefc1 Mon Sep 17 00:00:00 2001 From: zeljko Date: Wed, 24 May 2017 20:38:53 +0000 Subject: [PATCH] gtk3: initialize syscolors git-svn-id: trunk@55076 - --- lcl/interfaces/gtk3/gtk3procs.pas | 28 ++++++++++++++++++++++++++++ lcl/interfaces/gtk3/gtk3winapi.inc | 25 ++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/lcl/interfaces/gtk3/gtk3procs.pas b/lcl/interfaces/gtk3/gtk3procs.pas index 26cc69bd07..9b676a0d7b 100644 --- a/lcl/interfaces/gtk3/gtk3procs.pas +++ b/lcl/interfaces/gtk3/gtk3procs.pas @@ -1013,6 +1013,31 @@ begin StyleObject^.Widget := TGtkFixed.new; lgs := lgsFrame; end else + if CompareText(WName, LazGtkStyleNames[lgsVerticalScrollbar]) = 0 then + begin + StyleObject^.Widget := TGtkScrollbar.new(GTK_ORIENTATION_VERTICAL, nil); + lgs := lgsVerticalScrollbar; + end else + if CompareText(WName, LazGtkStyleNames[lgsHorizontalScrollbar]) = 0 then + begin + StyleObject^.Widget := TGtkScrollbar.new(GTK_ORIENTATION_HORIZONTAL, nil); + lgs := lgsHorizontalScrollbar; + end else + if CompareText(WName, LazGtkStyleNames[lgsMenuBar]) = 0 then + begin + StyleObject^.Widget := TGtkMenuBar.new; + lgs := lgsMenuBar; + end else + if CompareText(WName, LazGtkStyleNames[lgsMenu]) = 0 then + begin + StyleObject^.Widget := TGtkMenu.new; + lgs := lgsMenu; + end else + if CompareText(WName, LazGtkStyleNames[lgsMenuitem]) = 0 then + begin + StyleObject^.Widget := TGtkMenuItem.new; + lgs := lgsMenuItem; + end else begin end; if Gtk3IsWidget(StyleObject^.Widget) then @@ -1028,6 +1053,9 @@ begin //TODO: copy stuff from gtk2proc UpdateSysColorMap(StyleObject^.Widget, lgs); Result := StyleObject^.Widget; + end else + begin + // DebugLn('BUG: GetStyleWithName() created style is not GtkWidget ',WName); end; end; end; diff --git a/lcl/interfaces/gtk3/gtk3winapi.inc b/lcl/interfaces/gtk3/gtk3winapi.inc index 6b21a2528d..ee1be33ed9 100644 --- a/lcl/interfaces/gtk3/gtk3winapi.inc +++ b/lcl/interfaces/gtk3/gtk3winapi.inc @@ -2469,6 +2469,28 @@ begin {$IFDEF GTK3DEBUGNOTIMPLEMENTED} writeln('TGtk3WidgetSet.GetSysColor WARNING: SOME SYSCOLORS ARE STILL HARDCODED nIndex=',nIndex); {$ENDIF} + if (nIndex = COLOR_WINDOW) or (nIndex = COLOR_WINDOWTEXT) or + (nIndex = COLOR_HIGHLIGHT) or (nIndex = COLOR_HIGHLIGHTTEXT) then + GetStyleWidget(lgsMemo) + else + if (nIndex = COLOR_MENU) or (nIndex = COLOR_MENUHILIGHT) or + (nIndex = COLOR_MENUTEXT) then + begin + GetStyleWidget(lgsMenu); + GetStyleWidget(lgsMenuitem); + end else + if (nIndex = COLOR_MENUBAR) then + GetStyleWidget(lgsMenuBar) + else + if (nIndex = COLOR_SCROLLBAR) then + GetStyleWidget(lgsVerticalScrollbar) + else + if (nIndex = COLOR_BTNFACE) or (nIndex = COLOR_BTNTEXT) or + (nIndex = COLOR_BTNSHADOW) or (nIndex = COLOR_BTNHIGHLIGHT) then + GetStyleWidget(lgsButton) + else + if (nIndex = COLOR_BACKGROUND) or (nIndex = COLOR_FORM) then + GetStyleWidget(lgsWindow); Result := SysColorMap[nIndex]; end; @@ -2483,9 +2505,10 @@ begin Result := FSysColorBrushes[nIndex]; if Result = HBRUSH(-1) then begin - DebugLn('WARNING: GetSysColorBrush SysColorBrushes arent''t initialized properly....'); InitSysColorBrushes; Result := FSysColorBrushes[nIndex]; + if Result = HBRUSH(-1) then + DebugLn('WARNING: GetSysColorBrush SysColorBrushes arent''t initialized properly....'); end; end; end;