Debian Codegraph @

gtk/src/stylecontext.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 <gdkmm/frameclock.h>
18 #include <gtkmm/widget.h>
19 #include <gtk/gtk.h>
20
21
22 namespace Gtk
23 {
24
25
26 Gdk::RGBA StyleContext::get_color(StateFlags state) const
27 {
28 GdkRGBA crgba;
29 gtk_style_context_get_color(const_cast<GtkStyleContext*>(gobj()), ((GtkStateFlags)(state)), &crgba);
30 return Gdk::RGBA(&crgba, true);
31 }
32
33 _DEPRECATE_IFDEF_START
34 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
35 Gdk::RGBA StyleContext::get_background_color(StateFlags state) const
36 {
37 GdkRGBA crgba;
38 gtk_style_context_get_background_color(const_cast<GtkStyleContext*>(gobj()), ((GtkStateFlags)(state)), &crgba);
39 return Gdk::RGBA(&crgba, true);
40 }
41
42 Gdk::RGBA StyleContext::get_border_color(StateFlags state) const
43 {
44 GdkRGBA crgba;
45 gtk_style_context_get_border_color(const_cast<GtkStyleContext*>(gobj()), ((GtkStateFlags)(state)), &crgba);
46 return Gdk::RGBA(&crgba, true);
47 }
48 G_GNUC_END_IGNORE_DEPRECATIONS
49 _DEPRECATE_IFDEF_END
50
51 Pango::FontDescription StyleContext::get_font(StateFlags state) const
52 {
53 // gtk_style_context_get_font() is deprecated.
54 PangoFontDescription* description = nullptr;
55 gtk_style_context_get(const_cast<GtkStyleContext*>(gobj()), (GtkStateFlags)state, "font", &description, NULL);
56 // gtk_style_context_get() returns a newly allocated font description, owned by the caller.
57 return Glib::wrap(description, false);
58 }
59
60 Border StyleContext::get_border(StateFlags state) const
61 {
62 GtkBorder cborder;
63 gtk_style_context_get_border(const_cast<GtkStyleContext*>(gobj()), ((GtkStateFlags)(state)), &cborder);
64 return Border(&cborder, true);
65 }
66
67 Border StyleContext::get_padding(StateFlags state) const
68 {
69 GtkBorder cborder;
70 gtk_style_context_get_padding(const_cast<GtkStyleContext*>(gobj()), ((GtkStateFlags)(state)), &cborder);
71 return Border(&cborder, true);
72 }
73
74 Border StyleContext::get_margin(StateFlags state) const
75 {
76 GtkBorder cborder;
77 gtk_style_context_get_margin(const_cast<GtkStyleContext*>(gobj()), ((GtkStateFlags)(state)), &cborder);
78 return Border(&cborder, true);
79 }
80
81 void StyleContext::unset_parent()
82 {
83 gtk_style_context_set_parent(gobj(), nullptr);
84 }
85
86 } // namespace Gtk