MenuButton

The GtkMenuButton widget is used to display a menu when clicked on. This menu can be provided either as a GtkMenu, or an abstract GMenuModel.

The GtkMenuButton widget can hold any valid child widget. That is, it can hold almost any other standard GtkWidget. The most commonly used child is the provided GtkArrow.

The positioning of the menu is determined by the "direction" property of the menu button and the "halign" or "valign" properties of the menu. For example, when the direction is GTK_ARROW_DOWN and the horizontal alignment is GTK_ALIGN_START, the menu will be positioned below the button, with the starting edge (depending on the text direction) of the menu aligned with the starting edge of the button. If there is not enough space below the button, the menu is popped up above the button instead. If the alignment would move part of the menu offscreen, it is 'pushed in'.

halign = start halign = center halign = end

direction = down

direction = up

direction = left direction = right

valign = start

valign = center

valign = end

Constructors

this
this(GtkMenuButton* gtkMenuButton)

Sets our main struct and passes it to the parent class

this
this()

Creates a new GtkMenuButton widget with downwards-pointing arrow as the only child. You can replace the child widget with another GtkWidget should you wish to.

Members

Functions

getAlignWidget
Widget getAlignWidget()

Returns the parent GtkWidget to use to line up with menu.

getMenuButtonStruct
GtkMenuButton* getMenuButtonStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getMenuDirection
GtkArrowType getMenuDirection()

Returns the direction the menu will be pointing at when popped up.

getMenuModel
MenuModel getMenuModel()

Returns the GMenuModel used to generate the menu.

getPopup
Menu getPopup()

Returns the GtkMenu that pops out of the button.

getStruct
void* getStruct()

the main Gtk struct as a void*

setAlignWidget
void setAlignWidget(Widget alignWidget)

Sets the GtkWidget to use to line the menu with when popped up. Note that the align_widget must contain the GtkMenuButton itself. Setting it to NULL means that the popup menu will be aligned with the button itself.

setMenuDirection
void setMenuDirection(GtkArrowType direction)

Sets the direction in which the menu will be popped up, as well as changing the arrow's direction. The child will not be changed to an arrow if it was customized. If the menu when popped out would have collided with screen edges, we will do our best to keep it inside the screen and fully visible. If you pass GTK_ARROW_NONE for a direction, the menu will behave as if you passed GTK_ARROW_DOWN (although you won't see any arrows).

setMenuModel
void setMenuModel(MenuModel menuModel)

Sets the GMenuModel from which the "popup" property will be filled in, or NULL to disable the button. The GtkMenu will be created with gtk_menu_new_from_model(), so actions will be connected as documented there. If "popup" is already set, then its content will be lost and replaced by our newly created GtkMenu.

setPopup
void setPopup(Widget popup)

Sets the GtkMenu that will be popped up when the button is clicked, or NULL to disable the button. If "menu-model" is set, it will be set to NULL.

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

gtkMenuButton
GtkMenuButton* gtkMenuButton;

the main Gtk struct

Inherited Members

From ToggleButton

gtkToggleButton
GtkToggleButton* gtkToggleButton;

the main Gtk struct

getToggleButtonStruct
GtkToggleButton* getToggleButtonStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
connectedSignals
int[string] connectedSignals;
onToggledListeners
void delegate(ToggleButton)[] onToggledListeners;
Undocumented in source.
addOnToggled
void addOnToggled(void delegate(ToggleButton) dlg, ConnectFlags connectFlags)

Should be connected if you wish to perform an action whenever the GtkToggleButton's state is changed. See Also GtkButton, GtkCheckButton, GtkCheckMenuItem

callBackToggled
void callBackToggled(GtkToggleButton* togglebuttonStruct, ToggleButton _toggleButton)
Undocumented in source. Be warned that the author may not have intended to support it.
setMode
void setMode(int drawIndicator)

Sets whether the button is displayed as a separate indicator and label. You can call this function on a checkbutton or a radiobutton with draw_indicator = FALSE to make the button look like a normal button This function only affects instances of classes like GtkCheckButton and GtkRadioButton that derive from GtkToggleButton, not instances of GtkToggleButton itself.

getMode
int getMode()

Retrieves whether the button is displayed as a separate indicator and label. See gtk_toggle_button_set_mode().

toggled
void toggled()

Emits the "toggled" signal on the GtkToggleButton. There is no good reason for an application ever to call this function.

getActive
int getActive()

Queries a GtkToggleButton and returns its current state. Returns TRUE if the toggle button is pressed in and FALSE if it is raised.

setActive
void setActive(int isActive)

Sets the status of the toggle button. Set to TRUE if you want the GtkToggleButton to be 'pressed in', and FALSE to raise it. This action causes the "toggled" signal and the "clicked" signal to be emitted.

getInconsistent
int getInconsistent()

Gets the value set by gtk_toggle_button_set_inconsistent().

setInconsistent
void setInconsistent(int setting)

If the user has selected a range of elements (such as some text or spreadsheet cells) that are affected by a toggle button, and the current values in that range are inconsistent, you may want to display the toggle in an "in between" state. This function turns on "in between" display. Normally you would turn off the inconsistent state again if the user toggles the toggle button. This has to be done manually, gtk_toggle_button_set_inconsistent() only affects visual appearance, it doesn't affect the semantics of the button.

Meta