Lumiera
0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
menu-button.hpp
Go to the documentation of this file.
1
/*
2
MENU-BUTTON.hpp - button widget to invoke a menu
3
4
Copyright (C)
5
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
6
2012, Michael R. Fisher <mfisher31@gmail.com>
7
8
**Lumiera** is free software; you can redistribute it and/or modify it
9
under the terms of the GNU General Public License as published by the
10
Free Software Foundation; either version 2 of the License, or (at your
11
option) any later version. See the file COPYING for further details.
12
13
*/
14
15
23
#ifndef STAGE_WIDGET_MENU_BUTTON_H
24
#define STAGE_WIDGET_MENU_BUTTON_H
25
26
#include "
stage/gtk-base.hpp
"
27
28
29
30
namespace
stage
{
31
namespace
widget {
32
33
37
class
MenuButton
38
:
public
Gtk::ToggleButton
39
{
40
Gtk::HBox
hBox_
;
41
Gtk::Image
image_
;
42
Gtk::Label
caption_
;
43
Gtk::Arrow
arrow_
;
44
Gtk::Menu
menu_
;
45
46
Glib::RefPtr<Gtk::UIManager>
uimanager_
;
47
Glib::RefPtr<Gtk::ActionGroup>
actions_
;
48
49
public
:
58
MenuButton
();
59
65
MenuButton
(Gtk::StockID
const
& stock_id);
66
73
MenuButton
(
cuString
& label,
bool
mnemonic=
false
);
74
80
Gtk::Menu&
get_menu
();
81
89
void
append
(
uString
& slug,
uString
& title, sigc::slot<void>& callback,
bool
toggle=
false
);
90
91
99
void
append
(
CStr
slug,
CStr
title, sigc::slot<void>& callback,
bool
toggle=
false
);
100
101
103
void
appendSeparator
();
104
105
114
Gtk::Widget*
get
(
uString
slug);
115
116
118
void
popup
();
119
120
121
protected
:
125
void
setupButton
();
126
130
void
on_pressed
();
131
135
void
on_menu_deactivated
();
136
137
138
private
:
146
void
on_menu_position
(
int
& x,
int
& y,
bool
& push_in);
147
};
148
149
150
}}
// stage::widget
151
#endif
/*STAGE_WIDGET_MENU_BUTTON_H*/
stage::widget::MenuButton
A button that displays a menu when clicked on.
Definition
menu-button.hpp:39
stage::widget::MenuButton::setupButton
void setupButton()
An internal method which sets up the button at create time.
Definition
menu-button.cpp:148
stage::widget::MenuButton::caption_
Gtk::Label caption_
caption text label to show on the button.
Definition
menu-button.hpp:42
stage::widget::MenuButton::MenuButton
MenuButton()
Create an empty button.
Definition
menu-button.cpp:39
stage::widget::MenuButton::on_menu_position
void on_menu_position(int &x, int &y, bool &push_in)
callback function used to determine the correct position for the popup menu.
Definition
menu-button.cpp:190
stage::widget::MenuButton::on_menu_deactivated
void on_menu_deactivated()
An event handler for when the menu is closed.
Definition
menu-button.cpp:183
stage::widget::MenuButton::uimanager_
Glib::RefPtr< Gtk::UIManager > uimanager_
Definition
menu-button.hpp:46
stage::widget::MenuButton::actions_
Glib::RefPtr< Gtk::ActionGroup > actions_
Definition
menu-button.hpp:47
stage::widget::MenuButton::arrow_
Gtk::Arrow arrow_
arrow widget to be displayed to indicate a drop-down menu
Definition
menu-button.hpp:43
stage::widget::MenuButton::get
Gtk::Widget * get(uString slug)
Get an object from the Menu.
Definition
menu-button.cpp:74
stage::widget::MenuButton::append
void append(uString &slug, uString &title, sigc::slot< void > &callback, bool toggle=false)
Append a Menu Item to the Menu.
Definition
menu-button.cpp:95
stage::widget::MenuButton::menu_
Gtk::Menu menu_
internal menu object which is the popup menu of this widget.
Definition
menu-button.hpp:44
stage::widget::MenuButton::hBox_
Gtk::HBox hBox_
holds the layout of an image, caption and arrow.
Definition
menu-button.hpp:40
stage::widget::MenuButton::get_menu
Gtk::Menu & get_menu()
Gets the menu which will be displayed when the button is clicked on.
Definition
menu-button.cpp:84
stage::widget::MenuButton::image_
Gtk::Image image_
can optionally display an icon.
Definition
menu-button.hpp:41
stage::widget::MenuButton::popup
void popup()
Pops up the menu.
Definition
menu-button.cpp:138
stage::widget::MenuButton::appendSeparator
void appendSeparator()
Append a Gtk::SeparatorMenuItem to the Menu.
Definition
menu-button.cpp:127
stage::widget::MenuButton::on_pressed
void on_pressed()
An event handler for when the button is pressed.
Definition
menu-button.cpp:176
CStr
const char * CStr
Definition
error.hpp:42
gtk-base.hpp
A set of basic GTK includes for the UI.
stage
Lumiera GTK UI implementation root.
Definition
guifacade.cpp:37
stage::cuString
const uString cuString
Definition
gtk-base.hpp:93
stage::uString
Glib::ustring uString
Definition
gtk-base.hpp:92
stage
widget
menu-button.hpp
Generated on Thu Dec 11 2025 for Lumiera by
1.9.8