summaryrefslogtreecommitdiff
path: root/gui/win32/defstyle.inc
blob: 41c36f5fd71461100ffcd74f35f9fdb913e7d463 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
    fpGUI  -  Free Pascal GUI Library
    
    Basic Style implementation for Win32
    
    Copyright (C) 2006 - 2007 See the file AUTHORS.txt, included in this
    distribution, for details of the copyright.

    See the file COPYING.modifiedLGPL, included in this distribution,
    for details about redistributing fpGUI.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
}

{$DEFINE Has_DefaultStyle_GetGUIColor}

function TBasicStyle.GetGUIColor(Color: TColor): TGfxColor;
begin
  Color := Windows.GetSysColor(Color and $ffff);
  Result.Red := (Color and $ff) * 257;
  Result.Green := ((Color shr 8) and $ff) * 257;
  Result.Blue := ((Color shr 16) and $ff) * 257;
  Result.Alpha := 0;
end;


{$DEFINE Has_DefaultStyle_DrawFocusRect}

procedure TBasicStyle.DrawFocusRect(Canvas: TFCanvas; const ARect: TRect);
var
  Rect: Windows.TRect;
begin
  if Canvas.InheritsFrom(TGDICanvas) then
  begin
    Rect := RectToWinRect(Canvas.Transform(ARect));
    Windows.DrawFocusRect(TGDICanvas(Canvas).Handle, Rect)
  end
  else
  begin
    Canvas.SetColor(GetGUIColor(clGray));
    Canvas.DrawRect(ARect);
  end;
end;