vclass removal: Fixes starting the IDE in gtk2

git-svn-id: trunk@55143 -
This commit is contained in:
sekelsenmat 2017-06-01 14:28:40 +00:00
parent a33e8c7b11
commit 892043c910
3 changed files with 25 additions and 14 deletions

View File

@ -272,7 +272,7 @@ begin
if TheWinControl<>nil then if TheWinControl<>nil then
begin begin
TheWinControl.CNPreferredSizeChanged; TheWinControl.CNPreferredSizeChanged;
TGtkPrivateWidgetClass(TheWinControl.WidgetSetClass.WSPrivate).UpdateCursor(WinWidgetInfo); GetGtkPrivate(TheWinControl).UpdateCursor(WinWidgetInfo);
ConnectInternalWidgetsSignals(MainWidget,TheWinControl); ConnectInternalWidgetsSignals(MainWidget,TheWinControl);
if (TheWinControl is TCustomPage) if (TheWinControl is TCustomPage)

View File

@ -770,19 +770,16 @@ begin
// simple // simple
Child := TWinControlHack(AChild); Child := TWinControlHack(AChild);
if ANewPos <= 0 then // bottom if ANewPos <= 0 then // bottom
TGtkPrivateWidgetClass( GetGtkPrivate(Child).SetZPosition(Child, wszpBack)
Child.WidgetSetClass.WSPrivate).SetZPosition(Child, wszpBack)
else else
TGtkPrivateWidgetClass( GetGtkPrivate(Child).SetZPosition(Child, wszpFront);
Child.WidgetSetClass.WSPrivate).SetZPosition(Child, wszpFront);
end else end else
begin begin
for n := 1 to AChildren.Count - 1 do for n := 1 to AChildren.Count - 1 do
begin begin
Child := TWinControlHack(AChildren[n]); Child := TWinControlHack(AChildren[n]);
if Child.HandleAllocated then if Child.HandleAllocated then
TGtkPrivateWidgetClass( GetGtkPrivate(Child).SetZPosition(Child, wszpBack);
Child.WidgetSetClass.WSPrivate).SetZPosition(Child, wszpBack);
end; end;
end; end;
end; end;
@ -798,7 +795,7 @@ begin
if WidgetInfo^.ControlCursor <> ACursor then if WidgetInfo^.ControlCursor <> ACursor then
begin begin
WidgetInfo^.ControlCursor := ACursor; WidgetInfo^.ControlCursor := ACursor;
TGtkPrivateWidgetClass(AWinControl.WidgetSetClass.WSPrivate).UpdateCursor(WidgetInfo); GetGtkPrivate(AWinControl).UpdateCursor(WidgetInfo);
end; end;
end; end;

View File

@ -40,10 +40,13 @@ type
{ TGtkPrivate } // GTK1WS Legacy! { TGtkPrivate } // GTK1WS Legacy!
{ Generic base class, don't know if it is needed } { Generic base class, don't know if it is needed }
TGtkPrivateClass = class of TGtkPrivate;
TGtkPrivate = class(TWSPrivate) TGtkPrivate = class(TWSPrivate)
private private
protected protected
public public
class procedure SetZPosition(const AWinControl: TWinControl; const APosition: TWSZPosition); virtual; abstract;
class procedure UpdateCursor(AInfo: PWidgetInfo); virtual; abstract;
end; end;
{ TGtkPrivateWidget } { TGtkPrivateWidget }
@ -53,8 +56,8 @@ type
private private
protected protected
public public
class procedure SetZPosition(const AWinControl: TWinControl; const APosition: TWSZPosition); virtual; class procedure SetZPosition(const AWinControl: TWinControl; const APosition: TWSZPosition); override;
class procedure UpdateCursor(AInfo: PWidgetInfo); virtual; class procedure UpdateCursor(AInfo: PWidgetInfo); override;
end; end;
TGtkPrivateWidgetClass = class of TGtkPrivateWidget; TGtkPrivateWidgetClass = class of TGtkPrivateWidget;
@ -164,7 +167,6 @@ type
{ TGtk2PrivateWidget } { TGtk2PrivateWidget }
{ Private class for gtkwidgets } { Private class for gtkwidgets }
TGtk2PrivateWidget = class(TGtkPrivateWidget) TGtk2PrivateWidget = class(TGtkPrivateWidget)
private private
protected protected
@ -204,7 +206,6 @@ type
{ TGtk2PrivateDialog } { TGtk2PrivateDialog }
{ Private class for gtkdialogs } { Private class for gtkdialogs }
TGtk2PrivateDialog = class(TGtkPrivateDialog) TGtk2PrivateDialog = class(TGtkPrivateDialog)
private private
protected protected
@ -214,7 +215,6 @@ type
{ TGtk2PrivateButton } { TGtk2PrivateButton }
{ Private class for gtkbuttons } { Private class for gtkbuttons }
TGtk2PrivateButton = class(TGtkPrivateButton) TGtk2PrivateButton = class(TGtkPrivateButton)
private private
protected protected
@ -257,15 +257,29 @@ procedure SetWindowCursor(AWindow: PGdkWindow; ACursor: HCursor;
procedure SetCursorForWindowsWithInfo(AWindow: PGdkWindow; AInfo: PWidgetInfo; procedure SetCursorForWindowsWithInfo(AWindow: PGdkWindow; AInfo: PWidgetInfo;
ASetDefault: Boolean); ASetDefault: Boolean);
procedure SetGlobalCursor(Cursor: HCURSOR); procedure SetGlobalCursor(Cursor: HCURSOR);
function GetGtkPrivate(AWinControl: TWinControl): TGtkPrivateClass;
implementation implementation
uses uses
Gtk2Extra; Gtk2Extra, buttons, stdctrls, comctrls;
{$I Gtk2PrivateWidget.inc} {$I Gtk2PrivateWidget.inc}
{$I Gtk2PrivateList.inc} {$I Gtk2PrivateList.inc}
function GetGtkPrivate(AWinControl: TWinControl): TGtkPrivateClass;
begin
if AWinControl is TScrollingWinControl then Exit(TGtkPrivateScrollingWinControl);
if AWinControl is TCustomBitBtn then Exit(TGtk2PrivateButton);
if AWinControl is TCustomTabControl then Exit(TGtk2PrivateNotebook);
if AWinControl is TCustomButton then Exit(TGtk2PrivateButton);
if AWinControl is TCustomMemo then Exit(TGtkPrivateScrolling);
if AWinControl is TCustomEdit then Exit(TGtkPrivateEntry);
if AWinControl is TCustomListBox then Exit(TGtk2PrivateList);
if AWinControl is TWinControl then Exit(TGtkPrivateWidget);
Result := nil;
end;
{ TGtkPrivateScrolling } { TGtkPrivateScrolling }
{ temp class to keep things working } { temp class to keep things working }