mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 06:19:32 +02:00
add user data parameter to addeventhandler, that is passed to the given callback
git-svn-id: trunk@8188 -
This commit is contained in:
parent
66fe5731bf
commit
c85ee92754
@ -26,7 +26,8 @@
|
|||||||
}
|
}
|
||||||
//##apiwiz##sps## // Do not remove
|
//##apiwiz##sps## // Do not remove
|
||||||
|
|
||||||
procedure TWidgetSet.AddEventHandler(AHandle: THandle; AFlags: dword; AEventHandler: TWaitHandleEvent);
|
procedure TWidgetSet.AddEventHandler(AHandle: THandle; AFlags: dword;
|
||||||
|
AEventHandler: TWaitHandleEvent; AData: PtrInt);
|
||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -33,9 +33,10 @@
|
|||||||
******************************************************************************}
|
******************************************************************************}
|
||||||
//##apiwiz##sps## // Do not remove
|
//##apiwiz##sps## // Do not remove
|
||||||
|
|
||||||
procedure AddEventHandler(AHandle: THandle; AFlags: dword; AEventHandler: TWaitHandleEvent);
|
procedure AddEventHandler(AHandle: THandle; AFlags: dword;
|
||||||
|
AEventHandler: TWaitHandleEvent; AData: PtrInt = 0);
|
||||||
begin
|
begin
|
||||||
WidgetSet.AddEventHandler(AHandle, AFlags, AEventHandler);
|
WidgetSet.AddEventHandler(AHandle, AFlags, AEventHandler, AData);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure AttachMenuToWindow(AMenuObject: TComponent);
|
procedure AttachMenuToWindow(AMenuObject: TComponent);
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
******************************************************************************}
|
******************************************************************************}
|
||||||
//##apiwiz##sps## // Do not remove
|
//##apiwiz##sps## // Do not remove
|
||||||
|
|
||||||
procedure AddEventHandler(AHandle: THandle; AFlags: dword; AEventHandler: TWaitHandleEvent); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
procedure AddEventHandler(AHandle: THandle; AFlags: dword; AEventHandler: TWaitHandleEvent; AData: PtrInt); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
procedure AttachMenuToWindow(AMenuObject: TComponent); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
procedure AttachMenuToWindow(AMenuObject: TComponent); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
|
|
||||||
procedure CallDefaultWndHandler(Sender: TObject; var Message); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
procedure CallDefaultWndHandler(Sender: TObject; var Message); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
|
@ -38,7 +38,7 @@ uses
|
|||||||
|
|
||||||
type
|
type
|
||||||
TApplicationMainLoop = procedure of object;
|
TApplicationMainLoop = procedure of object;
|
||||||
TWaitHandleEvent = procedure(AHandle: THandle; AFlags: dword) of object;
|
TWaitHandleEvent = procedure(AData: PtrInt; AFlags: dword) of object;
|
||||||
|
|
||||||
{ TWidgetSet }
|
{ TWidgetSet }
|
||||||
|
|
||||||
|
@ -34,12 +34,12 @@ function waithandle_iocallback(source: PGIOChannel; condition: TGIOCondition;
|
|||||||
var
|
var
|
||||||
lEventHandler: PWaitHandleEventHandler absolute data;
|
lEventHandler: PWaitHandleEventHandler absolute data;
|
||||||
begin
|
begin
|
||||||
lEventHandler^.OnEvent(lEventHandler^.Handle, condition);
|
lEventHandler^.OnEvent(lEventHandler^.UserData, condition);
|
||||||
result := true;
|
result := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGtkWidgetSet.AddEventHandler(AHandle: THandle; AFlags: dword;
|
procedure TGtkWidgetSet.AddEventHandler(AHandle: THandle; AFlags: dword;
|
||||||
AEventHandler: TWaitHandleEvent);
|
AEventHandler: TWaitHandleEvent; AData: PtrInt);
|
||||||
var
|
var
|
||||||
giochannel: pgiochannel;
|
giochannel: pgiochannel;
|
||||||
lEventHandler: PWaitHandleEventHandler;
|
lEventHandler: PWaitHandleEventHandler;
|
||||||
@ -48,6 +48,7 @@ begin
|
|||||||
New(lEventHandler);
|
New(lEventHandler);
|
||||||
giochannel := g_io_channel_unix_new(AHandle);
|
giochannel := g_io_channel_unix_new(AHandle);
|
||||||
lEventHandler^.Handle := AHandle;
|
lEventHandler^.Handle := AHandle;
|
||||||
|
lEventHandler^.UserData := AData;
|
||||||
lEventHandler^.GIOChannel := giochannel;
|
lEventHandler^.GIOChannel := giochannel;
|
||||||
lEventHandler^.OnEvent := AEventHandler;
|
lEventHandler^.OnEvent := AEventHandler;
|
||||||
lEventHandler^.GSourceID := g_io_add_watch(giochannel,
|
lEventHandler^.GSourceID := g_io_add_watch(giochannel,
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//##apiwiz##sps## // Do not remove
|
//##apiwiz##sps## // Do not remove
|
||||||
procedure AddEventHandler(AHandle: THandle; AFlags: dword; AEventHandler: TWaitHandleEvent); override;
|
procedure AddEventHandler(AHandle: THandle; AFlags: dword;
|
||||||
|
AEventHandler: TWaitHandleEvent; AData: PtrInt); override;
|
||||||
function DrawSplitter(DC: HDC; const ARect: TRect; Horizontal: boolean): boolean; override;
|
function DrawSplitter(DC: HDC; const ARect: TRect; Horizontal: boolean): boolean; override;
|
||||||
|
|
||||||
function ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect;
|
function ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect;
|
||||||
|
@ -64,6 +64,7 @@ type
|
|||||||
Handle: THandle;
|
Handle: THandle;
|
||||||
GIOChannel: pgiochannel;
|
GIOChannel: pgiochannel;
|
||||||
GSourceID: guint;
|
GSourceID: guint;
|
||||||
|
UserData: PtrInt;
|
||||||
OnEvent: TWaitHandleEvent;
|
OnEvent: TWaitHandleEvent;
|
||||||
NextHandler: PWaitHandleEventHandler;
|
NextHandler: PWaitHandleEventHandler;
|
||||||
end;
|
end;
|
||||||
|
@ -101,6 +101,11 @@ Type
|
|||||||
dwICC: dword;
|
dwICC: dword;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TWaitHandler = record
|
||||||
|
UserData: PtrInt;
|
||||||
|
OnEvent: TWaitHandleEvent;
|
||||||
|
end;
|
||||||
|
|
||||||
{ Win32 interface-object class }
|
{ Win32 interface-object class }
|
||||||
TWin32WidgetSet = Class(TWidgetSet)
|
TWin32WidgetSet = Class(TWidgetSet)
|
||||||
Private
|
Private
|
||||||
@ -124,7 +129,7 @@ Type
|
|||||||
|
|
||||||
FWaitHandleCount: dword;
|
FWaitHandleCount: dword;
|
||||||
FWaitHandles: array of HANDLE;
|
FWaitHandles: array of HANDLE;
|
||||||
FWaitHandleCallbacks: array of TWaitHandleEvent;
|
FWaitHandlers: array of TWaitHandler;
|
||||||
|
|
||||||
FThemesActive: boolean;
|
FThemesActive: boolean;
|
||||||
FThemeLibrary: HMODULE;
|
FThemeLibrary: HMODULE;
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
|
|
||||||
//##apiwiz##sps## // Do not remove
|
//##apiwiz##sps## // Do not remove
|
||||||
|
|
||||||
procedure TWin32WidgetSet.AddEventHandler(AHandle: THandle; AFlags: dword; AEventHandler: TWaitHandleEvent);
|
procedure TWin32WidgetSet.AddEventHandler(AHandle: THandle; AFlags: dword;
|
||||||
|
AEventHandler: TWaitHandleEvent; AData: PtrInt);
|
||||||
var
|
var
|
||||||
listlen: dword;
|
listlen: dword;
|
||||||
begin
|
begin
|
||||||
@ -38,10 +39,11 @@ begin
|
|||||||
begin
|
begin
|
||||||
inc(listlen, 16);
|
inc(listlen, 16);
|
||||||
SetLength(FWaitHandles, listlen);
|
SetLength(FWaitHandles, listlen);
|
||||||
SetLength(FWaitHandleCallbacks, listlen);
|
SetLength(FWaitHandlers, listlen);
|
||||||
end;
|
end;
|
||||||
FWaitHandles[FWaitHandleCount] := AHandle;
|
FWaitHandles[FWaitHandleCount] := AHandle;
|
||||||
FWaitHandleCallbacks[FWaitHandleCount] := AEventHandler;
|
FWaitHandlers[FWaitHandleCount].UserData := AData;
|
||||||
|
FWaitHandlers[FWaitHandleCount].OnEvent := AEventHandler;
|
||||||
Inc(FWaitHandleCount);
|
Inc(FWaitHandleCount);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -56,7 +58,7 @@ begin
|
|||||||
if FWaitHandleCount >= 2 then
|
if FWaitHandleCount >= 2 then
|
||||||
begin
|
begin
|
||||||
FWaitHandles[I] := FWaitHandles[FWaitHandleCount-1];
|
FWaitHandles[I] := FWaitHandles[FWaitHandleCount-1];
|
||||||
FWaitHandleCallbacks[I] := FWaitHandleCallbacks[FWaitHandleCount-1];
|
FWaitHandlers[I] := FWaitHandlers[FWaitHandleCount-1];
|
||||||
end;
|
end;
|
||||||
Dec(FWaitHandleCount);
|
Dec(FWaitHandleCount);
|
||||||
exit;
|
exit;
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
|
|
||||||
//##apiwiz##sps## // Do not remove
|
//##apiwiz##sps## // Do not remove
|
||||||
|
|
||||||
procedure AddEventHandler(AHandle: THandle; AFlags: dword; AEventHandler: TWaitHandleEvent); override;
|
procedure AddEventHandler(AHandle: THandle; AFlags: dword;
|
||||||
|
AEventHandler: TWaitHandleEvent; AData: PtrInt); override;
|
||||||
|
|
||||||
procedure DrawArrow(Arrow: TComponent; Canvas: TPersistent); override;
|
procedure DrawArrow(Arrow: TComponent; Canvas: TPersistent); override;
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ begin
|
|||||||
if (WAIT_OBJECT_0 <= retVal) and (retVal < WAIT_OBJECT_0 + FWaitHandleCount) then
|
if (WAIT_OBJECT_0 <= retVal) and (retVal < WAIT_OBJECT_0 + FWaitHandleCount) then
|
||||||
begin
|
begin
|
||||||
index := retVal-WAIT_OBJECT_0;
|
index := retVal-WAIT_OBJECT_0;
|
||||||
FWaitHandleCallbacks[index](FWaitHandles[index], 0);
|
FWaitHandlers[index].OnEvent(FWaitHandlers[index].UserData, 0);
|
||||||
end else if retVal = WAIT_OBJECT_0 + FWaitHandleCount then
|
end else if retVal = WAIT_OBJECT_0 + FWaitHandleCount then
|
||||||
done := true;
|
done := true;
|
||||||
until done;
|
until done;
|
||||||
|
Loading…
Reference in New Issue
Block a user