CtkButton

CtkButton — A widget that presents a button interface include ctk-button.h

Synopsis

                    CtkButton;
                    CtkButtonClass;
                    CtkButtonPrivate;
ClutterActor *      ctk_button_new                      (CtkOrientation orientation);
void                ctk_button_set_label                (CtkButton *button,
                                                         const gchar *label);
const gchar *       ctk_button_get_label                (CtkButton *button);
void                ctk_button_set_image                (CtkButton *button,
                                                         CtkImage *image);
CtkImage *          ctk_button_get_image                (CtkButton *button);
void                ctk_button_set_text                 (CtkButton *button,
                                                         CtkText *text);
CtkText *           ctk_button_get_text                 (CtkButton *button);
void                ctk_button_set_orientation          (CtkButton *button,
                                                         CtkOrientation orient);
CtkOrientation      ctk_button_get_orientation          (CtkButton *button);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----ClutterActor
               +----CtkActor
                     +----CtkBin
                           +----CtkButton

Implemented Interfaces

CtkButton implements ClutterScriptable, CtkFocusable and ClutterContainer.

Properties

  "image"                    CtkImage*             : Read / Write
  "label"                    gchar*                : Read / Write
  "orientation"              gint                  : Read / Write

Signals

  "clicked"                                        : Run Last
  "show-context-menu"                              : Run Last

Description

CtkButton is used to present a classical "button" interface and to provide appropriate signals when it is clicked on Typically a CtkButton will/can hold a CtkText and CtkImage at the same time.

Details

CtkButton

typedef struct _CtkButton CtkButton;


CtkButtonClass

typedef struct {
  CtkBinClass   parent_class;

  /*< signals />*/
  void (*clicked)           (CtkButton *item);
  void (*show_context_menu) (CtkButton *item, guint32 event_time);
} CtkButtonClass;


CtkButtonPrivate

typedef struct _CtkButtonPrivate CtkButtonPrivate;


ctk_button_new ()

ClutterActor *      ctk_button_new                      (CtkOrientation orientation);

Creates a new CtkButton object

orientation :

a CtkOrientation defining horizontal or virtical orientation

Returns :

A new CtkButton object

ctk_button_set_label ()

void                ctk_button_set_label                (CtkButton *button,
                                                         const gchar *label);

Sets the label of the button to label This will clear any previously set labels

button :

a CtkButton

label :

A string containing the label text

ctk_button_get_label ()

const gchar *       ctk_button_get_label                (CtkButton *button);

This will fetch the text from the label of button, if the label has not been set with ctk_button_set_label() then this will return NULL

button :

a CtkButton

Returns :

gchar string representing the text or NULL

ctk_button_set_image ()

void                ctk_button_set_image                (CtkButton *button,
                                                         CtkImage *image);

Attaches image to button with respect to the buttons Orientation

button :

A CtkButton

image :

A CtkImage to be attached to button

ctk_button_get_image ()

CtkImage *          ctk_button_get_image                (CtkButton *button);

returns the GtkImage that is attached to button. see also: ctk_button_set_image()

button :

A CtkButton

Returns :

a CtkImage;

ctk_button_set_text ()

void                ctk_button_set_text                 (CtkButton *button,
                                                         CtkText *text);

Attaches text to button with respect to button orientation

button :

A CtkButton

text :

a CtkText object to attach to button

ctk_button_get_text ()

CtkText *           ctk_button_get_text                 (CtkButton *button);

gets the CtkText object that is attached to button. see also: ctk_button_set_text()

button :

A CtkButton

Returns :

a CtkText object;

ctk_button_set_orientation ()

void                ctk_button_set_orientation          (CtkButton *button,
                                                         CtkOrientation orient);

CtkButton can be orientated either horizontaly or vertically and can be set / using this function, CTK_ORIENTATION_HORIZONTAL will prefer to line label/image / in a row, whist CTK_ORIENTATION_VERTICAL will prefer to stack in a column. see also: CtkOrientation

button :

A CtkButton

orient :

A CtkOrientation regarding button orientation

ctk_button_get_orientation ()

CtkOrientation      ctk_button_get_orientation          (CtkButton *button);

Returns the orientation of button. see also: ctk_button_set_orientation()

button :

A CtkButton

Returns :

a CtkOrientation object

Property Details

The "image" property

  "image"                    CtkImage*             : Read / Write

LabelImage shown inside the ctk.


The "label" property

  "label"                    gchar*                : Read / Write

Text of the label inside the button.

Default value: NULL


The "orientation" property

  "orientation"              gint                  : Read / Write

Orientation of the button and it's contents.

Allowed values: [0,1]

Default value: 0

Signal Details

The "clicked" signal

void                user_function                      (CtkButton *ctkbutton,
                                                        gpointer   user_data)      : Run Last

ctkbutton :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

The "show-context-menu" signal

void                user_function                      (CtkButton *ctkbutton,
                                                        guint      arg1,
                                                        gpointer   user_data)      : Run Last

ctkbutton :

the object which received the signal.

arg1 :

user_data :

user data set when the signal handler was connected.