summaryrefslogtreecommitdiff
path: root/src/gui/gtd-menu-button.h
blob: 191806a4541bc118f25edbb9873803b10d82d5cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/* gtd-menu-button.h
 *
 * Copyright 2020 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#pragma once

#include <gtk/gtk.h>

G_BEGIN_DECLS

#define GTD_TYPE_MENU_BUTTON (gtd_menu_button_get_type())
G_DECLARE_DERIVABLE_TYPE (GtdMenuButton, gtd_menu_button, GTD, MENU_BUTTON, GtkWidget)

struct _GtdMenuButtonClass
{
  GtkWidgetClass      parent_class;
};

/**
 * GtdMenuButtonCreatePopupFunc:
 * @self: the #GtdMenuButton
 *
 * User-provided callback function to create a popup for @menu_button on demand.
 * This function is called when the popoup of @menu_button is shown, but none has
 * been provided via gtd_menu_buton_set_popup(), gtd_menu_button_set_popover()
 * or gtd_menu_button_set_menu_model().
 */
typedef void  (*GtdMenuButtonCreatePopupFunc) (GtdMenuButton *self,
                                               gpointer       user_data);

GtkWidget*           gtd_menu_button_new                         (void);

void                 gtd_menu_button_set_popover                 (GtdMenuButton      *self,
                                                                  GtkWidget          *popover);

GtkPopover*          gtd_menu_button_get_popover                 (GtdMenuButton      *self);

void                 gtd_menu_button_set_direction               (GtdMenuButton      *self,
                                                                  GtkArrowType        direction);

GtkArrowType         gtd_menu_button_get_direction               (GtdMenuButton      *self);

void                 gtd_menu_button_set_menu_model              (GtdMenuButton      *self,
                                                                  GMenuModel         *menu_model);

GMenuModel*          gtd_menu_button_get_menu_model              (GtdMenuButton      *self);


void                 gtd_menu_button_set_align_widget            (GtdMenuButton      *self,
                                                                  GtkWidget          *align_widget);

GtkWidget*           gtd_menu_button_get_align_widget            (GtdMenuButton      *self);


void                 gtd_menu_button_set_gicon                   (GtdMenuButton      *self,
                                                                  GIcon              *icon);

GIcon*               gtd_menu_button_get_gicon                   (GtdMenuButton      *self);


void                 gtd_menu_button_set_label                   (GtdMenuButton      *self,
                                                                  const gchar        *label);

const gchar*         gtd_menu_button_get_label                   (GtdMenuButton      *self);


void                 gtd_menu_button_set_use_underline           (GtdMenuButton      *self,
                                                                  gboolean            use_underline);

gboolean             gtd_menu_button_get_use_underline           (GtdMenuButton      *self);

void                 gtd_menu_button_set_has_frame               (GtdMenuButton      *self,
                                                                  gboolean            has_frame);

gboolean             gtd_menu_button_get_has_frame               (GtdMenuButton      *self);

void                 gtd_menu_button_popup                       (GtdMenuButton      *self);

void                 gtd_menu_button_popdown                     (GtdMenuButton      *self);


void                 gtd_menu_button_set_create_popup_func       (GtdMenuButton                *self,
                                                                  GtdMenuButtonCreatePopupFunc  func,
                                                                  gpointer                      user_data,
                                                                  GDestroyNotify                destroy_notify);


G_END_DECLS