mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 09:19:40 +02:00
fpgui intf: form and button from Andrew Haines
git-svn-id: trunk@10899 -
This commit is contained in:
parent
d2ca16d11e
commit
f5a1444ff0
@ -39,7 +39,10 @@ uses
|
||||
// LCL
|
||||
InterfaceBase, LCLProc, LCLType, LMessages,
|
||||
Controls, ExtCtrls, Forms, Dialogs, StdCtrls, Comctrls, LCLIntf,
|
||||
GraphType;
|
||||
GraphType,
|
||||
// Interface
|
||||
fpgui, fpgfx,
|
||||
FPGUIWSPrivate;
|
||||
|
||||
type
|
||||
|
||||
@ -97,12 +100,12 @@ uses
|
||||
////////////////////////////////////////////////////
|
||||
// FpGuiWSActnList,
|
||||
// FpGuiWSArrow,
|
||||
// FpGuiWSButtons,
|
||||
FpGuiWSButtons,
|
||||
// FpGuiWSCalendar,
|
||||
// FpGuiWSCheckLst,
|
||||
// FpGuiWSCListBox,
|
||||
// FpGuiWSComCtrls,
|
||||
// FpGuiWSControls,
|
||||
FpGuiWSControls,
|
||||
// FpGuiWSDbCtrls,
|
||||
// FpGuiWSDBGrids,
|
||||
// FpGuiWSDialogs,
|
||||
@ -111,7 +114,7 @@ uses
|
||||
// FpGuiWSExtCtrls,
|
||||
// FpGuiWSExtDlgs,
|
||||
// FpGuiWSFileCtrl,
|
||||
// FpGuiWSForms,
|
||||
FpGuiWSForms,
|
||||
// FpGuiWSGrids,
|
||||
// FpGuiWSImgList,
|
||||
// FpGuiWSMaskEdit,
|
||||
|
@ -75,7 +75,13 @@ end;
|
||||
Initializes the application
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TFpGuiWidgetSet.AppInit(var ScreenInfo: TScreenInfo);
|
||||
var
|
||||
Display: String;
|
||||
begin
|
||||
// This doesn't hurt. on other playforms than X it just will do nothing
|
||||
GetEnvironmentVariable('DISPLAY');
|
||||
GFApplication.Initialize(Display);
|
||||
//GFApplication.QuitWhenLastWindowCloses := False;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -87,6 +93,8 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TFpGuiWidgetSet.AppRun(const ALoop: TApplicationMainLoop);
|
||||
begin
|
||||
// GFApplication.EventFilter can maybe be used on X11 for aloop but it is X only
|
||||
GFApplication.Run;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -120,6 +128,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TFpGuiWidgetSet.AppTerminate;
|
||||
begin
|
||||
GFApplication.Quit;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -33,9 +33,9 @@ uses
|
||||
// To get as little as posible circles,
|
||||
// uncomment only when needed for registration
|
||||
////////////////////////////////////////////////////
|
||||
// Buttons,
|
||||
Buttons,
|
||||
////////////////////////////////////////////////////
|
||||
WSButtons, WSLCLClasses;
|
||||
WSButtons, WSLCLClasses, LCLType, Controls;
|
||||
|
||||
type
|
||||
|
||||
@ -45,6 +45,9 @@ type
|
||||
private
|
||||
protected
|
||||
public
|
||||
class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
|
||||
class procedure SetText(const AWinControl: TWinControl; const AText: String); override;
|
||||
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||
end;
|
||||
|
||||
{ TFpGuiWSBitBtn }
|
||||
@ -65,6 +68,28 @@ type
|
||||
|
||||
|
||||
implementation
|
||||
uses FPGUIWSPrivate;
|
||||
|
||||
{ TFpGuiWSButton }
|
||||
|
||||
class function TFpGuiWSButton.GetText(const AWinControl: TWinControl;
|
||||
var AText: String): Boolean;
|
||||
begin
|
||||
Result := True;
|
||||
AText := TFPGUIPrivateButton(AWinControl.Handle).GetText;
|
||||
end;
|
||||
|
||||
class procedure TFpGuiWSButton.SetText(const AWinControl: TWinControl;
|
||||
const AText: String);
|
||||
begin
|
||||
TFPGUIPrivateButton(AWinControl.Handle).SetText(AText);
|
||||
end;
|
||||
|
||||
class function TFpGuiWSButton.CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): TLCLIntfHandle;
|
||||
begin
|
||||
Result := TLCLIntfHandle(TFPGUIPrivateButton.Create(AWinControl, AParams));
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
@ -74,7 +99,7 @@ initialization
|
||||
// To improve speed, register only classes
|
||||
// which actually implement something
|
||||
////////////////////////////////////////////////////
|
||||
// RegisterWSComponent(TCustomButton, TFpGuiWSButton);
|
||||
RegisterWSComponent(Buttons.TCustomButton, TFpGuiWSButton);
|
||||
// RegisterWSComponent(TCustomBitBtn, TFpGuiWSBitBtn);
|
||||
// RegisterWSComponent(TCustomSpeedButton, TFpGuiWSSpeedButton);
|
||||
////////////////////////////////////////////////////
|
||||
|
@ -33,7 +33,7 @@ uses
|
||||
// To get as little as posible circles,
|
||||
// uncomment only when needed for registration
|
||||
////////////////////////////////////////////////////
|
||||
// Controls,
|
||||
Controls, LCLType,
|
||||
////////////////////////////////////////////////////
|
||||
WSControls, WSLCLClasses;
|
||||
|
||||
@ -53,6 +53,7 @@ type
|
||||
private
|
||||
protected
|
||||
public
|
||||
class procedure AddControl(const AControl: TControl); override;
|
||||
end;
|
||||
|
||||
{ TFpGuiWSWinControl }
|
||||
@ -61,6 +62,9 @@ type
|
||||
private
|
||||
protected
|
||||
public
|
||||
class procedure ShowHide(const AWinControl: TWinControl); override;
|
||||
class procedure SetPos(const AWinControl: TWinControl; const ALeft, ATop: Integer); override;
|
||||
class procedure SetSize(const AWinControl: TWinControl; const AWidth, AHeight: Integer); override;
|
||||
end;
|
||||
|
||||
{ TFpGuiWSGraphicControl }
|
||||
@ -89,6 +93,48 @@ type
|
||||
|
||||
|
||||
implementation
|
||||
uses fpgui, FPGUIWSPrivate;
|
||||
|
||||
{ TFpGuiWSWinControl }
|
||||
|
||||
class procedure TFpGuiWSWinControl.ShowHide(const AWinControl: TWinControl);
|
||||
var
|
||||
FPWidget: TFPGUIPrivateWidget;
|
||||
begin
|
||||
FPWidget := TFPGUIPrivateWidget(AWincontrol.Handle);
|
||||
FPWidget.Visible := not FPWidget.Visible;
|
||||
end;
|
||||
|
||||
class procedure TFpGuiWSWinControl.SetPos(const AWinControl: TWinControl;
|
||||
const ALeft, ATop: Integer);
|
||||
var
|
||||
FPWidget: TWidget;
|
||||
begin
|
||||
FPWidget := TWidget(AWincontrol.Handle);
|
||||
FPWIdget.SetBounds(ALeft, ATop, AWincontrol.Width, AWinControl.Height);
|
||||
end;
|
||||
|
||||
class procedure TFpGuiWSWinControl.SetSize(const AWinControl: TWinControl;
|
||||
const AWidth, AHeight: Integer);
|
||||
var
|
||||
FPWidget: TWidget;
|
||||
begin
|
||||
FPWidget := TWidget(AWincontrol.Handle);
|
||||
FPWIdget.SetBounds(AWinControl.Left, AWinControl.Top, AWidth, AHeight);
|
||||
end;
|
||||
|
||||
{ TFpGuiWSControl }
|
||||
|
||||
class procedure TFpGuiWSControl.AddControl(const AControl: TControl);
|
||||
var
|
||||
AParent: TWinControl;
|
||||
ParentWidget: TFPGUIPrivateWidget;
|
||||
begin
|
||||
AParent := TWinControl(AControl).Parent;
|
||||
ParentWidget := TFPGUIPrivateWidget(AParent.Handle);
|
||||
|
||||
(ParentWidget as IContainer).AddChild(TWinControl(AControl));
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
@ -99,8 +145,8 @@ initialization
|
||||
// which actually implement something
|
||||
////////////////////////////////////////////////////
|
||||
// RegisterWSComponent(TDragImageList, TFpGuiWSDragImageList);
|
||||
// RegisterWSComponent(TControl, TFpGuiWSControl);
|
||||
// RegisterWSComponent(TWinControl, TFpGuiWSWinControl);
|
||||
RegisterWSComponent(TControl, TFpGuiWSControl);
|
||||
RegisterWSComponent(TWinControl, TFpGuiWSWinControl);
|
||||
// RegisterWSComponent(TGraphicControl, TFpGuiWSGraphicControl);
|
||||
// RegisterWSComponent(TCustomControl, TFpGuiWSCustomControl);
|
||||
// RegisterWSComponent(TImageList, TFpGuiWSImageList);
|
||||
|
@ -33,9 +33,9 @@ uses
|
||||
// To get as little as posible circles,
|
||||
// uncomment only when needed for registration
|
||||
////////////////////////////////////////////////////
|
||||
// Forms,
|
||||
Forms,
|
||||
////////////////////////////////////////////////////
|
||||
WSForms, WSLCLClasses;
|
||||
WSForms, WSLCLClasses, LCLType, Controls;
|
||||
|
||||
type
|
||||
|
||||
@ -77,6 +77,13 @@ type
|
||||
private
|
||||
protected
|
||||
public
|
||||
class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
|
||||
|
||||
class function CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||
class procedure SetFormBorderStyle(const AForm: Forms.TCustomForm;
|
||||
const AFormBorderStyle: TFormBorderStyle); override;
|
||||
class procedure SetText(const AWinControl: TWinControl; const AText: String); override;
|
||||
end;
|
||||
|
||||
{ TFpGuiWSForm }
|
||||
@ -113,6 +120,45 @@ type
|
||||
|
||||
|
||||
implementation
|
||||
uses FPGuiWSPrivate, fpgui, fpgfx, gfxbase, Classes;
|
||||
|
||||
{ TFpGuiWSCustomForm }
|
||||
|
||||
class function TFpGuiWSCustomForm.GetText(const AWinControl: TWinControl;
|
||||
var AText: String): Boolean;
|
||||
var
|
||||
FPForm: TFPGUIPrivateWindow;
|
||||
begin
|
||||
Result := True;
|
||||
FPForm := TFPGUIPrivateWindow(AWinControl.Handle);
|
||||
AText := FPForm.GetText;
|
||||
end;
|
||||
class function TFpGuiWSCustomForm.CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): TLCLIntfHandle;
|
||||
var
|
||||
FPForm: TFPGUIPrivateWindow;
|
||||
begin
|
||||
FPForm := TFPGUIPrivateWindow.Create(AWinControl, AParams);
|
||||
Result := TLCLIntfHandle(FPForm);
|
||||
end;
|
||||
|
||||
class procedure TFpGuiWSCustomForm.SetFormBorderStyle(const AForm: Forms.TCustomForm;
|
||||
const AFormBorderStyle: TFormBorderStyle);
|
||||
var
|
||||
FPForm: TFPGUIPrivateWindow;
|
||||
begin
|
||||
FPForm := TFPGUIPrivateWindow(AForm.Handle);
|
||||
|
||||
end;
|
||||
|
||||
class procedure TFpGuiWSCustomForm.SetText(const AWinControl: TWinControl;
|
||||
const AText: String);
|
||||
var
|
||||
FPForm: TFPGUIPrivateWindow;
|
||||
begin
|
||||
FPForm := TFPGUIPrivateWindow(AWincontrol.Handle);
|
||||
FPForm.SetText(AText);
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
@ -126,8 +172,8 @@ initialization
|
||||
// RegisterWSComponent(TScrollBox, TFpGuiWSScrollBox);
|
||||
// RegisterWSComponent(TCustomFrame, TFpGuiWSCustomFrame);
|
||||
// RegisterWSComponent(TFrame, TFpGuiWSFrame);
|
||||
// RegisterWSComponent(TCustomForm, TFpGuiWSCustomForm);
|
||||
// RegisterWSComponent(TForm, TFpGuiWSForm);
|
||||
RegisterWSComponent(Forms.TCustomForm, TFpGuiWSCustomForm);
|
||||
// RegisterWSComponent(Forms.TForm, TFpGuiWSForm);
|
||||
// RegisterWSComponent(THintWindow, TFpGuiWSHintWindow);
|
||||
// RegisterWSComponent(TScreen, TFpGuiWSScreen);
|
||||
// RegisterWSComponent(TApplicationProperties, TFpGuiWSApplicationProperties);
|
||||
|
@ -4,7 +4,7 @@
|
||||
-------------------
|
||||
|
||||
Initial Revision : Thu July 1st CST 1999
|
||||
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user