void hw_PostEvent(int type, APTR userdata);
hw_PostEvent()
could only be used with event types that had been registered using
hw_RegisterEventHandler(). Starting with Hollywood 6.0
hw_PostEvent()
supports several new event types. Here is a list:
HWEVT_QUIT:
HWEVT_QUIT
will shut down Hollywood as soon
as it runs its event handler. To make Hollywood quit immediately, you can set
the global quit flag using HWMCP_SETGLOBALQUIT
. See hw_MasterControl for details. (V6.0)
HWEVT_CALLFUNCTION:
WaitEvent()
or CheckEvent()
cycle. You have to pass a pointer to a
struct hwEvtCallFunction
in the user data parameter. struct hwEvtCallFunction
looks like this:
struct hwEvtCallFunction { int (*Func)(lua_State *L, APTR userdata); APTR UserData; }; |
The following members are part of struct hwEvtCallFunction
:
Func:
lua_State
and the user data you specify below to your
function.
UserData:
(V6.0)
HWEVT_WAKEUP:
HWEVT_MOUSE:
HWEVT_MOUSE
posts
a mouse event to Hollywood's event queue. You have to pass a pointer to a struct hwEvtMouse
in the user data parameter. struct hwEvtMouse
looks like this:
struct hwEvtMouse { APTR Handle; int X; int Y; int Button; int Down; ULONG Flags; }; |
The following members are part of struct hwEvtMouse
:
Handle:
X:
Y:
Button:
Down
member of struct hwEvtMouse
is referring to. The following
button types are currently defined:
HWMBTYPE_NONE:
Down
is unused.
HWMBTYPE_LEFT:
Down
contains the current state of the left mouse button.
HWMBTYPE_RIGHT:
Down
contains the current state of the right mouse button.
HWMBTYPE_MIDDLE:
Down
contains the current state of the middle mouse button.
Down:
Button
does not equal HWBMTYPE_NONE
, this member needs to be set to either
True
or False
depending on whether the corresponding mouse button is currently
down or up.
Flags:
(V6.0)
HWEVT_MOUSEWHEEL:
HWEVT_MOUSEWHEEL
posts
a mouse wheel event to Hollywood's event queue. You have to pass a pointer to a struct hwEvtMouseWheel
in the user data parameter. struct hwEvtMouseWheel
looks like this:
struct hwEvtMouseWheel { APTR Handle; int X; int Y; ULONG Flags; }; |
The following members are part of struct hwEvtMouseWheel
:
Handle:
X:
Y:
Flags:
(V8.0)
HWEVT_KEYBOARD:
HWEVT_KEYBOARD
posts
a keyboard event to Hollywood's event queue. You have to pass a pointer to a struct hwEvtKeyboard
in the user data parameter. struct hwEvtKeyboard
looks like this:
struct hwEvtKeyboard { APTR Handle; int ID; int Down; ULONG Qualifiers; ULONG Flags; }; |
The following members are part of struct hwEvtKeyboard
:
Handle:
ID:
HWKEY_CURSOR_UP HWKEY_CURSOR_DOWN HWKEY_CURSOR_RIGHT HWKEY_CURSOR_LEFT HWKEY_HELP HWKEY_F1 HWKEY_F2 HWKEY_F3 HWKEY_F4 HWKEY_F5 HWKEY_F6 HWKEY_F7 HWKEY_F8 HWKEY_F9 HWKEY_F10 HWKEY_F11 HWKEY_F12 HWKEY_F13 HWKEY_F14 HWKEY_F15 HWKEY_F16 HWKEY_BACKSPACE HWKEY_TAB HWKEY_ENTER HWKEY_RETURN HWKEY_ESC HWKEY_SPACE HWKEY_DEL HWKEY_INSERT HWKEY_HOME HWKEY_END HWKEY_PAGEUP HWKEY_PAGEDOWN HWKEY_PRINT HWKEY_PAUSE |
Down:
True
or False
indicating whether the specified
key is currently pressed.
Qualifiers:
HWKEY_QUAL_MASK
must always be set.
Flags:
Note that HWEVT_KEYBOARD
can only be used for ISO 8859-1 characters and control
keys. To post a Unicode key to Hollywood's event queue, use HWEVT_VANILLAKEY
instead (see below for details). (V6.0)
HWEVT_RAWKEY:
HWEVT_RAWKEY
posts
a raw keyboard event to Hollywood's event queue. You have to pass a pointer to a struct hwEvtKeyboard
in the user data parameter. struct hwEvtKeyboard
looks like this:
struct hwEvtKeyboard { APTR Handle; int ID; int Down; ULONG Qualifiers; ULONG Flags; }; |
The following members are part of struct hwEvtKeyboard
:
Handle:
ID:
HWKEY_XXX
keys listed above in HWEVT_KEYBOARD
, the ASCII codes A-Z and 0-9 or
one of the following special raw keys:
HWKEY_NP0 HWKEY_NP1 HWKEY_NP2 HWKEY_NP3 HWKEY_NP4 HWKEY_NP5 HWKEY_NP6 HWKEY_NP7 HWKEY_NP8 HWKEY_NP9 HWKEY_NPMUL HWKEY_NPADD HWKEY_NPSUB HWKEY_NPDEC HWKEY_NPDIV HWKEY_LSHIFT HWKEY_RSHIFT HWKEY_LALT HWKEY_RALT HWKEY_LCOMMAND HWKEY_RCOMMAND HWKEY_LCONTROL HWKEY_RCONTROL |
Down:
True
or False
indicating whether the specified
key is currently pressed.
Qualifiers:
HWKEY_QUAL_MASK
must always be set.
Flags:
(V7.1)
HWEVT_VANILLAKEY:
HWEVT_VANILLAKEY
posts
a keyboard event to Hollywood's event queue. In contrast to HWEVT_KEYBOARD
, HWEVT_VANILLAKEY
must only be used to post printable characters (including the space character). It must not be
used for control keys. These should be posted as HWEVT_KEYBOARD
and HWEVT_RAWKEY
events (see above for
details). In contrast to HWEVT_KEYBOARD
, HWEVT_VANILLAKEY
supports the full Unicode character
range. You have to pass a pointer to a struct hwEvtKeyboard
in the user data parameter.
struct hwEvtKeyboard
looks like this:
struct hwEvtKeyboard { APTR Handle; int ID; int Down; ULONG Qualifiers; ULONG Flags; }; |
The following members are part of struct hwEvtKeyboard
:
Handle:
ID:
Down:
HWEVT_VANILLAKEY
.
Qualifiers:
HWEVT_VANILLAKEY
.
Flags:
(V7.0)
HWEVT_CLOSEDISPLAY:
HWEVT_CLOSEDISPLAY
posts
a close display event to Hollywood's event queue. This event is usually posted when the user presses
the window's close widget. You have to pass a pointer to a struct hwEvtCloseDisplay
in the user data parameter. struct hwEvtCloseDisplay
looks like this:
struct hwEvtCloseDisplay { APTR Handle; ULONG Flags; }; |
The following members are part of struct hwEvtCloseDisplay
:
Handle:
Flags:
(V6.0)
HWEVT_SIZEDISPLAY:
HWEVT_SIZEDISPLAY
posts
a size display event to Hollywood's event queue. This event is usually posted when the user changes
the size of the window. You have to pass a pointer to a struct hwEvtSizeDisplay
in the user data parameter. struct hwEvtSizeDisplay
looks like this:
struct hwEvtSizeDisplay { APTR Handle; int Width; int Height; ULONG Flags; }; |
The following members are part of struct hwEvtSizeDisplay
:
Handle:
Width:
Height:
Flags:
(V6.0)
HWEVT_MOVEDISPLAY:
HWEVT_MOVEDISPLAY
posts
a move display event to Hollywood's event queue. This event is usually posted when the user moves
the window around. You have to pass a pointer to a struct hwEvtMoveDisplay
in the user data parameter. struct hwEvtMoveDisplay
looks like this:
struct hwEvtMoveDisplay { APTR Handle; int X; int Y; ULONG Flags; }; |
The following members are part of struct hwEvtMoveDisplay
:
Handle:
X:
Y:
Flags:
(V6.0)
HWEVT_SHOWHIDEDISPLAY:
HWEVT_SHOWHIDEDISPLAY
posts
a show/hide display event to Hollywood's event queue. This event is usually posted when the user minimizes
the window or restores it from a minimized state. You have to pass a pointer to a struct hwEvtShowHideDisplay
in the user data parameter. struct hwEvtShowHideDisplay
looks like this:
struct hwEvtShowHideDisplay { APTR Handle; int Show; ULONG Flags; }; |
The following members are part of struct hwEvtShowHideDisplay
:
Handle:
Show:
False
if the display has been minimized/hidden and True
if it
has been restored from a minimized/hidden state.
Flags:
(V6.0)
HWEVT_FOCUSCHANGEDISPLAY:
HWEVT_FOCUSCHANGEDISPLAY
posts
a focus change display event to Hollywood's event queue. This event is usually posted when the window
loses or gets the focus. You have to pass a pointer to a struct hwEvtFocusChangeDisplay
in the user data parameter. struct hwEvtFocusChangeDisplay
looks like this:
struct hwEvtFocusChangeDisplay { APTR Handle; int Focus; ULONG Flags; }; |
The following members are part of struct hwEvtFocusChangeDisplay
:
Handle:
Focus:
False
if the display has lost the focus and True
if it
has received the focus.
Flags:
(V6.0)
HWEVT_DROPFILE:
HWEVT_DROPFILE
can be used
to post an event to Hollywood's event queue which indicates that files have been dropped on a
Hollywood display. You have to pass a pointer to a struct hwEvtDropFile
in the user data
parameter. struct hwEvtDropFile
looks like this:
struct hwEvtDropFile { APTR Handle; int MouseX; int MouseY; STRPTR DropFiles; ULONG Flags; }; |
The following members are part of struct hwEvtDropFile
:
Handle:
MouseX:
MouseY:
DropFiles:
NULL
terminator byte whereas the complete list is terminated by two NULL
terminator bytes
to signal the list end to Hollywood. Warning: You must use hw_TrackedAlloc()
to allocate this list and you must not free it. Hollywood will take care of freeing it!
Flags:
(V7.0)
HWEVT_MENUITEM:
struct hwEvtMenuItem
in the user data
parameter. struct hwEvtMenuItem
looks like this:
struct hwEvtMenuItem { APTR Handle; APTR Item; ULONG Flags; }; |
The following members are part of struct hwEvtMenuItem
:
Handle:
Item:
struct hwMenuTreeInfo
pointer of the
menu item that has been selected.
Flags:
HWMENUFLAGS_SELECTED
flag here whenever the item is selected. Otherwise set this to 0.
(V9.0)
HWEVT_USERMESSAGE:
struct hwEvtUserMessage
in the user data parameter. struct hwEvtUserMessage
looks like this:
struct hwEvtUserMessage { APTR Data; int DataSize; ULONG Flags; }; |
The following members are part of struct hwEvtUserMessage
:
Data:
DataSize:
Data
member, in bytes.
Flags:
(V9.0)
HWEVT_TRAYICON:
HWEXT_DISPLAYADAPTER_TRAYICON
extension bit must post this event whenever the user clicks on the tray icon.
The user data parameter is unused for this event. (V9.0)
Alternatively, you can also specify a custom event type that you have registered through hw_RegisterEventHandler() in parameter 1. In that case, the user data pointer you pass in parameter 2 is directly forwarded to your custom event's handler function. See hw_RegisterEventHandler for details.
Starting with Hollywood 6.0 this function has an extended version named hw_PostEventEx().
In contrast to hw_PostEvent()
, the extended version will tell you whether the event was
successfully posted. See hw_PostEventEx for details.
This function is thread-safe.