mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-24 09:19:50 +01:00
MG: implemented TMethodList and Application Idle handlers
git-svn-id: trunk@3599 -
This commit is contained in:
parent
51b8c1acf0
commit
e33417531d
@ -20,8 +20,8 @@
|
|||||||
|
|
||||||
Author: Mattias: Gaertner
|
Author: Mattias: Gaertner
|
||||||
|
|
||||||
TExtendedStrings is a normal TStringList, except that the Objects are extended
|
TExtendedStrings is a normal TStringList, except that the Objects can hold
|
||||||
to records.
|
any type of records.
|
||||||
}
|
}
|
||||||
unit ExtendedStrings;
|
unit ExtendedStrings;
|
||||||
|
|
||||||
|
|||||||
56
lcl/forms.pp
56
lcl/forms.pp
@ -59,6 +59,9 @@ type
|
|||||||
|
|
||||||
TScrollingWinControl = class;
|
TScrollingWinControl = class;
|
||||||
|
|
||||||
|
|
||||||
|
{ TControlScrollBar }
|
||||||
|
|
||||||
TScrollBarKind = (sbHorizontal, sbVertical);
|
TScrollBarKind = (sbHorizontal, sbVertical);
|
||||||
TScrollBarInc = 1..32768;
|
TScrollBarInc = 1..32768;
|
||||||
TScrollBarStyle = (ssRegular, ssFlat, ssHotTrack);
|
TScrollBarStyle = (ssRegular, ssFlat, ssHotTrack);
|
||||||
@ -104,6 +107,9 @@ type
|
|||||||
property Visible: Boolean read FVisible write SetVisible;// default True;
|
property Visible: Boolean read FVisible write SetVisible;// default True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TScrollingWinControl }
|
||||||
|
|
||||||
TScrollingWinControl = class(TWinControl)
|
TScrollingWinControl = class(TWinControl)
|
||||||
private
|
private
|
||||||
FHorzScrollBar : TControlScrollBar;
|
FHorzScrollBar : TControlScrollBar;
|
||||||
@ -149,6 +155,9 @@ type
|
|||||||
read FVertScrollBar write SetVertScrollBar stored StoreScrollBars;
|
read FVertScrollBar write SetVertScrollBar stored StoreScrollBars;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TScrollBox }
|
||||||
|
|
||||||
TScrollBox = class(TScrollingWinControl)
|
TScrollBox = class(TScrollingWinControl)
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
@ -208,6 +217,9 @@ type
|
|||||||
|
|
||||||
TIDesigner = class;
|
TIDesigner = class;
|
||||||
|
|
||||||
|
|
||||||
|
{ TCustomForm }
|
||||||
|
|
||||||
TCloseEvent = procedure(Sender: TObject; var Action: TCloseAction) of object;
|
TCloseEvent = procedure(Sender: TObject; var Action: TCloseAction) of object;
|
||||||
TCloseQueryEvent = procedure(Sender : TObject; var CanClose : boolean) of object;
|
TCloseQueryEvent = procedure(Sender : TObject; var CanClose : boolean) of object;
|
||||||
TFormState = set of (fsCreating, fsVisible, fsShowing, fsModal, fsCreatedMDIChild);
|
TFormState = set of (fsCreating, fsVisible, fsShowing, fsModal, fsCreatedMDIChild);
|
||||||
@ -324,6 +336,9 @@ type
|
|||||||
property WindowState: TWindowState read FWindowState write SetWindowState default wsNormal;
|
property WindowState: TWindowState read FWindowState write SetWindowState default wsNormal;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TForm }
|
||||||
|
|
||||||
TForm = class(TCustomForm)
|
TForm = class(TCustomForm)
|
||||||
private
|
private
|
||||||
FClientHandle: HWND;
|
FClientHandle: HWND;
|
||||||
@ -374,7 +389,7 @@ type
|
|||||||
TFormClass = class of TForm;
|
TFormClass = class of TForm;
|
||||||
|
|
||||||
|
|
||||||
{THintWindow}
|
{ THintWindow }
|
||||||
|
|
||||||
THintWindow = class(TCustomForm)
|
THintWindow = class(TCustomForm)
|
||||||
private
|
private
|
||||||
@ -398,6 +413,8 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TScreen }
|
||||||
|
|
||||||
TScreen = class(TComponent)
|
TScreen = class(TComponent)
|
||||||
private
|
private
|
||||||
FFocusedForm: TCustomForm;
|
FFocusedForm: TCustomForm;
|
||||||
@ -426,9 +443,15 @@ type
|
|||||||
property Width : Integer read GetWidth;
|
property Width : Integer read GetWidth;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TApplication }
|
||||||
|
|
||||||
TExceptionEvent = procedure (Sender: TObject; E: Exception) of object;
|
TExceptionEvent = procedure (Sender: TObject; E: Exception) of object;
|
||||||
TIdleEvent = procedure (Sender: TObject; var Done: Boolean) of object;
|
TIdleEvent = procedure (Sender: TObject; var Done: Boolean) of object;
|
||||||
|
|
||||||
|
TApplicationStateType = (AppWaiting, AppIdleEndSent);
|
||||||
|
TApplicationState = set of TApplicationStateType;
|
||||||
|
|
||||||
TApplication = class(TComponent)
|
TApplication = class(TComponent)
|
||||||
private
|
private
|
||||||
FHandle : THandle;
|
FHandle : THandle;
|
||||||
@ -438,11 +461,16 @@ type
|
|||||||
FMouseControl: TControl;
|
FMouseControl: TControl;
|
||||||
FOnException: TExceptionEvent;
|
FOnException: TExceptionEvent;
|
||||||
FOnIdle: TIdleEvent;
|
FOnIdle: TIdleEvent;
|
||||||
|
FOnIdleHandler: TMethodList;
|
||||||
|
FOnIdleEnd: TNotifyEvent;
|
||||||
|
FOnIdleEndHandler: TMethodList;
|
||||||
|
FOnUserInput: TNotifyEvent;
|
||||||
|
FOnUserInputHandler: TMethodList;
|
||||||
|
FState: TApplicationState;
|
||||||
FTerminate : Boolean;
|
FTerminate : Boolean;
|
||||||
FTitle : String;
|
FTitle : String;
|
||||||
// MWE:Do we need this ??
|
|
||||||
// function ProcessMessage(Var Msg : TMsg) : Boolean;
|
|
||||||
procedure wndproc(var Message : TLMessage);
|
procedure wndproc(var Message : TLMessage);
|
||||||
|
procedure DoOnIdleEnd;
|
||||||
function GetExename: String;
|
function GetExename: String;
|
||||||
function GetIconHandle: HICON;
|
function GetIconHandle: HICON;
|
||||||
function GetTitle: string;
|
function GetTitle: string;
|
||||||
@ -450,6 +478,9 @@ type
|
|||||||
procedure Idle;
|
procedure Idle;
|
||||||
procedure MouseIdle(const CurrentControl: TControl);
|
procedure MouseIdle(const CurrentControl: TControl);
|
||||||
procedure SetIcon(AValue: TIcon);
|
procedure SetIcon(AValue: TIcon);
|
||||||
|
protected
|
||||||
|
procedure NotifyIdleHandler;
|
||||||
|
procedure NotifyIdleEndHandler;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -459,7 +490,8 @@ type
|
|||||||
function HandleAllocated: boolean;
|
function HandleAllocated: boolean;
|
||||||
procedure HandleException(Sender: TObject);
|
procedure HandleException(Sender: TObject);
|
||||||
procedure HandleMessage;
|
procedure HandleMessage;
|
||||||
procedure HintMouseMEssage(Control : TControl; var Message: TLMessage);
|
function IsWaiting: boolean;
|
||||||
|
procedure HintMouseMessage(Control : TControl; var Message: TLMessage);
|
||||||
property Icon: TIcon read FIcon write SetIcon;
|
property Icon: TIcon read FIcon write SetIcon;
|
||||||
procedure Initialize;
|
procedure Initialize;
|
||||||
function MessageBox(Text, Caption : PChar; Flags : Longint) : Integer;
|
function MessageBox(Text, Caption : PChar; Flags : Longint) : Integer;
|
||||||
@ -468,15 +500,28 @@ type
|
|||||||
procedure Run;
|
procedure Run;
|
||||||
procedure ShowException(E: Exception);
|
procedure ShowException(E: Exception);
|
||||||
procedure Terminate;
|
procedure Terminate;
|
||||||
|
procedure NotifyUserInputHandler;
|
||||||
|
procedure AddOnIdleHandler(AnOnIdleHandler: TNotifyEvent);
|
||||||
|
procedure RemoveOnIdleHandler(AnOnIdleHandler: TNotifyEvent);
|
||||||
|
procedure AddOnIdleEndHandler(AnOnIdleEndHandler: TNotifyEvent);
|
||||||
|
procedure RemoveOnIdleEndHandler(AnOnIdleEndHandler: TNotifyEvent);
|
||||||
|
procedure AddOnUserInputHandler(AnOnUserInputHandler: TNotifyEvent);
|
||||||
|
procedure RemoveOnUserInputHandler(AnOnUserInputHandler: TNotifyEvent);
|
||||||
|
public
|
||||||
property Exename: String read GetExeName;
|
property Exename: String read GetExeName;
|
||||||
property Handle: THandle read FHandle;
|
property Handle: THandle read FHandle;
|
||||||
property Terminated: Boolean read FTerminate;
|
property Terminated: Boolean read FTerminate;
|
||||||
property MainForm: TForm read FMainForm;
|
property MainForm: TForm read FMainForm;
|
||||||
property OnException: TExceptionEvent read FOnException write FOnException;
|
property OnException: TExceptionEvent read FOnException write FOnException;
|
||||||
property OnIdle: TIdleEvent read FOnIdle write FOnIdle;
|
property OnIdle: TIdleEvent read FOnIdle write FOnIdle;
|
||||||
|
property OnIdleEnd: TNotifyEvent read FOnIdleEnd write FOnIdleEnd;
|
||||||
|
property OnUserInput: TNotifyEvent read FOnUserInput write FOnUserInput;
|
||||||
property Title: String read GetTitle write FTitle;
|
property Title: String read GetTitle write FTitle;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TIDesigner }
|
||||||
|
|
||||||
TIDesigner = class(TObject)
|
TIDesigner = class(TObject)
|
||||||
public
|
public
|
||||||
function IsDesignMsg(Sender: TControl; var Message: TLMessage): Boolean;
|
function IsDesignMsg(Sender: TControl; var Message: TLMessage): Boolean;
|
||||||
@ -509,7 +554,8 @@ function FindRootDesigner(AComponent: TComponent): TIDesigner;
|
|||||||
|
|
||||||
function IsAccel(VK : Word; const Str : ShortString): Boolean;
|
function IsAccel(VK : Word; const Str : ShortString): Boolean;
|
||||||
|
|
||||||
function InitResourceComponent(Instance: TComponent; RootAncestor: TClass):Boolean;
|
function InitResourceComponent(Instance: TComponent;
|
||||||
|
RootAncestor: TClass):Boolean;
|
||||||
|
|
||||||
|
|
||||||
var
|
var
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user