Action generated when a mouse button is pressed or released.
int function(Ihandle* ih, int button, int pressed, int x, int y, char* status); [in C] elem:button_cb(but, pressed, x, y: number, status: string) -> (ret: number) [in Lua]
ih:
identifies the element that activated the
event.
button: identifies the activated mouse button:
IUP_BUTTON1 - left mouse button (button 1);
IUP_BUTTON2 - middle mouse button (button 2);
IUP_BUTTON3 - right mouse button (button 3).
pressed: boolean that indicates the state of the button:
0 - mouse button was released;
1 - mouse button was pressed.
x, y:
position in the canvas where the event has
occurred, in pixels.
status:
status of the mouse buttons and some
keyboard keys at the moment the event is generated. The following macros must be used for verification:
iup_isshift(status)
iup_iscontrol(status)
iup_isbutton1(status)
iup_isbutton2(status)
iup_isbutton3(status)
iup_isbutton4(status)
iup_isbutton5(status)
iup_isdouble(status)
iup_isalt(status)
iup_issys(status)They return 1 if the respective key or button is pressed, and 0 otherwise. These macros are also available in Lua, returning a boolean.
Returns: IUP_CLOSE will be processed. On some controls if IUP_IGNORE is returned the action is ignored (this is system dependent).
This callback can be used to customize a button behavior. For a standard button behavior use the ACTION callback of the IupButton.
In general a double click, is preceded by a single click/unclick calls. In GTK, the double click is preceded by an additional single click call.