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;
LuxiFont: Boolean;
{$endif}
//
// Stock objects
FStockBlackBrush: TFPCustomBrush;
FStockDKGrayBrush: TFPCustomBrush;
FStockGrayBrush: TFPCustomBrush;
FStockLtGrayBrush: TFPCustomBrush;
FStockNullBrush: TFPCustomBrush;
FStockWhiteBrush: TFPCustomBrush;
FStockBlackPen: TFPCustomPen;
FStockNullPen: TFPCustomPen;
FStockWhitePen: TFPCustomPen;
DefaultFontSize: Integer;
FDefaultGUIFont: TFPCustomFont;
//
AccumulatedStr: string;
// The currently focused control

View File

@ -87,6 +87,29 @@ begin
// if it's the first time, we must create the list
if FFontPaths.Count = 0 then BackendListFontPaths(FFontPaths, FFontList);
{$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;
{------------------------------------------------------------------------------

View File

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

View File

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