mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 16:42:06 +02:00
wince: implement clDefault support
git-svn-id: trunk@28143 -
This commit is contained in:
parent
8c8ff0c25a
commit
f488863f7b
@ -191,6 +191,7 @@ Var
|
|||||||
WindowInfo: PWindowInfo;
|
WindowInfo: PWindowInfo;
|
||||||
Flags: dword;
|
Flags: dword;
|
||||||
ChildWindowInfo: PWindowInfo;
|
ChildWindowInfo: PWindowInfo;
|
||||||
|
WindowColor: Integer;
|
||||||
|
|
||||||
LMScroll: TLMScroll; // used by WM_HSCROLL
|
LMScroll: TLMScroll; // used by WM_HSCROLL
|
||||||
LMKey: TLMKey; // used by WM_KEYDOWN WM_KEYUP
|
LMKey: TLMKey; // used by WM_KEYDOWN WM_KEYUP
|
||||||
@ -1299,7 +1300,10 @@ begin
|
|||||||
if ChildWinControl <> nil then
|
if ChildWinControl <> nil then
|
||||||
begin
|
begin
|
||||||
Windows.SetTextColor(HDC(WParam), Windows.COLORREF(ColorToRGB(ChildWinControl.Font.Color)));
|
Windows.SetTextColor(HDC(WParam), Windows.COLORREF(ColorToRGB(ChildWinControl.Font.Color)));
|
||||||
Windows.SetBkColor(HDC(WParam), Windows.COLORREF(ColorToRGB(ChildWinControl.Brush.Color)));
|
WindowColor := ChildWinControl.Brush.Color;
|
||||||
|
if WindowColor = clDefault then
|
||||||
|
WindowColor := TWSWinControlClass(ChildWinControl.WidgetSetClass).GetDefaultColor(ChildWinControl);
|
||||||
|
Windows.SetBkColor(WindowDC, Windows.COLORREF(ColorToRGB(WindowColor)));
|
||||||
LMessage.Result := LResult(ChildWinControl.Brush.Reference.Handle);
|
LMessage.Result := LResult(ChildWinControl.Brush.Reference.Handle);
|
||||||
//DebugLn(['WindowProc ', ChildWinControl.Name, ' Brush: ', LMessage.Result]);
|
//DebugLn(['WindowProc ', ChildWinControl.Name, ' Brush: ', LMessage.Result]);
|
||||||
// Override default handling
|
// Override default handling
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* *
|
* *
|
||||||
* This file is part of the Lazarus Component Library (LCL) *
|
* This file is part of the Lazarus Component Library (LCL) *
|
||||||
* *
|
* *
|
||||||
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
|
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
|
||||||
* for details about the copyright. *
|
* for details about the copyright. *
|
||||||
* *
|
* *
|
||||||
* This program is distributed in the hope that it will be useful, *
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
@ -179,23 +179,19 @@ var
|
|||||||
Brush: HBRUSH;
|
Brush: HBRUSH;
|
||||||
Rect: Windows.Rect;
|
Rect: Windows.Rect;
|
||||||
Details: TThemedElementDetails;
|
Details: TThemedElementDetails;
|
||||||
OldColor, OldBackColor: COLORREF;
|
OldColor: COLORREF;
|
||||||
|
OldBkMode: Integer;
|
||||||
WideBuffer: widestring;
|
WideBuffer: widestring;
|
||||||
begin
|
begin
|
||||||
Selected := (Data^.itemState AND ODS_SELECTED)>0;
|
Selected := (Data^.itemState AND ODS_SELECTED)>0;
|
||||||
Enabled := CheckListBox.Enabled;
|
Enabled := CheckListBox.Enabled;
|
||||||
|
|
||||||
{ fill the background }
|
{ fill the background }
|
||||||
if Selected then
|
|
||||||
lgBrush.lbColor := LCLIntf.GetSysColor(COLOR_HIGHLIGHT) // $00D39137
|
|
||||||
else
|
|
||||||
// if default COLOR_WINDOW: $00FFFFFF
|
|
||||||
lgBrush.lbColor := ColorToRGB(CheckListBox.Color);
|
|
||||||
lgBrush.lbStyle := BS_SOLID;
|
|
||||||
Brush := CreateBrushIndirect(lgBrush);
|
|
||||||
Rect := Data^.rcItem;
|
Rect := Data^.rcItem;
|
||||||
Windows.FillRect(Data^._HDC, Rect, Brush);
|
if Selected then
|
||||||
DeleteObject(Brush);
|
Windows.FillRect(Data^._HDC, Rect, GetSysColorBrush(COLOR_HIGHLIGHT))
|
||||||
|
else
|
||||||
|
Windows.FillRect(Data^._HDC, Rect, CheckListBox.Brush.Reference.Handle);
|
||||||
|
|
||||||
// draw checkbox
|
// draw checkbox
|
||||||
InflateRect(Rect, -1, -1);
|
InflateRect(Rect, -1, -1);
|
||||||
@ -218,7 +214,7 @@ var
|
|||||||
because the LCLIntf version makes sure that SYS_COLOR_INDEX_FLAG
|
because the LCLIntf version makes sure that SYS_COLOR_INDEX_FLAG
|
||||||
is added to the constant.
|
is added to the constant.
|
||||||
}
|
}
|
||||||
OldBackColor := Windows.SetBkColor(Data^._HDC, lgBrush.lbColor);
|
OldBkMode := Windows.SetBkMode(Data^._HDC, TRANSPARENT);
|
||||||
|
|
||||||
if not Enabled then
|
if not Enabled then
|
||||||
OldColor := Windows.SetTextColor(Data^._HDC, LCLIntf.GetSysColor(COLOR_GRAYTEXT)) // $00BFBFBF
|
OldColor := Windows.SetTextColor(Data^._HDC, LCLIntf.GetSysColor(COLOR_GRAYTEXT)) // $00BFBFBF
|
||||||
@ -233,7 +229,7 @@ var
|
|||||||
|
|
||||||
// Return to default text and background colors
|
// Return to default text and background colors
|
||||||
Windows.SetTextColor(Data^._HDC, OldColor);
|
Windows.SetTextColor(Data^._HDC, OldColor);
|
||||||
Windows.SetBkColor(Data^._HDC, OldBackColor);
|
Windows.SetBkMode(Data^._HDC, OldBkMode);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -2833,7 +2829,6 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TWinCEWidgetSet.SetBkMode(DC: HDC; BkMode: Integer): Integer;
|
function TWinCEWidgetSet.SetBkMode(DC: HDC; BkMode: Integer): Integer;
|
||||||
begin
|
begin
|
||||||
// Your code here
|
|
||||||
Result := Windows.SetBkMode(DC, BkMode);
|
Result := Windows.SetBkMode(DC, BkMode);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -724,11 +724,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TWinCEWSCustomListView.SetColor(const AWinControl: TWinControl);
|
class procedure TWinCEWSCustomListView.SetColor(const AWinControl: TWinControl);
|
||||||
|
var
|
||||||
|
Color: TColor;
|
||||||
begin
|
begin
|
||||||
if not WSCheckHandleAllocated(AWinControl, 'TWin32WSCustomListView.SetColor') then
|
if not WSCheckHandleAllocated(AWinControl, 'TWin32WSCustomListView.SetColor') then
|
||||||
Exit;
|
Exit;
|
||||||
Windows.SendMessage(AWinControl.Handle, LVM_SETBKCOLOR, 0, ColorToRGB(AWinControl.Color));
|
Color := AWinControl.Color;
|
||||||
Windows.SendMessage(AWinControl.Handle, LVM_SETTEXTBKCOLOR, 0, ColorToRGB(AWinControl.Color));
|
if Color = clDefault then
|
||||||
|
Color := TWSWinControlClass(AWinControl.WidgetSetClass).GetDefaultColor(AWinControl);
|
||||||
|
Windows.SendMessage(AWinControl.Handle, LVM_SETBKCOLOR, 0, ColorToRGB(Color));
|
||||||
|
Windows.SendMessage(AWinControl.Handle, LVM_SETTEXTBKCOLOR, 0, ColorToRGB(Color));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TWinCEWSCustomListView.SetDefaultItemHeight(const ALV: TCustomListView; const AValue: Integer);
|
class procedure TWinCEWSCustomListView.SetDefaultItemHeight(const ALV: TCustomListView; const AValue: Integer);
|
||||||
|
Loading…
Reference in New Issue
Block a user