LCL-CustomDrawn: Starts implementing stock objects

git-svn-id: trunk@36609 -
This commit is contained in:
sekelsenmat 2012-04-06 14:07:00 +00:00
parent 8b863c792d
commit 8ef9333cd8
4 changed files with 56 additions and 35 deletions

View File

@ -207,8 +207,20 @@ type
LiberationFont: Boolean; LiberationFont: Boolean;
LuxiFont: Boolean; LuxiFont: Boolean;
{$endif} {$endif}
// // Stock objects
FStockBlackBrush: TFPCustomBrush;
FStockDKGrayBrush: TFPCustomBrush;
FStockGrayBrush: TFPCustomBrush;
FStockLtGrayBrush: TFPCustomBrush;
FStockNullBrush: TFPCustomBrush;
FStockWhiteBrush: TFPCustomBrush;
FStockBlackPen: TFPCustomPen;
FStockNullPen: TFPCustomPen;
FStockWhitePen: TFPCustomPen;
DefaultFontSize: Integer; DefaultFontSize: Integer;
FDefaultGUIFont: TFPCustomFont;
// //
AccumulatedStr: string; AccumulatedStr: string;
// The currently focused control // The currently focused control

View File

@ -87,6 +87,29 @@ begin
// if it's the first time, we must create the list // if it's the first time, we must create the list
if FFontPaths.Count = 0 then BackendListFontPaths(FFontPaths, FFontList); if FFontPaths.Count = 0 then BackendListFontPaths(FFontPaths, FFontList);
{$endif} {$endif}
// Init stock objects
FStockBlackBrush := TFPCustomBrush.Create;
FStockBlackBrush.FPColor := colBlack;
FStockDKGrayBrush := TFPCustomBrush.Create;
FStockDKGrayBrush.FPColor := colDkGray;
FStockGrayBrush := TFPCustomBrush.Create;
FStockGrayBrush.FPColor := colGray;
FStockLtGrayBrush := TFPCustomBrush.Create;
FStockLtGrayBrush.FPColor := colLtGray;
FStockNullBrush := TFPCustomBrush.Create;
FStockNullBrush.Style := bsClear;
FStockWhiteBrush := TFPCustomBrush.Create;
FStockWhiteBrush.FPColor := colWhite;
FStockBlackPen := TFPCustomPen.Create;
FStockBlackPen.FPColor := colBlack;
FStockNullPen := TFPCustomPen.Create;
FStockNullPen.Style := psClear;
FStockWhitePen := TFPCustomPen.Create;
FStockWhitePen.FPColor := colWhite;
FDefaultGUIFont := TFPCustomFont.Create;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------

View File

@ -3482,64 +3482,50 @@ begin
Result := True; Result := True;
end; end;
end; end;*)
function TQtWidgetSet.GetStockObject(Value: Integer): THandle; function TCDWidgetSet.GetStockObject(Value: Integer): THandle;
begin begin
{$ifdef VerboseQtWinAPI} {$ifdef VerboseCDWinAPI}
WriteLn('Trace:> [WinAPI GetStockObject] Value: ', Value); DebugLn(Format('Trace:> [WinAPI GetStockObject] Value: %d', [Value]));
{$endif} {$endif}
Result := 0; Result := 0;
case Value of case Value of
BLACK_BRUSH: // Black brush. BLACK_BRUSH: // Black brush.
Result := FStockBlackBrush; Result := THandle(FStockBlackBrush);
DKGRAY_BRUSH: // Dark gray brush. DKGRAY_BRUSH: // Dark gray brush.
Result := FStockDKGrayBrush; Result := THandle(FStockDKGrayBrush);
GRAY_BRUSH: // Gray brush. GRAY_BRUSH: // Gray brush.
Result := FStockGrayBrush; Result := THandle(FStockGrayBrush);
LTGRAY_BRUSH: // Light gray brush. LTGRAY_BRUSH: // Light gray brush.
Result := FStockLtGrayBrush; Result := THandle(FStockLtGrayBrush);
NULL_BRUSH: // Null brush (equivalent to HOLLOW_BRUSH). NULL_BRUSH: // Null brush (equivalent to HOLLOW_BRUSH).
Result := FStockNullBrush; Result := THandle(FStockNullBrush);
WHITE_BRUSH: // White brush. WHITE_BRUSH: // White brush.
Result := FStockWhiteBrush; Result := THandle(FStockWhiteBrush);
BLACK_PEN: // Black pen. BLACK_PEN: // Black pen.
Result := FStockBlackPen; Result := THandle(FStockBlackPen);
NULL_PEN: // Null pen. NULL_PEN: // Null pen.
Result := FStockNullPen; Result := THandle(FStockNullPen);
WHITE_PEN: // White pen. WHITE_PEN: // White pen.
Result := FStockWhitePen; Result := THandle(FStockWhitePen);
{System font. By default, Windows uses the system font to draw menus, {System font. By default, Windows uses the system font to draw menus,
dialog box controls, and text. In Windows versions 3.0 and later, dialog box controls, and text. In Windows versions 3.0 and later,
the system font is a proportionally spaced font; earlier versions of the system font is a proportionally spaced font; earlier versions of
Windows used a monospace system font.} Windows used a monospace system font.}
DEFAULT_GUI_FONT, SYSTEM_FONT: DEFAULT_GUI_FONT, SYSTEM_FONT:
begin Result := THandle(FDefaultGUIFont);
If FStockSystemFont <> 0 then {$ifdef VerboseCDWinAPI}
begin else
DeleteObject(FStockSystemFont); DebugLn(Format('[WinAPI GetStockObject] UNHANDLED Value: %d', [Value]));
FStockSystemFont := 0;
end;
If FStockSystemFont = 0 then
FStockSystemFont := CreateDefaultFont;
Result := FStockSystemFont;
end;
{$ifdef VerboseQtWinAPI}
else
WriteLn('[WinAPI GetStockObject] UNHANDLED Value: ', Value);
{$endif} {$endif}
end; end;
{$ifdef VerboseQtWinAPI} end;
WriteLn('Trace:< [WinAPI GetStockObject] Value: ', Value);
{$endif}
end;*)
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Function: TCDWidgetSet.GetSysColor Function: TCDWidgetSet.GetSysColor

View File

@ -133,8 +133,8 @@ function GetRgnBox(RGN : HRGN; lpRect : PRect) : Longint; override;
(*function GetROP2(DC: HDC): Integer; override; (*function GetROP2(DC: HDC): Integer; override;
function GetScrollBarSize(Handle: HWND; BarKind: Integer): integer; override; function GetScrollBarSize(Handle: HWND; BarKind: Integer): integer; override;
function GetScrollbarVisible(Handle: HWND; SBStyle: Integer): boolean; override; function GetScrollbarVisible(Handle: HWND; SBStyle: Integer): boolean; override;
function GetScrollInfo(Handle: HWND; BarFlag: Integer; Var ScrollInfo: TScrollInfo): Boolean; override; function GetScrollInfo(Handle: HWND; BarFlag: Integer; Var ScrollInfo: TScrollInfo): Boolean; override;*)
function GetStockObject(Value: Integer): THandle; override;*) function GetStockObject(Value: Integer): THandle; override;
function GetSysColor(nIndex: Integer): DWORD; override; function GetSysColor(nIndex: Integer): DWORD; override;
//function GetSysColorBrush(nIndex: Integer): HBrush; override; //function GetSysColorBrush(nIndex: Integer): HBrush; override;
function GetSystemMetrics(nIndex: Integer): Integer; override; function GetSystemMetrics(nIndex: Integer): Integer; override;