|
@@ -3,7 +3,7 @@
|
|
-------------------------------------------------------------------------
|
|
-------------------------------------------------------------------------
|
|
Windows dark style widgetset implementation
|
|
Windows dark style widgetset implementation
|
|
|
|
|
|
- Copyright (C) 2021-2022 Alexander Koblov ([email protected])
|
|
|
|
|
|
+ Copyright (C) 2021-2023 Alexander Koblov ([email protected])
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
modify it under the terms of the GNU Lesser General Public
|
|
@@ -70,6 +70,8 @@ type
|
|
published
|
|
published
|
|
class function CreateHandle(const AWinControl: TWinControl;
|
|
class function CreateHandle(const AWinControl: TWinControl;
|
|
const AParams: TCreateParams): HWND; override;
|
|
const AParams: TCreateParams): HWND; override;
|
|
|
|
+ class function GetDefaultColor(const AControl: TControl;
|
|
|
|
+ const ADefaultColorType: TDefaultColorType): TColor; override;
|
|
end;
|
|
end;
|
|
|
|
|
|
{ TWin32WSCustomMemoDark }
|
|
{ TWin32WSCustomMemoDark }
|
|
@@ -286,6 +288,30 @@ begin
|
|
SetMenuInfo(Menu, @MenuInfo);
|
|
SetMenuInfo(Menu, @MenuInfo);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+{
|
|
|
|
+ Set control colors
|
|
|
|
+}
|
|
|
|
+procedure SetControlColors(Control: TControl; Canvas: HDC);
|
|
|
|
+var
|
|
|
|
+ Color: TColor;
|
|
|
|
+begin
|
|
|
|
+ // Set background color
|
|
|
|
+ Color:= Control.Color;
|
|
|
|
+ if Color = clDefault then
|
|
|
|
+ begin
|
|
|
|
+ Color:= Control.GetDefaultColor(dctBrush);
|
|
|
|
+ end;
|
|
|
|
+ SetBkColor(Canvas, ColorToRGB(Color));
|
|
|
|
+
|
|
|
|
+ // Set text color
|
|
|
|
+ Color:= Control.Font.Color;
|
|
|
|
+ if Color = clDefault then
|
|
|
|
+ begin
|
|
|
|
+ Color:= Control.GetDefaultColor(dctFont);
|
|
|
|
+ end;
|
|
|
|
+ SetTextColor(Canvas, ColorToRGB(Color));
|
|
|
|
+end;
|
|
|
|
+
|
|
{ TWin32WSUpDownControlDark }
|
|
{ TWin32WSUpDownControlDark }
|
|
|
|
|
|
procedure DrawUpDownArrow(Window: HWND; Canvas: TCanvas; ARect: TRect; AType: TUDAlignButton);
|
|
procedure DrawUpDownArrow(Window: HWND; Canvas: TCanvas; ARect: TRect; AType: TUDAlignButton);
|
|
@@ -691,8 +717,7 @@ begin
|
|
begin
|
|
begin
|
|
ComboBox:= TCustomComboBox(GetWin32WindowInfo(Window)^.WinControl);
|
|
ComboBox:= TCustomComboBox(GetWin32WindowInfo(Window)^.WinControl);
|
|
DC:= HDC(wParam);
|
|
DC:= HDC(wParam);
|
|
- SetBkColor(DC, ComboBox.Color);
|
|
|
|
- SetTextColor(DC, ComboBox.Font.Color);
|
|
|
|
|
|
+ SetControlColors(ComboBox, DC);
|
|
Exit(LResult(ComboBox.Brush.Reference.Handle));
|
|
Exit(LResult(ComboBox.Brush.Reference.Handle));
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -718,6 +743,17 @@ begin
|
|
SetWindowSubclass(Result, @ComboBoxWindowProc, ID_SUB_COMBOBOX, 0);
|
|
SetWindowSubclass(Result, @ComboBoxWindowProc, ID_SUB_COMBOBOX, 0);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+class function TWin32WSCustomComboBoxDark.GetDefaultColor(
|
|
|
|
+ const AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor;
|
|
|
|
+const
|
|
|
|
+ DefColors: array[TDefaultColorType] of TColor = (
|
|
|
|
+ { dctBrush } clBtnFace,
|
|
|
|
+ { dctFont } clBtnText
|
|
|
|
+ );
|
|
|
|
+begin
|
|
|
|
+ Result:= DefColors[ADefaultColorType];
|
|
|
|
+end;
|
|
|
|
+
|
|
{ TWin32WSStatusBarDark }
|
|
{ TWin32WSStatusBarDark }
|
|
|
|
|
|
function StatusBarWndProc(Window: HWND; Msg: UINT; wParam: Windows.WPARAM; lParam: Windows.LPARAM; uISubClass: UINT_PTR; dwRefData: DWORD_PTR): LRESULT; stdcall;
|
|
function StatusBarWndProc(Window: HWND; Msg: UINT; wParam: Windows.WPARAM; lParam: Windows.LPARAM; uISubClass: UINT_PTR; dwRefData: DWORD_PTR): LRESULT; stdcall;
|