mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-25 04:19:13 +02:00
Small improvements on fpgui interface
git-svn-id: trunk@11157 -
This commit is contained in:
parent
0a7bf3d67d
commit
53364e1fce
@ -92,7 +92,16 @@ end;
|
||||
Enter the main message loop
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TFpGuiWidgetSet.AppRun(const ALoop: TApplicationMainLoop);
|
||||
var
|
||||
vMainForm: TFForm;
|
||||
begin
|
||||
{ Shows the main form }
|
||||
if Assigned(Application.MainForm) then
|
||||
begin
|
||||
vMainForm := TFPGUIPrivateWindow(Application.MainForm.Handle).Form;
|
||||
vMainForm.Show;
|
||||
end;
|
||||
|
||||
// GFApplication.EventFilter can maybe be used on X11 for aloop but it is X only
|
||||
GFApplication.Run;
|
||||
end;
|
||||
|
@ -76,8 +76,8 @@ type
|
||||
public
|
||||
class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
|
||||
|
||||
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 SetFormBorderStyle(const AForm: Forms.TCustomForm;
|
||||
const AFormBorderStyle: TFormBorderStyle); override;
|
||||
class procedure SetText(const AWinControl: TWinControl; const AText: String); override;
|
||||
@ -132,10 +132,31 @@ class function TFpGuiWSCustomForm.CreateHandle(const AWinControl: TWinControl;
|
||||
var
|
||||
FPForm: TFPGUIPrivateWindow;
|
||||
begin
|
||||
{$ifdef VerboseFPGUIIntf}
|
||||
WriteLn('TFpGuiWSCustomForm.CreateHandle');
|
||||
{$endif}
|
||||
|
||||
FPForm := TFPGUIPrivateWindow.Create(AWinControl, AParams);
|
||||
Result := TLCLIntfHandle(FPForm);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TFpGuiWSCustomForm.DestroyHandle
|
||||
Params: None
|
||||
Returns: Nothing
|
||||
------------------------------------------------------------------------------}
|
||||
class procedure TFpGuiWSCustomForm.DestroyHandle(const AWinControl: TWinControl);
|
||||
var
|
||||
FPForm: TFPGUIPrivateWindow;
|
||||
begin
|
||||
{$ifdef VerboseFPGUIIntf}
|
||||
WriteLn('TFpGuiWSCustomForm.DestroyHandle');
|
||||
{$endif}
|
||||
|
||||
FPForm := TFPGUIPrivateWindow(AWinControl.Handle);
|
||||
FPForm.Free;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TFpGuiWSCustomForm.GetText
|
||||
Params: None
|
||||
|
@ -119,6 +119,7 @@ type
|
||||
public
|
||||
constructor Create(ALCLObject: TWinControl; const AParams: TCreateParams); override;
|
||||
procedure CreateWidget(const AParams: TCreateParams); override;
|
||||
procedure DestroyWidget; override;
|
||||
destructor Destroy; override;
|
||||
function Form: TFForm;
|
||||
procedure SetSize(AWidth, AHeight: LongInt); override;
|
||||
@ -298,21 +299,41 @@ end;
|
||||
|
||||
{ TFPGUIPrivateWindow }
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TFPGUIPrivateWindow.Form
|
||||
Params: None
|
||||
Returns: Nothing
|
||||
------------------------------------------------------------------------------}
|
||||
function TFPGUIPrivateWindow.Form: TFForm;
|
||||
begin
|
||||
Result := TFForm(Widget);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TFPGUIPrivateWindow.SetSize
|
||||
Params: None
|
||||
Returns: Nothing
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TFPGUIPrivateWindow.SetSize(AWidth, AHeight: LongInt);
|
||||
begin
|
||||
Form.Wnd.SetSize(Size(AWidth, AHeight));
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TFPGUIPrivateWindow.SetPosition
|
||||
Params: None
|
||||
Returns: Nothing
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TFPGUIPrivateWindow.SetPosition(AX, AY: Integer);
|
||||
begin
|
||||
Form.Wnd.SetPosition(Point(AX, AY));
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TFPGUIPrivateWindow.Create
|
||||
Params: None
|
||||
Returns: Nothing
|
||||
------------------------------------------------------------------------------}
|
||||
constructor TFPGUIPrivateWindow.Create(ALCLObject: TWinControl; const AParams: TCreateParams);
|
||||
begin
|
||||
inherited Create(ALCLObject, AParams);
|
||||
@ -320,25 +341,55 @@ begin
|
||||
Form.InsertChild(fFixed);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TFPGUIPrivateWindow.CreateWidget
|
||||
Params: None
|
||||
Returns: Nothing
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TFPGUIPrivateWindow.CreateWidget(const AParams: TCreateParams);
|
||||
begin
|
||||
Widget := TFForm.Create(LCLObject);
|
||||
Widget := TFForm.Create(nil);
|
||||
|
||||
Form.Wnd.SetSize(Size(AParams.Width, AParams.Height));
|
||||
|
||||
Form.Wnd.SetPosition(Point(AParams.X, AParams.Y));
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TFPGUIPrivateWindow.DestroyWidget
|
||||
Params: None
|
||||
Returns: Nothing
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TFPGUIPrivateWindow.DestroyWidget;
|
||||
begin
|
||||
Form.Free;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TFPGUIPrivateWindow.Destroy
|
||||
Params: None
|
||||
Returns: Nothing
|
||||
------------------------------------------------------------------------------}
|
||||
destructor TFPGUIPrivateWindow.Destroy;
|
||||
begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TFPGUIPrivateWindow.SetText
|
||||
Params: None
|
||||
Returns: Nothing
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TFPGUIPrivateWindow.SetText(const AText: String);
|
||||
begin
|
||||
Form.Wnd.Title := AText;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TFPGUIPrivateWindow.GetText
|
||||
Params: None
|
||||
Returns: Nothing
|
||||
------------------------------------------------------------------------------}
|
||||
function TFPGUIPrivateWindow.GetText: String;
|
||||
begin
|
||||
Result := Form.Wnd.Title;
|
||||
|
Loading…
Reference in New Issue
Block a user