add flags to AddEventHandler, socket and flags to callback

git-svn-id: trunk@8179 -
This commit is contained in:
micha 2005-11-16 19:12:10 +00:00
parent 740bdda6ff
commit 0cb86ee4af
11 changed files with 23 additions and 16 deletions

View File

@ -26,7 +26,7 @@
} }
//##apiwiz##sps## // Do not remove //##apiwiz##sps## // Do not remove
procedure TWidgetSet.AddEventHandler(AHandle: THandle; AEventHandler: TNotifyEvent); procedure TWidgetSet.AddEventHandler(AHandle: THandle; AFlags: dword; AEventHandler: TWaitHandleEvent);
begin begin
end; end;

View File

@ -33,9 +33,9 @@
******************************************************************************} ******************************************************************************}
//##apiwiz##sps## // Do not remove //##apiwiz##sps## // Do not remove
procedure AddEventHandler(AHandle: THandle; AEventHandler: TNotifyEvent); procedure AddEventHandler(AHandle: THandle; AFlags: dword; AEventHandler: TWaitHandleEvent);
begin begin
WidgetSet.AddEventHandler(AHandle, AEventHandler); WidgetSet.AddEventHandler(AHandle, AFlags, AEventHandler);
end; end;
procedure AttachMenuToWindow(AMenuObject: TComponent); procedure AttachMenuToWindow(AMenuObject: TComponent);

View File

@ -37,7 +37,7 @@
******************************************************************************} ******************************************************************************}
//##apiwiz##sps## // Do not remove //##apiwiz##sps## // Do not remove
procedure AddEventHandler(AHandle: THandle; AEventHandler: TNotifyEvent); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF} procedure AddEventHandler(AHandle: THandle; AFlags: dword; AEventHandler: TWaitHandleEvent); {$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}

View File

@ -38,6 +38,7 @@ uses
type type
TApplicationMainLoop = procedure of object; TApplicationMainLoop = procedure of object;
TWaitHandleEvent = procedure(AHandle: THandle; AFlags: dword) of object;
{ TWidgetSet } { TWidgetSet }

View File

@ -31,22 +31,27 @@
function waithandle_iocallback(source: PGIOChannel; condition: TGIOCondition; function waithandle_iocallback(source: PGIOChannel; condition: TGIOCondition;
data: gpointer): gboolean; cdecl; data: gpointer): gboolean; cdecl;
var
lEventHandler: PWaitHandleEventHandler absolute data;
begin begin
TNotifyEvent(data^)(WidgetSet); lEventHandler^.OnEvent(lEventHandler^.Handle, condition);
result := true;
end; end;
procedure TGtkWidgetSet.AddEventHandler(AHandle: THandle; AEventHandler: TNotifyEvent); procedure TGtkWidgetSet.AddEventHandler(AHandle: THandle; AFlags: dword;
AEventHandler: TWaitHandleEvent);
var var
giochannel: pgiochannel; giochannel: pgiochannel;
lEventHandler: PWaitHandleEventHandler; lEventHandler: PWaitHandleEventHandler;
begin begin
if AEventHandler = nil then exit;
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^.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,
G_IO_IN, @waithandle_iocallback, @lEventHandler^.OnEvent); AFlags, @waithandle_iocallback, lEventHandler);
lEventHandler^.NextHandler := FWaitHandles; lEventHandler^.NextHandler := FWaitHandles;
FWaitHandles := lEventHandler; FWaitHandles := lEventHandler;
end; end;

View File

@ -29,7 +29,7 @@
} }
//##apiwiz##sps## // Do not remove //##apiwiz##sps## // Do not remove
procedure AddEventHandler(AHandle: THandle; AEventHandler: TNotifyEvent); override; procedure AddEventHandler(AHandle: THandle; AFlags: dword; AEventHandler: TWaitHandleEvent); 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;

View File

@ -64,7 +64,7 @@ type
Handle: THandle; Handle: THandle;
GIOChannel: pgiochannel; GIOChannel: pgiochannel;
GSourceID: guint; GSourceID: guint;
OnEvent: TNotifyEvent; OnEvent: TWaitHandleEvent;
NextHandler: PWaitHandleEventHandler; NextHandler: PWaitHandleEventHandler;
end; end;

View File

@ -124,7 +124,7 @@ Type
FWaitHandleCount: dword; FWaitHandleCount: dword;
FWaitHandles: array of HANDLE; FWaitHandles: array of HANDLE;
FWaitHandleCallbacks: array of TNotifyEvent; FWaitHandleCallbacks: array of TWaitHandleEvent;
FThemesActive: boolean; FThemesActive: boolean;
FThemeLibrary: HMODULE; FThemeLibrary: HMODULE;

View File

@ -29,7 +29,7 @@
//##apiwiz##sps## // Do not remove //##apiwiz##sps## // Do not remove
procedure TWin32WidgetSet.AddEventHandler(AHandle: THandle; AEventHandler: TNotifyEvent); procedure TWin32WidgetSet.AddEventHandler(AHandle: THandle; AFlags: dword; AEventHandler: TWaitHandleEvent);
var var
listlen: dword; listlen: dword;
begin begin

View File

@ -29,7 +29,7 @@
//##apiwiz##sps## // Do not remove //##apiwiz##sps## // Do not remove
procedure AddEventHandler(AHandle: THandle; AEventHandler: TNotifyEvent); override; procedure AddEventHandler(AHandle: THandle; AFlags: dword; AEventHandler: TWaitHandleEvent); override;
procedure DrawArrow(Arrow: TComponent; Canvas: TPersistent); override; procedure DrawArrow(Arrow: TComponent; Canvas: TPersistent); override;

View File

@ -324,7 +324,7 @@ End;
procedure TWin32WidgetSet.AppWaitMessage; procedure TWin32WidgetSet.AppWaitMessage;
var var
done: boolean; done: boolean;
retVal: dword; retVal, index: dword;
begin begin
RedrawMenus; RedrawMenus;
Assert(False, 'Trace:TWin32WidgetSet.WaitMessage - Start'); Assert(False, 'Trace:TWin32WidgetSet.WaitMessage - Start');
@ -334,7 +334,8 @@ begin
FWaitHandles[0], false, INFINITE, QS_ALLINPUT); FWaitHandles[0], false, INFINITE, QS_ALLINPUT);
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
FWaitHandleCallbacks[retVal-WAIT_OBJECT_0](Self); index := retVal-WAIT_OBJECT_0;
FWaitHandleCallbacks[index](FWaitHandles[index], 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;