wince: implement clDefault support

git-svn-id: trunk@28143 -
This commit is contained in:
paul 2010-11-08 03:17:48 +00:00
parent 8c8ff0c25a
commit f488863f7b
4 changed files with 21 additions and 17 deletions

View File

@ -191,6 +191,7 @@ Var
WindowInfo: PWindowInfo;
Flags: dword;
ChildWindowInfo: PWindowInfo;
WindowColor: Integer;
LMScroll: TLMScroll; // used by WM_HSCROLL
LMKey: TLMKey; // used by WM_KEYDOWN WM_KEYUP
@ -1299,7 +1300,10 @@ begin
if ChildWinControl <> nil then
begin
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);
//DebugLn(['WindowProc ', ChildWinControl.Name, ' Brush: ', LMessage.Result]);
// Override default handling

View File

@ -10,7 +10,7 @@
* *
* 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. *
* *
* This program is distributed in the hope that it will be useful, *

View File

@ -179,23 +179,19 @@ var
Brush: HBRUSH;
Rect: Windows.Rect;
Details: TThemedElementDetails;
OldColor, OldBackColor: COLORREF;
OldColor: COLORREF;
OldBkMode: Integer;
WideBuffer: widestring;
begin
Selected := (Data^.itemState AND ODS_SELECTED)>0;
Enabled := CheckListBox.Enabled;
{ 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;
Windows.FillRect(Data^._HDC, Rect, Brush);
DeleteObject(Brush);
if Selected then
Windows.FillRect(Data^._HDC, Rect, GetSysColorBrush(COLOR_HIGHLIGHT))
else
Windows.FillRect(Data^._HDC, Rect, CheckListBox.Brush.Reference.Handle);
// draw checkbox
InflateRect(Rect, -1, -1);
@ -218,7 +214,7 @@ var
because the LCLIntf version makes sure that SYS_COLOR_INDEX_FLAG
is added to the constant.
}
OldBackColor := Windows.SetBkColor(Data^._HDC, lgBrush.lbColor);
OldBkMode := Windows.SetBkMode(Data^._HDC, TRANSPARENT);
if not Enabled then
OldColor := Windows.SetTextColor(Data^._HDC, LCLIntf.GetSysColor(COLOR_GRAYTEXT)) // $00BFBFBF
@ -233,7 +229,7 @@ var
// Return to default text and background colors
Windows.SetTextColor(Data^._HDC, OldColor);
Windows.SetBkColor(Data^._HDC, OldBackColor);
Windows.SetBkMode(Data^._HDC, OldBkMode);
end;
begin
@ -2833,7 +2829,6 @@ end;
------------------------------------------------------------------------------}
function TWinCEWidgetSet.SetBkMode(DC: HDC; BkMode: Integer): Integer;
begin
// Your code here
Result := Windows.SetBkMode(DC, BkMode);
end;

View File

@ -724,11 +724,16 @@ begin
end;
class procedure TWinCEWSCustomListView.SetColor(const AWinControl: TWinControl);
var
Color: TColor;
begin
if not WSCheckHandleAllocated(AWinControl, 'TWin32WSCustomListView.SetColor') then
Exit;
Windows.SendMessage(AWinControl.Handle, LVM_SETBKCOLOR, 0, ColorToRGB(AWinControl.Color));
Windows.SendMessage(AWinControl.Handle, LVM_SETTEXTBKCOLOR, 0, ColorToRGB(AWinControl.Color));
Color := 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;
class procedure TWinCEWSCustomListView.SetDefaultItemHeight(const ALV: TCustomListView; const AValue: Integer);