CtkCheckMenuItem

CtkCheckMenuItem — A menu item with a check box

Functions

Properties

gboolean active Read / Write
gboolean draw-as-radio Read / Write
gboolean inconsistent Read / Write

Signals

void toggled Run First

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── CtkWidget
            ╰── CtkContainer
                ╰── CtkBin
                    ╰── CtkMenuItem
                        ╰── CtkCheckMenuItem
                            ╰── CtkRadioMenuItem

Implemented Interfaces

CtkCheckMenuItem implements AtkImplementorIface, CtkBuildable, CtkActivatable and CtkActionable.

Includes

#include <ctk/ctk.h>

Description

A CtkCheckMenuItem is a menu item that maintains the state of a boolean value in addition to a CtkMenuItem usual role in activating application code.

A check box indicating the state of the boolean value is displayed at the left side of the CtkMenuItem. Activating the CtkMenuItem toggles the value.

CSS nodes

1
2
3
menuitem
├── check.left
╰── <child>

CtkCheckMenuItem has a main CSS node with name menuitem, and a subnode with name check, which gets the .left or .right style class.

Functions

ctk_check_menu_item_new ()

CtkWidget *
ctk_check_menu_item_new (void);

Creates a new CtkCheckMenuItem.

Returns

a new CtkCheckMenuItem.


ctk_check_menu_item_new_with_label ()

CtkWidget *
ctk_check_menu_item_new_with_label (const gchar *label);

Creates a new CtkCheckMenuItem with a label.

Parameters

label

the string to use for the label.

 

Returns

a new CtkCheckMenuItem.


ctk_check_menu_item_new_with_mnemonic ()

CtkWidget *
ctk_check_menu_item_new_with_mnemonic (const gchar *label);

Creates a new CtkCheckMenuItem containing a label. The label will be created using ctk_label_new_with_mnemonic(), so underscores in label indicate the mnemonic for the menu item.

Parameters

label

The text of the button, with an underscore in front of the character

 

Returns

a new CtkCheckMenuItem


ctk_check_menu_item_get_active ()

gboolean
ctk_check_menu_item_get_active (CtkCheckMenuItem *check_menu_item);

Returns whether the check menu item is active. See ctk_check_menu_item_set_active().

Parameters

check_menu_item

a CtkCheckMenuItem

 

Returns

TRUE if the menu item is checked.


ctk_check_menu_item_set_active ()

void
ctk_check_menu_item_set_active (CtkCheckMenuItem *check_menu_item,
                                gboolean is_active);

Sets the active state of the menu item’s check box.

Parameters

check_menu_item

a CtkCheckMenuItem.

 

is_active

boolean value indicating whether the check box is active.

 

ctk_check_menu_item_toggled ()

void
ctk_check_menu_item_toggled (CtkCheckMenuItem *check_menu_item);

Emits the “toggled” signal.

Parameters

check_menu_item

a CtkCheckMenuItem.

 

ctk_check_menu_item_get_inconsistent ()

gboolean
ctk_check_menu_item_get_inconsistent (CtkCheckMenuItem *check_menu_item);

Retrieves the value set by ctk_check_menu_item_set_inconsistent().

Parameters

check_menu_item

a CtkCheckMenuItem

 

Returns

TRUE if inconsistent


ctk_check_menu_item_set_inconsistent ()

void
ctk_check_menu_item_set_inconsistent (CtkCheckMenuItem *check_menu_item,
                                      gboolean setting);

If the user has selected a range of elements (such as some text or spreadsheet cells) that are affected by a boolean setting, and the current values in that range are inconsistent, you may want to display the check in an “in between” state. This function turns on “in between” display. Normally you would turn off the inconsistent state again if the user explicitly selects a setting. This has to be done manually, ctk_check_menu_item_set_inconsistent() only affects visual appearance, it doesn’t affect the semantics of the widget.

Parameters

check_menu_item

a CtkCheckMenuItem

 

setting

TRUE to display an “inconsistent” third state check

 

ctk_check_menu_item_set_draw_as_radio ()

void
ctk_check_menu_item_set_draw_as_radio (CtkCheckMenuItem *check_menu_item,
                                       gboolean draw_as_radio);

Sets whether check_menu_item is drawn like a CtkRadioMenuItem

Parameters

check_menu_item

a CtkCheckMenuItem

 

draw_as_radio

whether check_menu_item is drawn like a CtkRadioMenuItem

 

Since: 2.4


ctk_check_menu_item_get_draw_as_radio ()

gboolean
ctk_check_menu_item_get_draw_as_radio (CtkCheckMenuItem *check_menu_item);

Returns whether check_menu_item looks like a CtkRadioMenuItem

Parameters

check_menu_item

a CtkCheckMenuItem

 

Returns

Whether check_menu_item looks like a CtkRadioMenuItem

Since: 2.4

Types and Values

struct CtkCheckMenuItem

struct CtkCheckMenuItem;

struct CtkCheckMenuItemClass

struct CtkCheckMenuItemClass {
  CtkMenuItemClass parent_class;

  void (* toggled)	  (CtkCheckMenuItem *check_menu_item);
  void (* draw_indicator) (CtkCheckMenuItem *check_menu_item,
			   cairo_t          *cr);
};

Members

toggled ()

Signal emitted when the state of the check box is changed.

 

draw_indicator ()

Called to draw the check indicator.

 

Property Details

The “active” property

  “active”                   gboolean

Whether the menu item is checked.

Owner: CtkCheckMenuItem

Flags: Read / Write

Default value: FALSE


The “draw-as-radio” property

  “draw-as-radio”            gboolean

Whether the menu item looks like a radio menu item.

Owner: CtkCheckMenuItem

Flags: Read / Write

Default value: FALSE


The “inconsistent” property

  “inconsistent”             gboolean

Whether to display an "inconsistent" state.

Owner: CtkCheckMenuItem

Flags: Read / Write

Default value: FALSE

Signal Details

The “toggled” signal

void
user_function (CtkCheckMenuItem *checkmenuitem,
               gpointer          user_data)

This signal is emitted when the state of the check box is changed.

A signal handler can use ctk_check_menu_item_get_active() to discover the new state.

Parameters

checkmenuitem

the object which received the signal.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First