gtk intf: added TGtkWidgetSet.FinishCreateHandle with some standard setups for non LCL gtk controls

git-svn-id: trunk@13641 -
This commit is contained in:
mattias 2008-01-05 22:49:14 +00:00
parent 79018c49c5
commit ace1f24e16
2 changed files with 29 additions and 1 deletions

View File

@ -45,7 +45,7 @@ uses
InterfaceBase,
LMessages, FileUtil, Controls, Forms, LCLProc, LCLStrConsts, LCLIntf, LCLType,
DynHashArray, GraphType, GraphMath, Graphics, Menus,
GTKWinApiWindow, StdCtrls, ComCtrls,
GtkWSControls, GTKWinApiWindow, StdCtrls, ComCtrls,
Dialogs, ExtDlgs, Themes, LResources, Math, GTKGlobals,
{Buttons, CListBox, Calendar, Arrow, Spin, FileCtrl, CommCtrl, ExtCtrls, }
GtkDef, Gtk2Def, GtkFontCache, GtkInt, GtkExtra;
@ -74,6 +74,10 @@ type
procedure SetWidgetFont(const AWidget: PGtkWidget; const AFont: TFont); override;
function AppHandle: Thandle; override;
// for gtk controls not part of the LCL:
procedure FinishCreateHandle(const AWinControl: TWinControl; Widget: PGtkWidget; const AParams: TCreateParams);
{$I gtk2winapih.inc}
{$I gtk2lclintfh.inc}
end;

View File

@ -567,6 +567,30 @@ begin
{$endif}
end;
procedure TGtk2WidgetSet.FinishCreateHandle(
const AWinControl: TWinControl; Widget: PGtkWidget;
const AParams: TCreateParams);
var
WidgetInfo: PWidgetInfo;
Allocation: TGTKAllocation;
begin
WidgetInfo := GetWidgetInfo(Widget,true); // Widget info already created in CreateAPIWidget
WidgetInfo^.LCLObject := AWinControl;
WidgetInfo^.Style := AParams.Style;
WidgetInfo^.ExStyle := AParams.ExStyle;
WidgetInfo^.WndProc := PtrUInt(AParams.WindowClass.lpfnWndProc);
// set allocation
Allocation.X := AParams.X;
Allocation.Y := AParams.Y;
Allocation.Width := AParams.Width;
Allocation.Height := AParams.Height;
gtk_widget_size_allocate(Widget, @Allocation);
Set_RC_Name(AWinControl, Widget);
TGtkWSWinControl.SetCallbacks(PGtkObject(Widget), AWinControl);
end;
{$IFDEF ASSERT_IS_ON}
{$UNDEF ASSERT_IS_ON}
{$C-}