gtk: move CreateComponent code for TCustomPage to CreateHandle and FinishComponentCreate to SetCallbacks

git-svn-id: trunk@13465 -
This commit is contained in:
paul 2007-12-26 07:24:05 +00:00
parent 4db415b23b
commit a529591664
2 changed files with 33 additions and 6 deletions

View File

@ -4764,10 +4764,6 @@ begin
csWinControl: // code moved for TCustomControl
p:=CreateAPIWidget(TWinControl(Sender));
csPage: // TCustomPage - Notebook page
P:=CreateSimpleClientAreaWidget(Sender, true);
csPairSplitter:
p:=CreatePairSplitter(Sender);
@ -4873,6 +4869,7 @@ begin
csButton,
csToggleBox,
csRadioButton,
csPage,
csPopupMenu,
csCheckbox,
csMainMenu: DebugLn('[WARNING] Obsolete call to TGTKOBject.CreateComponent for ', Sender.ClassName);

View File

@ -33,7 +33,7 @@ uses
{$ELSE GTK2}
gtk, gdk, glib, gtk1WSPrivate, graphics,
{$ENDIF GTK2}
gtkextra,
GtkExtra, GtkWsControls,
GtkGlobals, GtkProc, GtkDef, ExtCtrls, Classes, Forms, SysUtils, Menus,
WSExtCtrls, WSLCLClasses, gtkint, interfacebase;
@ -44,7 +44,10 @@ type
TGtkWSCustomPage = class(TWSCustomPage)
private
protected
class procedure SetCallbacks(const AGtkWidget: PGtkWidget; const AWidgetInfo: PWidgetInfo); virtual;
public
class function CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLIntfHandle; override;
class procedure UpdateProperties(const ACustomPage: TCustomPage); override;
class procedure SetBounds(const AWinControl: TWinControl; const ALeft, ATop, AWidth, AHeight: Integer); override;
end;
@ -198,7 +201,7 @@ type
private
protected
public
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
// class procedure DestroyHandle(const AWinControl: TWinControl); override;
class procedure SetColor(const AWinControl: TWinControl); override;
end;
@ -242,6 +245,33 @@ const
{ TGtkWSCustomPage }
class procedure TGtkWSCustomPage.SetCallbacks(const AGtkWidget: PGtkWidget;
const AWidgetInfo: PWidgetInfo);
begin
TGtkWSWinControl.SetCallbacks(PGtkObject(AGtkWidget), TComponent(AWidgetInfo^.LCLObject));
end;
class function TGtkWSCustomPage.CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLIntfHandle;
var
Widget: PGtkWidget;
WidgetInfo: PWidgetInfo;
begin
Widget := GtkWidgetset.CreateSimpleClientAreaWidget(AWinControl, True);
{$IFDEF DebugLCLComponents}
DebugGtkWidgets.MarkCreated(Widget, dbgsName(AWinControl));
{$ENDIF}
Result := TLCLIntfHandle(PtrUInt(Widget));
WidgetInfo := GetWidgetInfo(Widget);
WidgetInfo^.LCLObject := AWinControl;
WidgetInfo^.Style := AParams.Style;
WidgetInfo^.ExStyle := AParams.ExStyle;
WidgetInfo^.WndProc := PtrUInt(AParams.WindowClass.lpfnWndProc);
SetCallBacks(Widget, WidgetInfo);
end;
class procedure TGtkWSCustomPage.UpdateProperties(const ACustomPage: TCustomPage);
begin
UpdateNotebookPageTab(nil, ACustomPage);