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
procedure TWidgetSet.AddEventHandler(AHandle: THandle; AEventHandler: TNotifyEvent);
procedure TWidgetSet.AddEventHandler(AHandle: THandle; AFlags: dword; AEventHandler: TWaitHandleEvent);
begin
end;

View File

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

View File

@ -37,7 +37,7 @@
******************************************************************************}
//##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 CallDefaultWndHandler(Sender: TObject; var Message); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}

View File

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

View File

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

View File

@ -29,7 +29,7 @@
}
//##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 ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect;

View File

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

View File

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

View File

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

View File

@ -29,7 +29,7 @@
//##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;

View File

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