1 /*
2  * Copyright (C) 2013-2020 Graeme Gott <graeme@gottcode.org>
3  *
4  * This library is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef WHISKERMENU_CATEGORY_BUTTON_H
19 #define WHISKERMENU_CATEGORY_BUTTON_H
20 
21 #include <gtk/gtk.h>
22 
23 namespace WhiskerMenu
24 {
25 
26 class CategoryButton
27 {
28 public:
29 	CategoryButton(GIcon* icon, const gchar* text);
30 	~CategoryButton();
31 
32 	CategoryButton(const CategoryButton&) = delete;
33 	CategoryButton(CategoryButton&&) = delete;
34 	CategoryButton& operator=(const CategoryButton&) = delete;
35 	CategoryButton& operator=(CategoryButton&&) = delete;
36 
get_widget()37 	GtkWidget* get_widget() const
38 	{
39 		return GTK_WIDGET(m_button);
40 	}
41 
get_active()42 	bool get_active() const
43 	{
44 		return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_button));
45 	}
46 
set_active(bool active)47 	void set_active(bool active)
48 	{
49 		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_button), active);
50 	}
51 
join_group(CategoryButton * button)52 	void join_group(CategoryButton* button)
53 	{
54 		gtk_radio_button_join_group(m_button, button->m_button);
55 	}
56 
57 	void reload_icon_size();
58 
59 private:
60 	GtkRadioButton* m_button;
61 	GtkBox* m_box;
62 	GtkWidget* m_icon;
63 	GtkWidget* m_label;
64 };
65 
66 }
67 
68 #endif // WHISKERMENU_CATEGORY_BUTTON_H
69