Creates an embedded OpenGL interface element that is a button. When selected, this element activates a function in the application. Its visual presentation can contain a text and/or an image. It inherits from IupGLLabel. It exists only inside an IupGLCanvasBox.
Ihandle* IupGLButton(const char *title); [in C]
iup.glbutton{[title = title: string]} -> elem: ihandle [in Lua]
glbutton(title) [in LED]
title: Text to be shown to the user. It can be NULL. It will set the TITLE
attribute.
Returns: the identifier of the created element, or NULL if an error occurs.
The IupGLButton element handle all attributes defined for the IupGLLabel control, and consequently for the IupGLSubCanvas control too.
BACKIMAGE (non inheritable): image name to be used as background. It will be zoomed to fill the background (it does not includes the border). Use IupSetHandle or IupSetAttributeHandle to associate an image to a name. See also IupImage. (since 3.11.2)
BACKIMAGEHIGHLIGHT (non inheritable): background image name of the element in highlight state. If it is not defined then the BACKIMAGE is used. (since 3.11.2)
BACKIMAGEINACTIVE (non inheritable): background image name of the element when inactive. If it is not defined then the BACKIMAGE is used and its colors will be replaced by a modified version creating the disabled effect. (since 3.11.2)
BACKIMAGEPRESS (non inheritable): background image name of the element in pressed state. If it is not defined then the BACKIMAGE is used.(since 3.11.2)
FGCOLOR: Text color. Can have an alpha component. Default: "0 0 0". If TITLE and IMAGE are both not defined then the button will show a color in a rectangle using this attribute (since 3.15).
FRONTIMAGE (non inheritable): image name to be used as foreground. It will be zoomed to fill the foreground (it does not includes the border). The foreground has the same are as the background, but it is drawn at last. Use IupSetHandle or IupSetAttributeHandle to associate an image to a name. See also IupImage. (since 3.11.2)
FITTOBACKIMAGE (non inheritable): enable the natural size to be computed from the BACKIMAGE. If BACKIMAGE is not defined will be ignored. When set to Yes it will set BORDERWIDTH to 0. Can be Yes or No. Default: No. (since 3.11.2)
FRONTIMAGEHIGHLIGHT (non inheritable): foreground image name of the element in highlight state. If it is not defined then the FRONTIMAGE is used. (since 3.11.2)
FRONTIMAGEINACTIVE (non inheritable): foreground image name of the element when inactive. If it is not defined then the FRONTIMAGE is used and its colors will be replaced by a modified version creating the disabled effect. (since 3.11.2)
FRONTIMAGEPRESS (non inheritable): foreground image name of the element in pressed state. If it is not defined then the FRONTIMAGE is used.(since 3.11.2)
The IupGLButton element handle all callbacks defined for the IupGLSubCanvas control.
ACTION: Action generated when the button 1 (usually left) is selected. This callback is called only after the mouse is released and when it is released inside the button area.
int function(Ihandle* ih); [in C]
elem:action() -> (ret: number) [in Lua]
ih: identifier of the element that activated the event.
Returns: IUP_CLOSE will be processed.
The difference between an IupGLButton and an IupGLLabel is the border (controlled by IupGLSubCanvas attributes BORDERWIDTH and BORDERCOLOR), the change in background color for state feedback (controlled by PRESSCOLOR and HLCOLOR attributes), and the callback to notify the application.
The natural size if the same as a IupGLLabel plus BORDERWIDTH.