GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
Enumerations | Functions
gp_widget_button.h File Reference

A button widget. More...

#include <widgets/gp_widget_bool.h>

Go to the source code of this file.

Enumerations

enum  gp_widget_button_type {
  GP_BUTTON_LABEL = 0 , GP_BUTTON_OK , GP_BUTTON_CANCEL , GP_BUTTON_YES ,
  GP_BUTTON_NO , GP_BUTTON_OPEN , GP_BUTTON_SAVE , GP_BUTTON_NEW_DIR ,
  GP_BUTTON_PREV , GP_BUTTON_NEXT , GP_BUTTON_FIRST , GP_BUTTON_LAST ,
  GP_BUTTON_TOP , GP_BUTTON_BOTTOM , GP_BUTTON_PLAY , GP_BUTTON_PAUSE ,
  GP_BUTTON_STOP , GP_BUTTON_REC , GP_BUTTON_FFORWARD , GP_BUTTON_FBACKWARD ,
  GP_BUTTON_STEP_FORWARD , GP_BUTTON_STEP_BACKWARD , GP_BUTTON_RANDOMIZE , GP_BUTTON_UP ,
  GP_BUTTON_DOWN , GP_BUTTON_LEFT , GP_BUTTON_RIGHT , GP_BUTTON_ADD ,
  GP_BUTTON_REM , GP_BUTTON_CLEAR , GP_BUTTON_BACKSPACE , GP_BUTTON_ZOOM_IN ,
  GP_BUTTON_ZOOM_OUT , GP_BUTTON_ZOOM_FIT , GP_BUTTON_ZOOM_NORMAL , GP_BUTTON_ROTATE_CW ,
  GP_BUTTON_ROTATE_CCW , GP_BUTTON_SETTINGS , GP_BUTTON_HOME , GP_BUTTON_DOWNLOAD ,
  GP_BUTTON_TYPE_MASK = 0x7fff , GP_BUTTON_ALIGN_MASK = 0x8000 , GP_BUTTON_TEXT_LEFT = 0x8000 , GP_BUTTON_TEXT_RIGHT = 0x0000
}
 A button type. More...
 

Functions

gp_widget * gp_widget_button_new (const char *label, enum gp_widget_button_type type)
 Allocates and initializes a new button widget.
 
static gp_widget * gp_widget_button_new2 (const char *label, enum gp_widget_button_type type, int(*on_event)(gp_widget_event *ev), void *priv)
 Allocates a initialize new button widget.
 
enum gp_widget_button_type gp_widget_button_type_get (gp_widget *self)
 Returns a button type.
 
void gp_widget_button_type_set (gp_widget *self, enum gp_widget_button_type type)
 Sets a button type.
 

Detailed Description

A button widget.

Definition in file gp_widget_button.h.

Enumeration Type Documentation

◆ gp_widget_button_type

A button type.

Buttons with a specific type include a stock image in the rendered button, they can have label as well but it's not required.

Enumerator
GP_BUTTON_LABEL 

Button just with a label

GP_BUTTON_OK 

An OK button

GP_BUTTON_CANCEL 

A Cancel button

GP_BUTTON_YES 

A Yes button

GP_BUTTON_NO 

A No button

Definition at line 29 of file gp_widget_button.h.

Function Documentation

◆ gp_widget_button_new()

gp_widget * gp_widget_button_new ( const char *  label,
enum gp_widget_button_type  type 
)

Allocates and initializes a new button widget.

Parameters
labelA button label.
typeA button type.
Returns
A button widget.

Referenced by gp_widget_button_new2().

◆ gp_widget_button_new2()

static gp_widget * gp_widget_button_new2 ( const char *  label,
enum gp_widget_button_type  type,
int(*)(gp_widget_event *ev)  on_event,
void *  priv 
)
inlinestatic

Allocates a initialize new button widget.

Parameters
labelA button label. Optional for buttons with type other than GP_BUTTON_LABEL.
typeA button type.
on_eventAn widget event handler.
privUser private data.
Returns
A button widget.

Definition at line 117 of file gp_widget_button.h.

References gp_widget_button_new().

◆ gp_widget_button_type_get()

enum gp_widget_button_type gp_widget_button_type_get ( gp_widget *  self)

Returns a button type.

The aligment is masked out of the return value.

Parameters
selfA button widget.
Returns
A button type.

◆ gp_widget_button_type_set()

void gp_widget_button_type_set ( gp_widget *  self,
enum gp_widget_button_type  type 
)

Sets a button type.

Parameters
selfA button widget.
typeNew button type.