mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 13:39:11 +02:00
Fixes and minor improvements on fpgui interface
git-svn-id: trunk@11113 -
This commit is contained in:
parent
28b1b1be74
commit
1a38e1d6c2
@ -61,19 +61,19 @@ type
|
|||||||
class function CreateHandle(const AWinControl: TWinControl;
|
class function CreateHandle(const AWinControl: TWinControl;
|
||||||
const AParams: TCreateParams): TLCLIntfHandle; override;
|
const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||||
class procedure DestroyHandle(const AWinControl: TWinControl); override;
|
class procedure DestroyHandle(const AWinControl: TWinControl); override;
|
||||||
// class procedure Invalidate(const AWinControl: TWinControl); override;
|
class procedure Invalidate(const AWinControl: TWinControl); override;
|
||||||
public
|
public
|
||||||
// class procedure SetBounds(const AWinControl: TWinControl; const ALeft, ATop, AWidth, AHeight: Integer); override;
|
class procedure SetBounds(const AWinControl: TWinControl; const ALeft, ATop, AWidth, AHeight: Integer); override;
|
||||||
class procedure SetPos(const AWinControl: TWinControl; const ALeft, ATop: Integer); override;
|
class procedure SetPos(const AWinControl: TWinControl; const ALeft, ATop: Integer); override;
|
||||||
class procedure SetSize(const AWinControl: TWinControl; const AWidth, AHeight: Integer); override;
|
class procedure SetSize(const AWinControl: TWinControl; const AWidth, AHeight: Integer); override;
|
||||||
class procedure ShowHide(const AWinControl: TWinControl); override; //TODO: rename to SetVisible(control, visible)
|
class procedure ShowHide(const AWinControl: TWinControl); override; //TODO: rename to SetVisible(control, visible)
|
||||||
// class procedure SetColor(const AWinControl: TWinControl); override;
|
// class procedure SetColor(const AWinControl: TWinControl); override;
|
||||||
// class procedure SetCursor(const AWinControl: TWinControl; const ACursor: HCursor); override;
|
class procedure SetCursor(const AWinControl: TWinControl; const ACursor: HCursor); override;
|
||||||
|
|
||||||
// class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
|
{ class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
|
||||||
// class procedure SetText(const AWinControl: TWinControl; const AText: string); override;
|
class procedure SetText(const AWinControl: TWinControl; const AText: string); override;
|
||||||
|
|
||||||
{ class procedure AddControl(const AControl: TControl); override;
|
class procedure AddControl(const AControl: TControl); override;
|
||||||
class procedure SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle); override;
|
class procedure SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle); override;
|
||||||
|
|
||||||
class procedure SetChildZPosition(const AWinControl, AChild: TWinControl;
|
class procedure SetChildZPosition(const AWinControl, AChild: TWinControl;
|
||||||
@ -140,32 +140,99 @@ begin
|
|||||||
// AWinControl.Handle := 0;
|
// AWinControl.Handle := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TFpGuiWSWinControl.Invalidate
|
||||||
|
Params: None
|
||||||
|
Returns: Nothing
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
class procedure TFpGuiWSWinControl.Invalidate(const AWinControl: TWinControl);
|
||||||
|
var
|
||||||
|
FPWidget: TFWidget;
|
||||||
|
begin
|
||||||
|
FPWidget := TFPGUIPrivateWidget(AWincontrol.Handle).Widget;
|
||||||
|
FPWIdget.Redraw;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TFpGuiWSWinControl.SetBounds
|
||||||
|
Params: AWinControl - the calling object
|
||||||
|
ALeft, ATop - Position
|
||||||
|
AWidth, AHeight - Size
|
||||||
|
Returns: Nothing
|
||||||
|
|
||||||
|
Sets the position and size of a widget
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
class procedure TFpGuiWSWinControl.SetBounds(const AWinControl: TWinControl;
|
||||||
|
const ALeft, ATop, AWidth, AHeight: Integer);
|
||||||
|
var
|
||||||
|
FPWidget: TFWidget;
|
||||||
|
begin
|
||||||
|
FPWidget := TFPGUIPrivateWidget(AWincontrol.Handle).Widget;
|
||||||
|
FPWIdget.SetBounds(ALeft, ATop, AWidth, AHeight);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TFpGuiWSWinControl.SetPos
|
||||||
|
Params: AWinControl - the calling object
|
||||||
|
ALeft, ATop - Position
|
||||||
|
Returns: Nothing
|
||||||
|
|
||||||
|
Sets the position of a widget
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
class procedure TFpGuiWSWinControl.SetPos(const AWinControl: TWinControl;
|
class procedure TFpGuiWSWinControl.SetPos(const AWinControl: TWinControl;
|
||||||
const ALeft, ATop: Integer);
|
const ALeft, ATop: Integer);
|
||||||
var
|
var
|
||||||
FPWidget: TFWidget;
|
FPWidget: TFWidget;
|
||||||
begin
|
begin
|
||||||
FPWidget := TFWidget(AWincontrol.Handle);
|
FPWidget := TFPGUIPrivateWidget(AWincontrol.Handle).Widget;
|
||||||
FPWIdget.SetBounds(ALeft, ATop, AWincontrol.Width, AWinControl.Height);
|
FPWIdget.SetBounds(ALeft, ATop, AWincontrol.Width, AWinControl.Height);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TFpGuiWSWinControl.SetSize
|
||||||
|
Params: AWinControl - the calling object
|
||||||
|
AWidth, AHeight - Size
|
||||||
|
Returns: Nothing
|
||||||
|
|
||||||
|
Sets the size of a widget
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
class procedure TFpGuiWSWinControl.SetSize(const AWinControl: TWinControl;
|
class procedure TFpGuiWSWinControl.SetSize(const AWinControl: TWinControl;
|
||||||
const AWidth, AHeight: Integer);
|
const AWidth, AHeight: Integer);
|
||||||
var
|
var
|
||||||
FPWidget: TFWidget;
|
FPWidget: TFWidget;
|
||||||
begin
|
begin
|
||||||
FPWidget := TFWidget(AWincontrol.Handle);
|
FPWidget := TFPGUIPrivateWidget(AWincontrol.Handle).Widget;
|
||||||
FPWIdget.SetBounds(AWinControl.Left, AWinControl.Top, AWidth, AHeight);
|
FPWIdget.SetBounds(AWinControl.Left, AWinControl.Top, AWidth, AHeight);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TFpGuiWSWinControl.ShowHide
|
||||||
|
Params: AWinControl - the calling object
|
||||||
|
Returns: Nothing
|
||||||
|
|
||||||
|
Shows or hides a widget.
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
class procedure TFpGuiWSWinControl.ShowHide(const AWinControl: TWinControl);
|
class procedure TFpGuiWSWinControl.ShowHide(const AWinControl: TWinControl);
|
||||||
var
|
var
|
||||||
FPWidget: TFPGUIPrivateWidget;
|
FPWidget: TFWidget;
|
||||||
begin
|
begin
|
||||||
FPWidget := TFPGUIPrivateWidget(AWincontrol.Handle);
|
FPWidget := TFPGUIPrivateWidget(AWincontrol.Handle).Widget;
|
||||||
FPWidget.Visible := not FPWidget.Visible;
|
FPWidget.Visible := not FPWidget.Visible;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TFpGuiWSWinControl.SetCursor
|
||||||
|
Params: AWinControl - the calling object
|
||||||
|
Returns: Nothing
|
||||||
|
|
||||||
|
Sets the cursor of the widget.
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
class procedure TFpGuiWSWinControl.SetCursor(const AWinControl: TWinControl;
|
||||||
|
const ACursor: HCursor);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
|
@ -27,15 +27,12 @@ unit FpGuiWSForms;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
////////////////////////////////////////////////////
|
// Bindings
|
||||||
// I M P O R T A N T
|
fpgui, fpgfx, gfxbase, fpguiwsprivate,
|
||||||
////////////////////////////////////////////////////
|
// LCL
|
||||||
// To get as little as posible circles,
|
Classes, Forms, LCLType, Controls,
|
||||||
// uncomment only when needed for registration
|
// Widgetset
|
||||||
////////////////////////////////////////////////////
|
WSForms, WSLCLClasses;
|
||||||
Forms,
|
|
||||||
////////////////////////////////////////////////////
|
|
||||||
WSForms, WSLCLClasses, LCLType, Controls;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -120,19 +117,16 @@ type
|
|||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
uses FPGuiWSPrivate, fpgui, fpgfx, gfxbase, Classes;
|
|
||||||
|
|
||||||
{ TFpGuiWSCustomForm }
|
{ TFpGuiWSCustomForm }
|
||||||
|
|
||||||
class function TFpGuiWSCustomForm.GetText(const AWinControl: TWinControl;
|
{------------------------------------------------------------------------------
|
||||||
var AText: String): Boolean;
|
Method: TFpGuiWSCustomForm.CreateHandle
|
||||||
var
|
Params: None
|
||||||
FPForm: TFPGUIPrivateWindow;
|
Returns: Nothing
|
||||||
begin
|
|
||||||
Result := True;
|
Allocates memory and resources for the control and shows it
|
||||||
FPForm := TFPGUIPrivateWindow(AWinControl.Handle);
|
------------------------------------------------------------------------------}
|
||||||
AText := FPForm.GetText;
|
|
||||||
end;
|
|
||||||
class function TFpGuiWSCustomForm.CreateHandle(const AWinControl: TWinControl;
|
class function TFpGuiWSCustomForm.CreateHandle(const AWinControl: TWinControl;
|
||||||
const AParams: TCreateParams): TLCLIntfHandle;
|
const AParams: TCreateParams): TLCLIntfHandle;
|
||||||
var
|
var
|
||||||
@ -142,6 +136,26 @@ begin
|
|||||||
Result := TLCLIntfHandle(FPForm);
|
Result := TLCLIntfHandle(FPForm);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TFpGuiWSCustomForm.GetText
|
||||||
|
Params: None
|
||||||
|
Returns: Nothing
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
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;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TFpGuiWSCustomForm.SetFormBorderStyle
|
||||||
|
Params: None
|
||||||
|
Returns: Nothing
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
class procedure TFpGuiWSCustomForm.SetFormBorderStyle(const AForm: Forms.TCustomForm;
|
class procedure TFpGuiWSCustomForm.SetFormBorderStyle(const AForm: Forms.TCustomForm;
|
||||||
const AFormBorderStyle: TFormBorderStyle);
|
const AFormBorderStyle: TFormBorderStyle);
|
||||||
var
|
var
|
||||||
@ -151,6 +165,11 @@ begin
|
|||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TFpGuiWSCustomForm.SetText
|
||||||
|
Params: None
|
||||||
|
Returns: Nothing
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
class procedure TFpGuiWSCustomForm.SetText(const AWinControl: TWinControl;
|
class procedure TFpGuiWSCustomForm.SetText(const AWinControl: TWinControl;
|
||||||
const AText: String);
|
const AText: String);
|
||||||
var
|
var
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
unit fpguiwsprivate;
|
unit fpguiwsprivate;
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
@ -73,6 +74,7 @@ type
|
|||||||
constructor Create(ALCLObject: TWinControl; const AParams: TCreateParams); virtual;
|
constructor Create(ALCLObject: TWinControl; const AParams: TCreateParams); virtual;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure CreateWidget(const AParams: TCreateParams); virtual; abstract;
|
procedure CreateWidget(const AParams: TCreateParams); virtual; abstract;
|
||||||
|
procedure DestroyWidget; virtual; abstract;
|
||||||
procedure SetSize(AWidth, AHeight: LongInt); virtual;
|
procedure SetSize(AWidth, AHeight: LongInt); virtual;
|
||||||
procedure SetPosition(AX, AY: Integer); virtual;
|
procedure SetPosition(AX, AY: Integer); virtual;
|
||||||
|
|
||||||
@ -161,6 +163,7 @@ type
|
|||||||
public
|
public
|
||||||
function ComboBox: TFComboBox;
|
function ComboBox: TFComboBox;
|
||||||
constructor Create(ALCLObject: TWinControl; const AParams: TCreateParams); override;
|
constructor Create(ALCLObject: TWinControl; const AParams: TCreateParams); override;
|
||||||
|
procedure DestroyWidget; override;
|
||||||
procedure CreateWidget(const AParams: TCreateParams); override;
|
procedure CreateWidget(const AParams: TCreateParams); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -224,6 +227,7 @@ end;
|
|||||||
destructor TFPGUIPrivateWidget.Destroy;
|
destructor TFPGUIPrivateWidget.Destroy;
|
||||||
begin
|
begin
|
||||||
FreeAndNil(Widget);
|
FreeAndNil(Widget);
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -261,8 +265,7 @@ end;
|
|||||||
|
|
||||||
procedure TFPGUIPrivateContainer.RemoveChild(AWidget: TFWidget);
|
procedure TFPGUIPrivateContainer.RemoveChild(AWidget: TFWidget);
|
||||||
begin
|
begin
|
||||||
//fFixed.RemoveChild(TFPGUIPrivateWidget(AControl.Handle).Widget);
|
// fFixed.RemoveChild(AWidget);
|
||||||
// !!
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TFPGUIPrivateWindow }
|
{ TFPGUIPrivateWindow }
|
||||||
@ -388,11 +391,21 @@ end;
|
|||||||
|
|
||||||
{ TFPGUIPrivateComboBox }
|
{ TFPGUIPrivateComboBox }
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TFPGUIPrivateComboBox.ComboBox
|
||||||
|
Params: None
|
||||||
|
Returns: Nothing
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
function TFPGUIPrivateComboBox.ComboBox: TFComboBox;
|
function TFPGUIPrivateComboBox.ComboBox: TFComboBox;
|
||||||
begin
|
begin
|
||||||
Result := TFComboBox(Widget);
|
Result := TFComboBox(Widget);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TFPGUIPrivateComboBox.CreateWidget
|
||||||
|
Params: None
|
||||||
|
Returns: Nothing
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
procedure TFPGUIPrivateComboBox.CreateWidget(const AParams: TCreateParams);
|
procedure TFPGUIPrivateComboBox.CreateWidget(const AParams: TCreateParams);
|
||||||
var
|
var
|
||||||
ParentContainer: TFPGUIPrivateContainer;
|
ParentContainer: TFPGUIPrivateContainer;
|
||||||
@ -406,6 +419,11 @@ begin
|
|||||||
Widget.SetBounds(LCLObject.Left, LCLObject.Top, LCLObject.Width, LCLObject.Height);
|
Widget.SetBounds(LCLObject.Left, LCLObject.Top, LCLObject.Width, LCLObject.Height);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TFPGUIPrivateComboBox.Create
|
||||||
|
Params: None
|
||||||
|
Returns: Nothing
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
constructor TFPGUIPrivateComboBox.Create(ALCLObject: TWinControl;
|
constructor TFPGUIPrivateComboBox.Create(ALCLObject: TWinControl;
|
||||||
const AParams: TCreateParams);
|
const AParams: TCreateParams);
|
||||||
begin
|
begin
|
||||||
@ -414,6 +432,24 @@ begin
|
|||||||
// Events
|
// Events
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
Method: TFPGUIPrivateComboBox.DestroyWidget
|
||||||
|
Params: None
|
||||||
|
Returns: Nothing
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
procedure TFPGUIPrivateComboBox.DestroyWidget;
|
||||||
|
begin
|
||||||
|
{
|
||||||
|
var
|
||||||
|
ParentContainer: TFPGUIPrivateContainer;
|
||||||
|
begin
|
||||||
|
ParentContainer := TFPGUIPrivateContainer(LCLObject.Parent.Handle);
|
||||||
|
|
||||||
|
ParentContainer.RemoveChild(Widget);
|
||||||
|
|
||||||
|
Widget.Free;}
|
||||||
|
end;
|
||||||
|
|
||||||
{ TFPGUIPrivateEdit }
|
{ TFPGUIPrivateEdit }
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
@ -246,8 +246,7 @@ end;
|
|||||||
|
|
||||||
Releases allocated memory and resources
|
Releases allocated memory and resources
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
class procedure TFpGuiWSCustomComboBox.DestroyHandle(
|
class procedure TFpGuiWSCustomComboBox.DestroyHandle(const AWinControl: TWinControl);
|
||||||
const AWinControl: TWinControl);
|
|
||||||
begin
|
begin
|
||||||
// TFPGUIPrivateComboBox(AWinControl.Handle).Free;
|
// TFPGUIPrivateComboBox(AWinControl.Handle).Free;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user