Debian Codegraph @

gtk/src/enums.ccg

raw
1 /* Copyright (C) 1998-2002 The gtkmm Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
15 */
16
17 #include <gtkmm/enums.h>
18 #include <gtkmm/settings.h>
19
20 // static
21 GType Glib::Value<Gtk::IconSize>::value_type()
22 {
23 return gtk_icon_size_get_type();
24 }
25
26 namespace Gtk
27 {
28
29 // static
30 bool IconSize::lookup(IconSize size, int& width, int& height)
31 {
32 return gtk_icon_size_lookup((GtkIconSize) int(size), &width, &height);
33 }
34
35 #ifndef GTKMM_DISABLE_DEPRECATED
36 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
37 // static
38 bool IconSize::lookup(IconSize size, int& width, int& height, const Glib::RefPtr<Gtk::Settings>& settings)
39 {
40 return gtk_icon_size_lookup_for_settings(Glib::unwrap(settings), (GtkIconSize) int(size), &width, &height);
41 }
42 G_GNUC_END_IGNORE_DEPRECATIONS
43 #endif //GTKMM_DISABLE_DEPRECATED
44
45 #ifndef GTKMM_DISABLE_DEPRECATED
46 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
47 // static
48 IconSize IconSize::register_new(const Glib::ustring& name, int width, int height)
49 {
50 const int size = gtk_icon_size_register(name.c_str(), width, height);
51 return IconSize(size);
52 }
53 G_GNUC_END_IGNORE_DEPRECATIONS
54 #endif //GTKMM_DISABLE_DEPRECATED
55
56 #ifndef GTKMM_DISABLE_DEPRECATED
57 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
58 // static
59 void IconSize::register_alias(const Glib::ustring& alias, IconSize target)
60 {
61 gtk_icon_size_register_alias(alias.c_str(), (GtkIconSize) int(target));
62 }
63 G_GNUC_END_IGNORE_DEPRECATIONS
64 #endif //GTKMM_DISABLE_DEPRECATED
65
66 #ifndef GTKMM_DISABLE_DEPRECATED
67 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
68 // static
69 IconSize IconSize::from_name(const Glib::ustring& name)
70 {
71 const int size = gtk_icon_size_from_name(name.c_str());
72 return IconSize(size);
73 }
74 G_GNUC_END_IGNORE_DEPRECATIONS
75 #endif //GTKMM_DISABLE_DEPRECATED
76
77 #ifndef GTKMM_DISABLE_DEPRECATED
78 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
79 // static
80 Glib::ustring IconSize::get_name(IconSize size)
81 {
82 return gtk_icon_size_get_name((GtkIconSize) int(size));
83 }
84 G_GNUC_END_IGNORE_DEPRECATIONS
85 #endif //GTKMM_DISABLE_DEPRECATED
86
87 float _gtkmm_align_float_from_enum(Align value)
88 {
89 //Choose the float alignment value appropriate for this human-readable enum value:
90 switch(value)
91 {
92 case ALIGN_START:
93 return 0.0; break;
94 case ALIGN_CENTER:
95 return 0.5; break;
96 case ALIGN_END:
97 return 1.0; break;
98 default:
99 return _gtkmm_align_float_from_enum(ALIGN_START); break;
100 }
101 }
102
103 } //namespace Gtk