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