MildenhallToggleButton

MildenhallToggleButton — Toggle button for MILDENHALL

Functions

Properties

MildenhallToggleButtonAlignmentType alignment-type Read / Write
gint current-state Read / Write
MildenhallToggleButtonDisplayType display-type Read / Write
gfloat height Read / Write
gboolean highlight Read / Write
GObject * state-model Read / Write
gfloat width Read / Write

Signals

void button-toggled No Recursion

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── ClutterActor
            ╰── LightwoodButton
                ╰── MildenhallToggleButton

Implemented Interfaces

MildenhallToggleButton implements ClutterContainer, ClutterScriptable, ClutterAnimatable and AtkImplementorIface.

Includes

#include <include/mildenhall_roller_container.h>

Description

MildenhallToggleButton widget can be used to display the options to user. One option among them can be selected and the info is communicated to the application. Model Contains:

  1. DISPLAY_FIRST

  2. DISPLAY_TEXT_ONLY

  3. DISPLAY_IMAGE_ONLY

  4. DISPLAY_TEXT_AND_IMAGE

  5. DISPLAY_LAST

Freeing the widget

Call g_object_unref() to free the widget.

Sample C Code

1
2
3
4
5
6
7
8
9
10
11
12
GObject *object = NULL;
ThornburyItemFactory *item_factory = NULL;
MildenhallToggleButton *toggle_button = NULL;

item_factory = thornbury_item_factory_generate_widget_with_props (
	MILDENHALL_TYPE_TOGGLE_BUTTON,
	"/usr/Application/MyApp/share/mildenhall_toggle_button_prop.json");

g_object_get (item_factory, "object", &object, NULL);
toggle_button = MILDENHALL_TOGGLE_BUTTON (object);

clutter_actor_add_child (stage, CLUTTER_ACTOR (toggle_button));

Refer ThornburyItemFactory for Thornbury Item Factory details.

Functions

mildenhall_toggle_button_new ()

ClutterActor *
mildenhall_toggle_button_new (void);

Creates a MildenhallToggleButton and type-casted to ClutterActor

Returns

a newly created MildenhallToggleButton object.

[transfer full]

Since: 0.3.0


mildenhall_toggle_button_set_display_type ()

void
mildenhall_toggle_button_set_display_type
                               (MildenhallToggleButton *self,
                                MildenhallToggleButtonDisplayType display_type);

Sets the Display type in the Toggle Button.

Parameters

self

a MildenhallToggleButton

 

display_type

the new value of MildenhallToggleButtonDisplay

 

mildenhall_toggle_button_set_text_alignment ()

void
mildenhall_toggle_button_set_text_alignment
                               (MildenhallToggleButton *self,
                                MildenhallToggleButtonAlignmentType alignment_type);

Sets the alignment of the text in the toggle button.

Parameters

self

a MildenhallToggleButton

 

alignment_type

the new MildenhallToggleAlignmentType value

 

mildenhall_toggle_button_set_current_state ()

void
mildenhall_toggle_button_set_current_state
                               (MildenhallToggleButton *pToggleButton,
                                gint inState);

Sets the current state of the toggle button.

Parameters

pToggleButton

toggle button object reference of type MildenhallToggleButton

 

inState

current state of the button of type gint

 

Since: 0.3.0


mildenhall_toggle_button_set_model ()

void
mildenhall_toggle_button_set_model (MildenhallToggleButton *pToggleButton,
                                    ThornburyModel *pModel);

Model contains the data to be displayed on the button. Toggle button model contains: 1. Text 2. Active Image Path 3. Normal Image Path 4. State ID If button has more than one row with above mentioned columns then arrows will be shown and button will be made reactive

Parameters

pToggleButton

a MildenhallToggleButton toggle button object reference

 

pModel

a ThornburyModel.

 

Since: 0.3.0


mildenhall_toggle_button_set_active ()

void
mildenhall_toggle_button_set_active (MildenhallToggleButton *pToggleButton,
                                     gboolean bState);

mildenhall_toggle_button_set_highlight ()

void
mildenhall_toggle_button_set_highlight
                               (MildenhallToggleButton *pToggleButton,
                                gboolean bHighLightState);

This method is to highlight a particular button with the given state.

Parameters

pToggleButton

a MildenhallToggleButton toggle button object reference

 

bHighLightState

highlight state of the button of type gboolean

 

mildenhall_toggle_button_get_width ()

gfloat
mildenhall_toggle_button_get_width (MildenhallToggleButton *pToggleButton);

Function to get the toggle button width

Parameters

pToggleButton

a MildenhallToggleButton toggle button object reference

 

Returns

width of the toggle button

Since: 0.3.0


mildenhall_toggle_button_get_height ()

gfloat
mildenhall_toggle_button_get_height (MildenhallToggleButton *pToggleButton);

Function to get the toggle button height

Parameters

pToggleButton

a MildenhallToggleButton toggle button object reference

 

Returns

height of the toggle button

Since: 0.3.0


mildenhall_toggle_button_get_display_type ()

MildenhallToggleButtonDisplayType
mildenhall_toggle_button_get_display_type
                               (MildenhallToggleButton *self);

Function to get the current display type of the button

Parameters

Returns

Display type of the button in MildenhallToggleButtonDisplayType


mildenhall_toggle_button_get_text_alignment ()

MildenhallToggleButtonAlignmentType
mildenhall_toggle_button_get_text_alignment
                               (MildenhallToggleButton *self);

Function to get the current text alignment

Parameters

Returns

MildenhallToggleButtonAlignmentType alignment the button.


mildenhall_toggle_button_get_current_state ()

gint
mildenhall_toggle_button_get_current_state
                               (MildenhallToggleButton *pToggleButton);

Function to get the toggle button current state

Parameters

pToggleButton

a MildenhallToggleButton

 

Returns

current state of the toggle button

Since: 0.3.0


mildenhall_toggle_button_get_model ()

ThornburyModel *
mildenhall_toggle_button_get_model (MildenhallToggleButton *pToggleButton);

Function to get the toggle button model

Parameters

pToggleButton

a MildenhallToggleButton

 

Returns

model of the toggle button. ( In ideal case: Call g_object_unref() on the returned object after use.).

[transfer none][nullable]

Since: 0.3.0


mildenhall_toggle_button_get_highlight ()

gboolean
mildenhall_toggle_button_get_highlight
                               (MildenhallToggleButton *pToggleButton);

Function to get the Active / normal state of button

Parameters

pToggleButton

a MildenhallToggleButton

 

Returns

TRUE if button highlighted, FALSE otherwise

Since: 0.3.0

Types and Values

struct MildenhallToggleButton

struct MildenhallToggleButton;

Mildenhall Toggle button Object .

Members


struct MildenhallToggleButtonClass

struct MildenhallToggleButtonClass {
	LightwoodButtonClass parent_class;

	void (* button_toggled) (GObject *pButton, gpointer* pStateId );
};

Mildenhall Toggle button Class .

Members

button_toggled ()

   

Property Details

The “alignment-type” property

  “alignment-type”           MildenhallToggleButtonAlignmentType

Property “alignment-type” will gives/sets the alignment of text

Flags: Read / Write

Default value: MILDENHALL_TOGGLE_BUTTON_ALIGNMENT_MIDDLE


The “current-state” property

  “current-state”            gint

Property “current-state” gives the current state of MildenhallToggleButton as state index Default: 0

Flags: Read / Write

Allowed values: >= 0

Default value: 0


The “display-type” property

  “display-type”             MildenhallToggleButtonDisplayType

“display-type” property sets or gets the display type of MildenhallToggleButton.

Flags: Read / Write

Default value: MILDENHALL_TOGGLE_BUTTON_DISPLAY_TEXT_ONLY


The “height” property

  “height”                   gfloat

Height of the MildenhallToggleButton

Flags: Read / Write

Allowed values: >= 0

Default value: 0


The “highlight” property

  “highlight”                gboolean

Use Property “highlight” to set or unset the highlight in MildenhallToggleButton.

In case of type TB_DISPLAY_IMAGE_ONLY or TB_DISPLAY_IMAGE_TEXT model should contain corresponding image. Default: FALSE

Flags: Read / Write

Default value: FALSE


The “state-model” property

  “state-model”              GObject *

model for the button states. If button model has more than one row, left/right arrows will be enabled model content:

  1. Text

  2. Active icon path,

  3. Normal icon path

  4. Unique State ID for corresponding states

Default: NULL

Flags: Read / Write


The “width” property

  “width”                    gfloat

Width of the MildenhallToggleButton

Flags: Read / Write

Allowed values: >= 0

Default value: 0

Signal Details

The “button-toggled” signal

void
user_function (MildenhallToggleButton *mildenhallToggleButton,
               gint                    oldState,
               gpointer                user_data)

button-toggled is emitted when button has multi-state and there is a change in the button state

Parameters

mildenhallToggleButton

The object which received the signal

 

oldState

name of the old state

 

newState

name of the new state

 

user_data

user data set when the signal handler was connected.

 

Flags: No Recursion

See Also

MildenhallButton, MildenhallButtonDrawer