diff --git a/lcl/interfaces/customdrawn/customdrawnint.pas b/lcl/interfaces/customdrawn/customdrawnint.pas index 1d7318703c..3ab3f2348d 100644 --- a/lcl/interfaces/customdrawn/customdrawnint.pas +++ b/lcl/interfaces/customdrawn/customdrawnint.pas @@ -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 diff --git a/lcl/interfaces/customdrawn/customdrawnobject.inc b/lcl/interfaces/customdrawn/customdrawnobject.inc index b878bc2e76..40349cc14d 100644 --- a/lcl/interfaces/customdrawn/customdrawnobject.inc +++ b/lcl/interfaces/customdrawn/customdrawnobject.inc @@ -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; {------------------------------------------------------------------------------ diff --git a/lcl/interfaces/customdrawn/customdrawnwinapi.inc b/lcl/interfaces/customdrawn/customdrawnwinapi.inc index f955d9f429..49d9746d07 100644 --- a/lcl/interfaces/customdrawn/customdrawnwinapi.inc +++ b/lcl/interfaces/customdrawn/customdrawnwinapi.inc @@ -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 diff --git a/lcl/interfaces/customdrawn/customdrawnwinapih.inc b/lcl/interfaces/customdrawn/customdrawnwinapih.inc index ef2d0d5055..9817c29f46 100644 --- a/lcl/interfaces/customdrawn/customdrawnwinapih.inc +++ b/lcl/interfaces/customdrawn/customdrawnwinapih.inc @@ -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;