From e155bfca395a4639de703ed6942056aa342c33bc Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Fri, 7 Dec 2012 15:55:54 +0000 Subject: [PATCH] Reimplements the cdintf control special case as a LCLIntf function, to be more conformant to the way of working for the LCL git-svn-id: trunk@39475 - --- lcl/controls.pp | 2 -- lcl/include/intfbaselcl.inc | 5 +++++ lcl/include/lclintf.inc | 5 +++++ lcl/include/lclintfh.inc | 1 + lcl/include/wincontrol.inc | 2 +- lcl/interfaces/customdrawn/customdrawnlclintf.inc | 5 +++++ lcl/interfaces/customdrawn/customdrawnlclintfh.inc | 1 + lcl/interfaces/customdrawn/customdrawnprivate.pas | 10 +++++++--- lcl/interfaces/customdrawn/customdrawnwscomctrls.pas | 3 --- lcl/interfaces/customdrawn/customdrawnwsstdctrls.pas | 8 -------- 10 files changed, 25 insertions(+), 17 deletions(-) diff --git a/lcl/controls.pp b/lcl/controls.pp index 21a40537f3..eb1899ed72 100644 --- a/lcl/controls.pp +++ b/lcl/controls.pp @@ -1899,7 +1899,6 @@ type FDoubleBuffered: Boolean; FDockSite: Boolean; FUseDockManager: Boolean; - FIsCDIntfControl: Boolean; procedure AlignControl(AControl: TControl); function GetBrush: TBrush; function GetControl(const Index: Integer): TControl; @@ -2108,7 +2107,6 @@ type property DoubleBuffered: Boolean read FDoubleBuffered write FDoubleBuffered default False; property Handle: HWND read GetHandle write SetHandle; property IsResizing: Boolean read GetIsResizing; - property IsCDIntfControl: Boolean read FIsCDIntfControl write FIsCDIntfControl default False; property TabOrder: TTabOrder read GetTabOrder write SetTaborder default -1; property TabStop: Boolean read FTabStop write SetTabStop default false; property OnAlignInsertBefore: TAlignInsertBeforeEvent read FOnAlignInsertBefore write FOnAlignInsertBefore; diff --git a/lcl/include/intfbaselcl.inc b/lcl/include/intfbaselcl.inc index a9ab173b96..f1ca1f6419 100644 --- a/lcl/include/intfbaselcl.inc +++ b/lcl/include/intfbaselcl.inc @@ -524,6 +524,11 @@ begin // But Forms is not in the uses clause end; +function TWidgetSet.IsCDIntfControl(AWinControl: TObject): Boolean; +begin + Result := False; +end; + function TWidgetSet.MoveWindowOrgEx(dc: hdc; dX,dY: Integer): boolean; var P: TPoint; diff --git a/lcl/include/lclintf.inc b/lcl/include/lclintf.inc index e83c2a2cc9..5538d70d0d 100644 --- a/lcl/include/lclintf.inc +++ b/lcl/include/lclintf.inc @@ -356,6 +356,11 @@ begin Result := WidgetSet.IsMobilePlatform(); end; +function IsCDIntfControl(AWinControl: TObject): Boolean; +begin + Result := WidgetSet.IsCDIntfControl(AWinControl); +end; + function MoveWindowOrgEx(dc: hdc; dX,dY: Integer): boolean; begin Result := WidgetSet.MoveWindowOrgEx(DC, dX, dY); diff --git a/lcl/include/lclintfh.inc b/lcl/include/lclintfh.inc index 39054150a7..c2a019ff3c 100644 --- a/lcl/include/lclintfh.inc +++ b/lcl/include/lclintfh.inc @@ -93,6 +93,7 @@ function IntfSendsUTF8KeyPress: Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} function InvalidateFrame(aHandle : HWND; ARect : pRect; bErase : Boolean; BorderWidth: integer) : Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} function IsDesignerDC(WindowHandle: HWND; DC: HDC): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} function IsMobilePlatform: Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} +function IsCDIntfControl(AWinControl: TObject): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} function MoveWindowOrgEx(dc : hdc; dX,dY : Integer): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} diff --git a/lcl/include/wincontrol.inc b/lcl/include/wincontrol.inc index 2e1ca6335e..002973ea23 100644 --- a/lcl/include/wincontrol.inc +++ b/lcl/include/wincontrol.inc @@ -4601,7 +4601,7 @@ begin begin lWinControl := TWinControl(FTabList[I]); // The tab order list should exclude injected LCL-CustomDrawn controls - if lWinControl.CanFocus and (not lWinControl.IsCDIntfControl) then + if lWinControl.CanFocus and (not LCLIntf.IsCDIntfControl(lWinControl)) then List.Add(lWinControl); lWinControl.GetTabOrderList(List); end; diff --git a/lcl/interfaces/customdrawn/customdrawnlclintf.inc b/lcl/interfaces/customdrawn/customdrawnlclintf.inc index adccf40600..95a29563d9 100644 --- a/lcl/interfaces/customdrawn/customdrawnlclintf.inc +++ b/lcl/interfaces/customdrawn/customdrawnlclintf.inc @@ -317,6 +317,11 @@ begin Result := (ADC = HDC(Self.ScreenDC)); end; +function TCDWidgetSet.IsCDIntfControl(AWinControl: TObject): Boolean; +begin + Result := IsIntfControl(TWinControl(AWinControl)); +end; + function TCDWidgetSet.RadialPie(DC: HDC; x1, y1, x2, y2, Angle1, Angle2: Integer): Boolean; begin Result := IsValidDC(DC); diff --git a/lcl/interfaces/customdrawn/customdrawnlclintfh.inc b/lcl/interfaces/customdrawn/customdrawnlclintfh.inc index 13ea89608b..5b77636405 100644 --- a/lcl/interfaces/customdrawn/customdrawnlclintfh.inc +++ b/lcl/interfaces/customdrawn/customdrawnlclintfh.inc @@ -57,6 +57,7 @@ procedure HideVirtualKeyboard(); function IsDesignerDC(WindowHandle: HWND; DC: HDC): Boolean; override;*) function IsMobilePlatform: Boolean; override; function IsScreenDC(ADC: HDC): Boolean; +function IsCDIntfControl(AWinControl: TObject): Boolean; override; function PromptUser(const DialogCaption : string; const DialogMessage : string; diff --git a/lcl/interfaces/customdrawn/customdrawnprivate.pas b/lcl/interfaces/customdrawn/customdrawnprivate.pas index 7992420b5e..bcf33be060 100644 --- a/lcl/interfaces/customdrawn/customdrawnprivate.pas +++ b/lcl/interfaces/customdrawn/customdrawnprivate.pas @@ -312,15 +312,19 @@ end; function IsIntfControl(AControl: TWinControl): Boolean; begin - Result := (AControl <> nil) and (AControl.Parent <> nil) and AControl.IsCDIntfControl; - {if Result then Result := + Result := (AControl <> nil) and (AControl.Parent <> nil); + if Result then Result := // Standard Tab (AControl is TCDIntfButton) or (AControl is TCDIntfEdit) or (AControl is TCDIntfCheckBox) or + (AControl is TCDIntfRadioButton) or (AControl is TCDIntfComboBox) or (AControl is TCDIntfScrollBar) or // Additional Tab (AControl is TCDIntfStaticText) or // Common Controls Tab (AControl is TCDIntfProgressBar) or (AControl is TCDIntfTrackBar) or - (AControl is TCDIntfPageControl);} + (AControl is TCDIntfPageControl) or + // Common Controls Tab + (AControl is TCDIntfSpinEdit) + ; end; { TCDIntfEdit } diff --git a/lcl/interfaces/customdrawn/customdrawnwscomctrls.pas b/lcl/interfaces/customdrawn/customdrawnwscomctrls.pas index 3071170aaf..4f2dd8f153 100644 --- a/lcl/interfaces/customdrawn/customdrawnwscomctrls.pas +++ b/lcl/interfaces/customdrawn/customdrawnwscomctrls.pas @@ -290,7 +290,6 @@ begin TCDIntfPageControl(ACDControlField).LCLControl := TCustomTabControl(AWinControl); ACDControlField.Parent := AWinControl; ACDControlField.Align := alClient; - ACDControlField.IsCDIntfControl := True; {$ifdef VerboseCDInjectedControlNames}ACDControlField.Name := 'CustomDrawnInternal_' + AWinControl.Name;{$endif} end; @@ -428,7 +427,6 @@ begin TCDIntfTrackBar(ACDControlField).LCLControl := TCustomTrackBar(AWinControl); ACDControlField.Parent := AWinControl; ACDControlField.Align := alClient; - ACDControlField.IsCDIntfControl := True; {$ifdef VerboseCDInjectedControlNames}ACDControlField.Name := 'CustomDrawnInternal_' + AWinControl.Name;{$endif} end; @@ -569,7 +567,6 @@ begin TCDIntfProgressBar(ACDControlField).LCLControl := TCustomProgressBar(AWinControl); ACDControlField.Parent := AWinControl; ACDControlField.Align := alClient; - ACDControlField.IsCDIntfControl := True; {$ifdef VerboseCDInjectedControlNames}ACDControlField.Name := 'CustomDrawnInternal_' + AWinControl.Name;{$endif} end; diff --git a/lcl/interfaces/customdrawn/customdrawnwsstdctrls.pas b/lcl/interfaces/customdrawn/customdrawnwsstdctrls.pas index a6a8647ef3..46a926d25b 100644 --- a/lcl/interfaces/customdrawn/customdrawnwsstdctrls.pas +++ b/lcl/interfaces/customdrawn/customdrawnwsstdctrls.pas @@ -355,7 +355,6 @@ begin ACDControlField.Caption := AWinControl.Caption; ACDControlField.Parent := AWinControl; ACDControlField.Align := alClient; - ACDControlField.IsCDIntfControl := True; {$ifdef VerboseCDInjectedControlNames}ACDControlField.Name := 'CustomDrawnInternal_' + AWinControl.Name;{$endif} end; @@ -422,7 +421,6 @@ begin ACDControlField.Caption := AWinControl.Caption; ACDControlField.Parent := AWinControl; ACDControlField.Align := alClient; - ACDControlField.IsCDIntfControl := True; {$ifdef VerboseCDInjectedControlNames}ACDControlField.Name := 'CustomDrawnInternal_' + AWinControl.Name;{$endif} end; @@ -824,7 +822,6 @@ begin ACDControlField.Caption := AWinControl.Caption; ACDControlField.Parent := AWinControl; ACDControlField.Align := alClient; - ACDControlField.IsCDIntfControl := True; {$ifdef VerboseCDInjectedControlNames}ACDControlField.Name := 'CustomDrawnInternal_' + AWinControl.Name;{$endif} end; @@ -1308,7 +1305,6 @@ begin ACDControlField.Caption := AWinControl.Caption; ACDControlField.Parent := AWinControl; ACDControlField.Align := alClient; - ACDControlField.IsCDIntfControl := True; {$ifdef VerboseCDInjectedControlNames}ACDControlField.Name := 'CustomDrawnInternal_' + AWinControl.Name;{$endif} TCDIntfEdit(ACDControlField).ReadOnly := TCustomEdit(AWinControl).ReadOnly; end; @@ -1566,7 +1562,6 @@ begin ACDControlField.Parent := AWinControl; ACDControlField.Caption := AWinControl.Caption; ACDControlField.Align := alClient; - ACDControlField.IsCDIntfControl := True; {$ifdef VerboseCDInjectedControlNames}ACDControlField.Name := 'CustomDrawnInternal_' + AWinControl.Name;{$endif} end; @@ -1637,7 +1632,6 @@ begin ACDControlField.Caption := AWinControl.Caption; ACDControlField.Parent := AWinControl; ACDControlField.Align := alClient; - ACDControlField.IsCDIntfControl := True; {$ifdef VerboseCDInjectedControlNames}ACDControlField.Name := 'CustomDrawnInternal_' + AWinControl.Name;{$endif} end; @@ -1728,7 +1722,6 @@ begin ACDControlField.Parent := AWinControl; ACDControlField.Caption := AWinControl.Caption; ACDControlField.Align := alClient; - ACDControlField.IsCDIntfControl := True; {$ifdef VerboseCDInjectedControlNames}ACDControlField.Name := 'CustomDrawnInternal_' + AWinControl.Name;{$endif} end; @@ -1800,7 +1793,6 @@ begin ACDControlField.Parent := AWinControl; ACDControlField.Caption := AWinControl.Caption; ACDControlField.Align := alClient; - ACDControlField.IsCDIntfControl := True; {$ifdef VerboseCDInjectedControlNames}ACDControlField.Name := 'CustomDrawnInternal_' + AWinControl.Name;{$endif} end;