1/* GTK - The GIMP Toolkit
2 *
3 * Copyright (C) 2003 Ricardo Fernandez Pascual
4 * Copyright (C) 2004 Paolo Borelli
5 * Copyright (C) 2012 Bastien Nocera
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef __GTK_MENU_BUTTON_H__
22#define __GTK_MENU_BUTTON_H__
23
24#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
25#error "Only <gtk/gtk.h> can be included directly."
26#endif
27
28#include <gtk/gtktogglebutton.h>
29#include <gtk/gtkpopover.h>
30
31G_BEGIN_DECLS
32
33#define GTK_TYPE_MENU_BUTTON (gtk_menu_button_get_type ())
34#define GTK_MENU_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_BUTTON, GtkMenuButton))
35#define GTK_IS_MENU_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU_BUTTON))
36
37typedef struct _GtkMenuButton GtkMenuButton;
38
39/**
40 * GtkMenuButtonCreatePopupFunc:
41 * @menu_button: the `GtkMenuButton`
42 * @user_data: User data passed to gtk_menu_button_set_create_popup_func()
43 *
44 * User-provided callback function to create a popup for a
45 * `GtkMenuButton` on demand.
46 *
47 * This function is called when the popup of @menu_button is shown,
48 * but none has been provided via [method@Gtk.MenuButton.set_popover]
49 * or [method@Gtk.MenuButton.set_menu_model].
50 */
51typedef void (*GtkMenuButtonCreatePopupFunc) (GtkMenuButton *menu_button,
52 gpointer user_data);
53
54GDK_AVAILABLE_IN_ALL
55GType gtk_menu_button_get_type (void) G_GNUC_CONST;
56GDK_AVAILABLE_IN_ALL
57GtkWidget *gtk_menu_button_new (void);
58
59GDK_AVAILABLE_IN_ALL
60void gtk_menu_button_set_popover (GtkMenuButton *menu_button,
61 GtkWidget *popover);
62GDK_AVAILABLE_IN_ALL
63GtkPopover *gtk_menu_button_get_popover (GtkMenuButton *menu_button);
64
65GDK_AVAILABLE_IN_ALL
66void gtk_menu_button_set_direction (GtkMenuButton *menu_button,
67 GtkArrowType direction);
68GDK_AVAILABLE_IN_ALL
69GtkArrowType gtk_menu_button_get_direction (GtkMenuButton *menu_button);
70
71GDK_AVAILABLE_IN_ALL
72void gtk_menu_button_set_menu_model (GtkMenuButton *menu_button,
73 GMenuModel *menu_model);
74GDK_AVAILABLE_IN_ALL
75GMenuModel *gtk_menu_button_get_menu_model (GtkMenuButton *menu_button);
76
77GDK_AVAILABLE_IN_ALL
78void gtk_menu_button_set_icon_name (GtkMenuButton *menu_button,
79 const char *icon_name);
80GDK_AVAILABLE_IN_ALL
81const char * gtk_menu_button_get_icon_name (GtkMenuButton *menu_button);
82
83GDK_AVAILABLE_IN_4_4
84void gtk_menu_button_set_always_show_arrow (GtkMenuButton *menu_button,
85 gboolean always_show_arrow);
86GDK_AVAILABLE_IN_4_4
87gboolean gtk_menu_button_get_always_show_arrow (GtkMenuButton *menu_button);
88
89GDK_AVAILABLE_IN_ALL
90void gtk_menu_button_set_label (GtkMenuButton *menu_button,
91 const char *label);
92GDK_AVAILABLE_IN_ALL
93const char * gtk_menu_button_get_label (GtkMenuButton *menu_button);
94
95GDK_AVAILABLE_IN_ALL
96void gtk_menu_button_set_use_underline (GtkMenuButton *menu_button,
97 gboolean use_underline);
98GDK_AVAILABLE_IN_ALL
99gboolean gtk_menu_button_get_use_underline (GtkMenuButton *menu_button);
100
101GDK_AVAILABLE_IN_ALL
102void gtk_menu_button_set_has_frame (GtkMenuButton *menu_button,
103 gboolean has_frame);
104GDK_AVAILABLE_IN_ALL
105gboolean gtk_menu_button_get_has_frame (GtkMenuButton *menu_button);
106
107GDK_AVAILABLE_IN_ALL
108void gtk_menu_button_popup (GtkMenuButton *menu_button);
109GDK_AVAILABLE_IN_ALL
110void gtk_menu_button_popdown (GtkMenuButton *menu_button);
111
112GDK_AVAILABLE_IN_ALL
113void gtk_menu_button_set_create_popup_func (GtkMenuButton *menu_button,
114 GtkMenuButtonCreatePopupFunc func,
115 gpointer user_data,
116 GDestroyNotify destroy_notify);
117
118GDK_AVAILABLE_IN_4_4
119void gtk_menu_button_set_primary (GtkMenuButton *menu_button,
120 gboolean primary);
121GDK_AVAILABLE_IN_4_4
122gboolean gtk_menu_button_get_primary (GtkMenuButton *menu_button);
123
124GDK_AVAILABLE_IN_4_6
125void gtk_menu_button_set_child (GtkMenuButton *menu_button,
126 GtkWidget *child);
127GDK_AVAILABLE_IN_4_6
128GtkWidget * gtk_menu_button_get_child (GtkMenuButton *menu_button);
129
130G_END_DECLS
131
132#endif /* __GTK_MENU_BUTTON_H__ */
133

source code of gtk/gtk/gtkmenubutton.h