[gtkmm] Added Gtk::StyleContext.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Added Gtk::StyleContext.
- Date: Mon, 6 Dec 2010 10:03:31 +0000 (UTC)
commit 05da6e2b1f0e7fbeb7436b0a67db3f7ff25ee051
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Dec 6 11:03:07 2010 +0100
Added Gtk::StyleContext.
* gtk/src/gtk_enums.defs: Regenerated with enums.pl.
* gtk/src/enums.hg: Added RegionFlags, JunctionSides and StateFlags.
* gtk/src/filelist.am:
* gtk/src/stylecontext.[hg|ccg]: Added StyleContext, though some methods
are not yet wrapped.
* tools/m4/convert_gdk.m4:
* tools/m4/convert_gtk.m4: Added necessary conversions.
ChangeLog | 13 +
gdk/src/gdk_methods.defs | 11 +-
gtk/src/enums.hg | 3 +
gtk/src/filelist.am | 1 +
gtk/src/gtk_enums.defs | 167 +++++++++----
gtk/src/stylecontext.ccg | 70 ------
gtk/src/stylecontext.hg | 588 ++++++++--------------------------------------
tools/m4/convert_gdk.m4 | 2 +
tools/m4/convert_gtk.m4 | 5 +
9 files changed, 245 insertions(+), 615 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a1b3ec9..6489598 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2010-12-06 Murray Cumming <murrayc murrayc com>
+ Added Gtk::StyleContext.
+
+ * gtk/src/gtk_enums.defs: Regenerated with enums.pl.
+ * gtk/src/enums.hg: Added RegionFlags, JunctionSides and StateFlags.
+
+ * gtk/src/filelist.am:
+ * gtk/src/stylecontext.[hg|ccg]: Added StyleContext, though some methods
+ are not yet wrapped.
+ * tools/m4/convert_gdk.m4:
+ * tools/m4/convert_gtk.m4: Added necessary conversions.
+
+2010-12-06 Murray Cumming <murrayc murrayc com>
+
Fix the gdkmm build with latest GTK+ 3 from git master.
* gdk/src/gdk_methods.defs: Regenerated with h2defs.py.
diff --git a/gdk/src/gdk_methods.defs b/gdk/src/gdk_methods.defs
index 76a9bc4..ea3c1a6 100644
--- a/gdk/src/gdk_methods.defs
+++ b/gdk/src/gdk_methods.defs
@@ -425,10 +425,10 @@
)
)
-(define-enum WindowClass
+(define-enum WindowWindowClass
(in-module "Gdk")
- (c-name "GdkWindowClass")
- (gtype-id "GDK_TYPE_WINDOW_CLASS")
+ (c-name "GdkWindowWindowClass")
+ (gtype-id "GDK_TYPE_WINDOW_WINDOW_CLASS")
(values
'("output" "GDK_INPUT_OUTPUT")
'("only" "GDK_INPUT_ONLY")
@@ -1817,8 +1817,8 @@
(return-type "GType")
)
-(define-function gdk_window_class_get_type
- (c-name "gdk_window_class_get_type")
+(define-function gdk_window_window_class_get_type
+ (c-name "gdk_window_window_class_get_type")
(return-type "GType")
)
@@ -4204,7 +4204,6 @@
'("gint*" "y")
'("gint*" "width")
'("gint*" "height")
- '("gint*" "depth")
)
)
diff --git a/gtk/src/enums.hg b/gtk/src/enums.hg
index f6294d3..ed2dff5 100644
--- a/gtk/src/enums.hg
+++ b/gtk/src/enums.hg
@@ -100,6 +100,9 @@ _WRAP_ENUM(SortType, GtkSortType)
_WRAP_ENUM(PageOrientation, GtkPageOrientation)
_WRAP_ENUM(SensitivityType, GtkSensitivityType)
_WRAP_ENUM(SizeRequestMode, GtkSizeRequestMode)
+_WRAP_ENUM(RegionFlags, GtkRegionFlags)
+_WRAP_ENUM(JunctionSides, GtkJunctionSides)
+_WRAP_ENUM(StateFlags, GtkStateFlags)
#ifdef GTKMM_MAEMO_EXTENSIONS_ENABLED
namespace Hildon
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index 9c4dc98..746c344 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -141,6 +141,7 @@ gtkmm_files_any_hg = \
statusicon.hg \
stockitem.hg \
style.hg \
+ stylecontext.hg \
switch.hg \
table.hg \
targetlist.hg \
diff --git a/gtk/src/gtk_enums.defs b/gtk/src/gtk_enums.defs
index fe5fbd2..31eb50e 100644
--- a/gtk/src/gtk_enums.defs
+++ b/gtk/src/gtk_enums.defs
@@ -196,6 +196,22 @@
)
)
+;; From gtkcssprovider.h
+
+;; Original typedef:
+;; typedef enum
+;; {
+;; GTK_CSS_PROVIDER_ERROR_FAILED
+;; } GtkCssProviderError;
+
+(define-enum-extended CssProviderError
+ (in-module "Gtk")
+ (c-name "GtkCssProviderError")
+ (values
+ '("failed" "GTK_CSS_PROVIDER_ERROR_FAILED" "0")
+ )
+)
+
;; From gtkdebug.h
;; Original typedef:
@@ -662,24 +678,6 @@
;; Original typedef:
;; typedef enum
;; {
-;; GTK_PIXELS,
-;; GTK_INCHES,
-;; GTK_CENTIMETERS
-;; } GtkMetricType;
-
-(define-enum-extended MetricType
- (in-module "Gtk")
- (c-name "GtkMetricType")
- (values
- '("pixels" "GTK_PIXELS" "0")
- '("inches" "GTK_INCHES" "1")
- '("centimeters" "GTK_CENTIMETERS" "2")
- )
-)
-
-;; Original typedef:
-;; typedef enum
-;; {
;; GTK_MOVEMENT_LOGICAL_POSITIONS,
;; GTK_MOVEMENT_VISUAL_POSITIONS,
;; GTK_MOVEMENT_WORDS,
@@ -994,7 +992,9 @@
;; GTK_STATE_ACTIVE,
;; GTK_STATE_PRELIGHT,
;; GTK_STATE_SELECTED,
-;; GTK_STATE_INSENSITIVE
+;; GTK_STATE_INSENSITIVE,
+;; GTK_STATE_INCONSISTENT,
+;; GTK_STATE_FOCUSED
;; } GtkStateType;
(define-enum-extended StateType
@@ -1006,6 +1006,8 @@
'("prelight" "GTK_STATE_PRELIGHT" "2")
'("selected" "GTK_STATE_SELECTED" "3")
'("insensitive" "GTK_STATE_INSENSITIVE" "4")
+ '("inconsistent" "GTK_STATE_INCONSISTENT" "5")
+ '("focused" "GTK_STATE_FOCUSED" "6")
)
)
@@ -1397,6 +1399,99 @@
)
)
+;; Original typedef:
+;; typedef enum
+;; {
+;; GTK_STATE_FLAG_ACTIVE = 1 << 0,
+;; GTK_STATE_FLAG_PRELIGHT = 1 << 1,
+;; GTK_STATE_FLAG_SELECTED = 1 << 2,
+;; GTK_STATE_FLAG_INSENSITIVE = 1 << 3,
+;; GTK_STATE_FLAG_INCONSISTENT = 1 << 4,
+;; GTK_STATE_FLAG_FOCUSED = 1 << 5
+;; } GtkStateFlags;
+
+(define-flags-extended StateFlags
+ (in-module "Gtk")
+ (c-name "GtkStateFlags")
+ (values
+ '("active" "GTK_STATE_FLAG_ACTIVE" "1 << 0")
+ '("prelight" "GTK_STATE_FLAG_PRELIGHT" "1 << 1")
+ '("selected" "GTK_STATE_FLAG_SELECTED" "1 << 2")
+ '("insensitive" "GTK_STATE_FLAG_INSENSITIVE" "1 << 3")
+ '("inconsistent" "GTK_STATE_FLAG_INCONSISTENT" "1 << 4")
+ '("focused" "GTK_STATE_FLAG_FOCUSED" "1 << 5")
+ )
+)
+
+;; Original typedef:
+;; typedef enum {
+;; GTK_REGION_EVEN = 1 << 0,
+;; GTK_REGION_ODD = 1 << 1,
+;; GTK_REGION_FIRST = 1 << 2,
+;; GTK_REGION_LAST = 1 << 3,
+;; GTK_REGION_SORTED = 1 << 5
+;; } GtkRegionFlags;
+
+(define-flags-extended RegionFlags
+ (in-module "Gtk")
+ (c-name "GtkRegionFlags")
+ (values
+ '("even" "GTK_REGION_EVEN" "1 << 0")
+ '("odd" "GTK_REGION_ODD" "1 << 1")
+ '("first" "GTK_REGION_FIRST" "1 << 2")
+ '("last" "GTK_REGION_LAST" "1 << 3")
+ '("sorted" "GTK_REGION_SORTED" "1 << 5")
+ )
+)
+
+;; Original typedef:
+;; typedef enum {
+;; GTK_JUNCTION_NONE = 0,
+;; GTK_JUNCTION_CORNER_TOPLEFT = 1 << 0,
+;; GTK_JUNCTION_CORNER_TOPRIGHT = 1 << 1,
+;; GTK_JUNCTION_CORNER_BOTTOMLEFT = 1 << 2,
+;; GTK_JUNCTION_CORNER_BOTTOMRIGHT = 1 << 3,
+;; GTK_JUNCTION_TOP = (GTK_JUNCTION_CORNER_TOPLEFT | GTK_JUNCTION_CORNER_TOPRIGHT),
+;; GTK_JUNCTION_BOTTOM = (GTK_JUNCTION_CORNER_BOTTOMLEFT | GTK_JUNCTION_CORNER_BOTTOMRIGHT),
+;; GTK_JUNCTION_LEFT = (GTK_JUNCTION_CORNER_TOPLEFT | GTK_JUNCTION_CORNER_BOTTOMLEFT),
+;; GTK_JUNCTION_RIGHT = (GTK_JUNCTION_CORNER_TOPRIGHT | GTK_JUNCTION_CORNER_BOTTOMRIGHT)
+;; } GtkJunctionSides;
+
+(define-flags-extended JunctionSides
+ (in-module "Gtk")
+ (c-name "GtkJunctionSides")
+ (values
+ '("none" "GTK_JUNCTION_NONE" "0x0")
+ '("corner-topleft" "GTK_JUNCTION_CORNER_TOPLEFT" "1 << 0")
+ '("corner-topright" "GTK_JUNCTION_CORNER_TOPRIGHT" "1 << 1")
+ '("corner-bottomleft" "GTK_JUNCTION_CORNER_BOTTOMLEFT" "1 << 2")
+ '("corner-bottomright" "GTK_JUNCTION_CORNER_BOTTOMRIGHT" "1 << 3")
+ '("top" "GTK_JUNCTION_TOP" "0x3")
+ '("bottom" "GTK_JUNCTION_BOTTOM" "0xC")
+ '("left" "GTK_JUNCTION_LEFT" "0x5")
+ '("right" "GTK_JUNCTION_RIGHT" "0xA")
+ )
+)
+
+;; Original typedef:
+;; typedef enum {
+;; GTK_BORDER_STYLE_NONE,
+;; GTK_BORDER_STYLE_SOLID,
+;; GTK_BORDER_STYLE_INSET,
+;; GTK_BORDER_STYLE_OUTSET
+;; } GtkBorderStyle;
+
+(define-enum-extended BorderStyle
+ (in-module "Gtk")
+ (c-name "GtkBorderStyle")
+ (values
+ '("none" "GTK_BORDER_STYLE_NONE" "0")
+ '("solid" "GTK_BORDER_STYLE_SOLID" "1")
+ '("inset" "GTK_BORDER_STYLE_INSET" "2")
+ '("outset" "GTK_BORDER_STYLE_OUTSET" "3")
+ )
+)
+
;; From gtkfilechooser.h
;; Original typedef:
@@ -2214,37 +2309,3 @@
)
)
-;; From gtkprinter.h
-
-;; Original typedef:
-;; typedef enum
-;; {
-;; GTK_PRINT_CAPABILITY_PAGE_SET = 1 << 0,
-;; GTK_PRINT_CAPABILITY_COPIES = 1 << 1,
-;; GTK_PRINT_CAPABILITY_COLLATE = 1 << 2,
-;; GTK_PRINT_CAPABILITY_REVERSE = 1 << 3,
-;; GTK_PRINT_CAPABILITY_SCALE = 1 << 4,
-;; GTK_PRINT_CAPABILITY_GENERATE_PDF = 1 << 5,
-;; GTK_PRINT_CAPABILITY_GENERATE_PS = 1 << 6,
-;; GTK_PRINT_CAPABILITY_PREVIEW = 1 << 7,
-;; GTK_PRINT_CAPABILITY_NUMBER_UP = 1 << 8,
-;; GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT = 1 << 9
-;; } GtkPrintCapabilities;
-
-(define-flags-extended PrintCapabilities
- (in-module "Gtk")
- (c-name "GtkPrintCapabilities")
- (values
- '("page-set" "GTK_PRINT_CAPABILITY_PAGE_SET" "1 << 0")
- '("copies" "GTK_PRINT_CAPABILITY_COPIES" "1 << 1")
- '("collate" "GTK_PRINT_CAPABILITY_COLLATE" "1 << 2")
- '("reverse" "GTK_PRINT_CAPABILITY_REVERSE" "1 << 3")
- '("scale" "GTK_PRINT_CAPABILITY_SCALE" "1 << 4")
- '("generate-pdf" "GTK_PRINT_CAPABILITY_GENERATE_PDF" "1 << 5")
- '("generate-ps" "GTK_PRINT_CAPABILITY_GENERATE_PS" "1 << 6")
- '("preview" "GTK_PRINT_CAPABILITY_PREVIEW" "1 << 7")
- '("number-up" "GTK_PRINT_CAPABILITY_NUMBER_UP" "1 << 8")
- '("number-up-layout" "GTK_PRINT_CAPABILITY_NUMBER_UP_LAYOUT" "1 << 9")
- )
-)
-
diff --git a/gtk/src/stylecontext.ccg b/gtk/src/stylecontext.ccg
index d7e8e8a..d67f84a 100644
--- a/gtk/src/stylecontext.ccg
+++ b/gtk/src/stylecontext.ccg
@@ -19,80 +19,10 @@
*/
#include <gtkmm/widget.h>
-#include <gtkmm/rc.h>
#include <gtk/gtk.h>
namespace Gtk
{
-/*
-Design notes:
-
-Okay these are my notes on how a GtkStyle works.
-They are not meant to be taken as documentation as I didn't
-write the code.
-
-styles keeps a copy of itself for each color depth. Thus
-changing a style after it has been attached wont work!
-
-At allocation time a Gtk Style has
- - all GC set to 0 as they will be allocated later
- - has all color values set to default values.
- - a ref count of 1 and an attach count of 0 (floating?)
- - a properly referenced font.
- - colormap and depth are invalid.
- - The style list and rcstyle are 0. (??? styles wasn't set explicitly!)
-
-It returns to this state if the style is detatched from
-all widgets.
-
-Attach acts to sink the object removing it from the floating state.
-
-attaching a style for the first time initializes it.
-Initializing a style
- - sets the colormap and depth.
- - sets the mid colors. (thus allowing user to set these would be pointless)
- - gets black and white from the colormap.
- - allocates all the colors.
- - uses gtk_gc_get to share a gc if there is a matching one.
-
-Conclusions, we need to rework the concept of Gdk to allow
-for const objects.
-
-*/
-
-void Style::set_font(const Pango::FontDescription& font_desc)
-{
- g_return_if_fail(font_desc.gobj() != 0);
-
- // It will be freed when it goes out of scope.
- const Pango::FontDescription fontBefore (gobj()->font_desc, false);
-
- gobj()->font_desc = font_desc.gobj_copy();
-}
-
-Pango::FontDescription Style::get_font() const
-{
- // Direct struct access seems the only way.
- return Pango::FontDescription(gobj()->font_desc, true); // true = make a copy.
-}
-
-void Style::set_xthickness(int xthickness)
-{
- gobj()->xthickness = xthickness;
-}
-
-void Style::set_ythickness(int ythickness)
-{
- gobj()->ythickness = ythickness;
-}
-
-IconSet Style::lookup_icon_set(const Gtk::StockID& stock_id)
-{
- GtkIconSet* pIconSet = gtk_style_lookup_icon_set(gobj(), stock_id.get_c_str());
- return IconSet(pIconSet, true); //true = take_copy.
-
-}
-
} // namespace Gtk
diff --git a/gtk/src/stylecontext.hg b/gtk/src/stylecontext.hg
index 239515d..3f45c21 100644
--- a/gtk/src/stylecontext.hg
+++ b/gtk/src/stylecontext.hg
@@ -1,6 +1,4 @@
-/* $Id: style.hg,v 1.11 2006/11/23 14:47:48 murrayc Exp $ */
-
-/* Copyright (C) 1998-2002 The gtkmm Development Team
+/* Copyright (C) 2010 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,39 +15,13 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-// This is for including the config header before any code (such as
-// the #ifndef GTKMM_DISABLE_DEPRECATED in deprecated classes) is generated:
-_CONFIGINCLUDE(gtkmmconfig.h)
-
_DEFS(gtkmm,gtk)
_PINCLUDE(glibmm/private/object_p.h)
_PINCLUDE(gtk/gtk.h)
-#m4begin
-
-m4_define(`_STYLE_MEMBER_COLOR',`dnl
-void set_$1(Gtk::StateType state, const Gdk::Color& color);
- Gdk::Color get_$1(Gtk::StateType state) const;
-_PUSH(SECTION_CC)
-void Style::set_$1(StateType state, const Gdk::Color& color)
-{
- gobj()->$1[state] = *color.gobj();
-}
-
-Gdk::Color Style::get_$1(StateType state) const
-{
- return Gdk::Color(const_cast<GdkColor*>(&gobj()->$1[state]), true);
-}
-
-_POP()
-')dnl
-
-#m4end
-
-#include <pangomm/fontdescription.h>
-#include <pangomm/layout.h>
-#include <gdkmm/types.h>
+#include <gtkmm/enums.h>
#include <gdkmm/window.h>
+#include <gdkmm/screen.h>
#include <gtkmm/enums.h>
#include <gtkmm/iconsource.h>
@@ -60,467 +32,111 @@ _POP()
namespace Gtk
{
-class Widget;
-class RcStyle;
-
-
-class Style : public Glib::Object
+class StyleContext : public Glib::Object
{
- _CLASS_GOBJECT(Style, GtkStyle, GTK_STYLE, Glib::Object, GObject)
- _IGNORE(gtk_style_ref, gtk_style_unref, gtk_style_get_font, gtk_style_set_font)
-
+ _CLASS_GOBJECT(StyleContext, GtkStyleContext, GTK_STYLE_CONTEXT, Glib::Object, GObject)
protected:
_CTOR_DEFAULT()
public:
_WRAP_CREATE()
- _IGNORE(gtk_style_new)
-
- _STYLE_MEMBER_COLOR(fg)
- _STYLE_MEMBER_COLOR(bg)
- _STYLE_MEMBER_COLOR(light)
- _STYLE_MEMBER_COLOR(dark)
- _STYLE_MEMBER_COLOR(mid)
- _STYLE_MEMBER_COLOR(text)
- _STYLE_MEMBER_COLOR(base)
- _STYLE_MEMBER_COLOR(text_aa)
-
- _MEMBER_SET(black, black, Gdk::Color, GdkColor)
- _MEMBER_GET(black, black, Gdk::Color, GdkColor)
- _MEMBER_SET(white, white, Gdk::Color, GdkColor)
- _MEMBER_GET(white, white, Gdk::Color, GdkColor)
-
- void set_font(const Pango::FontDescription& font_desc);
-
- // These are only available after being attached to a window.
- Pango::FontDescription get_font() const;
-
- void set_xthickness(int xthickness);
- _MEMBER_GET(xthickness, xthickness, int, gint)
-
- void set_ythickness(int ythickness);
- _MEMBER_GET(ythickness, ythickness, int, gint)
-
- _WRAP_METHOD(void paint_arrow(
- const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget& widget,
- const Glib::ustring& detail,
- ArrowType arrow_type,
- bool fill,
- int x,
- int y,
- int width,
- int height) const, gtk_paint_arrow)
-
- _WRAP_METHOD(void paint_box(
- const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget& widget,
- const Glib::ustring& detail,
- int x,
- int y,
- int width,
- int height) const, gtk_paint_box)
-
- _WRAP_METHOD(void paint_box_gap(
- const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget& widget,
- const Glib::ustring& detail,
- int x,
- int y,
- int width,
- int height,
- PositionType gap_side,
- int gap_x,
- int gap_width) const, gtk_paint_box_gap)
-
- _WRAP_METHOD(void paint_check(
- const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget& widget,
- const Glib::ustring& detail,
- int x,
- int y,
- int width,
- int height) const, gtk_paint_check)
-
- _WRAP_METHOD(void paint_diamond(
- const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget& widget,
- const Glib::ustring& detail,
- int x,
- int y,
- int width,
- int height) const, gtk_paint_diamond)
-
- _WRAP_METHOD(void paint_extension(
- const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget& widget,
- const Glib::ustring& detail,
- int x,
- int y,
- int width,
- int height,
- PositionType gap_side) const, gtk_paint_extension)
-
- _WRAP_METHOD(void paint_flat_box(
- const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget& widget,
- const Glib::ustring& detail,
- int x,
- int y,
- int width,
- int height) const, gtk_paint_flat_box)
-
- _WRAP_METHOD(void paint_focus(
- const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- Widget& widget,
- const Glib::ustring& detail,
- int x,
- int y,
- int width,
- int height) const, gtk_paint_focus)
-
- _WRAP_METHOD(void paint_handle(
- const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget& widget,
- const Glib::ustring& detail,
- int x,
- int y,
- int width,
- int height,
- Orientation orientation) const, gtk_paint_handle)
-
- _WRAP_METHOD(void paint_hline(
- const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- Widget& widget,
- const Glib::ustring& detail,
- int x1,
- int x2,
- int y) const, gtk_paint_hline)
-
- _WRAP_METHOD(void paint_option(
- const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget& widget,
- const Glib::ustring& detail,
- int x,
- int y,
- int width,
- int height) const, gtk_paint_option)
-
- _WRAP_METHOD(void paint_shadow(
- const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget& widget,
- const Glib::ustring& detail,
- int x,
- int y,
- int width,
- int height) const, gtk_paint_shadow)
-
- _WRAP_METHOD(void paint_shadow_gap(
- const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget& widget,
- const Glib::ustring& detail,
- int x,
- int y,
- int width,
- int height,
- PositionType gap_side,
- int gap_x,
- int gap_width) const, gtk_paint_shadow_gap)
-
- _WRAP_METHOD(void paint_slider(
- const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget& widget,
- const Glib::ustring& detail,
- int x,
- int y,
- int width,
- int height,
- Orientation orientation) const, gtk_paint_slider)
-
- _WRAP_METHOD(void paint_tab(
- const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget& widget,
- const Glib::ustring& detail,
- int x,
- int y,
- int width,
- int height) const, gtk_paint_tab)
-
-
- _WRAP_METHOD(void paint_vline(
- const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- Widget& widget,
- const Glib::ustring& detail,
- int y1,
- int y2,
- int x) const, gtk_paint_vline)
-
- _WRAP_METHOD(void paint_expander(
- const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- Widget& widget,
- const Glib::ustring& detail,
- int x,
- int y,
- ExpanderStyle expander_style) const, gtk_paint_expander)
-
- _WRAP_METHOD(void paint_layout(
- const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- bool use_text,
- Widget& widget,
- const Glib::ustring& detail,
- int x,
- int y,
- const Glib::RefPtr<Pango::Layout>& layout) const, gtk_paint_layout)
-
- _WRAP_METHOD(void paint_resize_grip(
- const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- Widget& widget,
- const Glib::ustring& detail,
- Gdk::WindowEdge edge,
- int x,
- int y,
- int width,
- int height) const, gtk_paint_resize_grip)
-
-
- _WRAP_METHOD(Glib::RefPtr<Style> copy(), gtk_style_copy, deprecated "Use the const version")
- _WRAP_METHOD(Glib::RefPtr<Style> copy() const, gtk_style_copy)
-
- _WRAP_METHOD(Glib::RefPtr<Style> attach(const Glib::RefPtr<Gdk::Window>& window), gtk_style_attach)
- _WRAP_METHOD(void detach(), gtk_style_detach)
-
- _WRAP_METHOD(void set_background(const Glib::RefPtr<Gdk::Window>& window, Gtk::StateType state_type), gtk_style_set_background)
-
- _WRAP_METHOD(void apply_default_background(const Cairo::RefPtr<Cairo::Context>& cr,
- const Glib::RefPtr<Gdk::Window>& window,
- Gtk::StateType state_type,
- int x, int y, int width, int height), gtk_style_apply_default_background)
-
- _WRAP_METHOD_DOCS_ONLY(gtk_style_lookup_icon_set)
- IconSet lookup_icon_set(const Gtk::StockID& stock_id);
-
- _CONVERSION(`Gdk::Color&',`GdkColor*',`($3).gobj()')
- _WRAP_METHOD(bool lookup_color(const Glib::ustring& color_name, Gdk::Color& color) const, gtk_style_lookup_color)
-
-
- _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> render_icon(const IconSource& source,
- Gtk::TextDirection direction, Gtk::StateType state, Gtk::IconSize size,
- Gtk::Widget& widget, const Glib::ustring& detail), gtk_style_render_icon)
-
- _IGNORE(gtk_style_get, gtk_style_get_valist)
- _WRAP_METHOD(void get_style_property_value(GType widget_type, const Glib::ustring& property_name, Glib::ValueBase& value), gtk_style_get_style_property)
-
- /** Queries the value of a style property corresponding to a
- * widget class in the given style.
- *
- * @param widget_type the GType of a descendant of GtkWidget.
- * @param property_name The name of the style property to get.
- * @param value: An output parameter in which the value of the property being queried will be stored.
- *
- * @newin{2,16}
- */
- template <class PropertyType>
- void get_style_property(GType widget_type, const Glib::ustring& property_name, PropertyType& value) const;
-
-
-protected:
- _WRAP_VFUNC(void realize(), realize)
- _WRAP_VFUNC(void unrealize(), unrealize)
-
-#m4 _CONVERSION(`GtkStyle*',`const Glib::RefPtr<Style>&',`Glib::wrap($3, true)')
- _WRAP_VFUNC(void copy(const Glib::RefPtr<Style>& src), copy)
-
-#m4 _CONVERSION(`GtkStyle*', `Glib::RefPtr<Style>', `Glib::wrap($3, true)')
- _WRAP_VFUNC(Glib::RefPtr<Style> clone(), clone)
-#m4 _CONVERSION(`GtkStyle*', `Glib::RefPtr<Style>', `Glib::wrap($3)')
-
-#m4 _CONVERSION(`GtkRcStyle*',`const Glib::RefPtr<RcStyle>&',`Glib::wrap($3, true)')
- _WRAP_VFUNC(void init_from_rc(const Glib::RefPtr<RcStyle>& rc_style), init_from_rc)
-
-
-#m4 _CONVERSION(`GdkWindow*',`const Glib::RefPtr<Gdk::Window>&', `Glib::wrap(($3), true)')
- _WRAP_VFUNC(void set_background(const Glib::RefPtr<Gdk::Window>& window, Gtk::StateType state_type), set_background)
-
-#m4 _CONVERSION(`const char*',`const Glib::ustring&',__GCHARP_TO_USTRING)
- _WRAP_VFUNC(Glib::RefPtr<Gdk::Pixbuf> render_icon(const IconSource& source,
- TextDirection direction,
- Gtk::StateType state,
- IconSize size,
- Widget* widget,
- const Glib::ustring& detail), render_icon)
-
-#m4 _CONVERSION(`cairo_t*',`const Cairo::RefPtr<Cairo::Context>&',`Cairo::RefPtr<Cairo::Context>(new Cairo::Context($3, false /* has_reference */))')
- _WRAP_VFUNC(void draw_hline(const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- Widget* widget,
- const Glib::ustring& detail,
- int x1, int x2, int y), draw_hline)
- _WRAP_VFUNC(void draw_vline(const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- Widget* widget,
- const Glib::ustring& detail,
- int y1, int y2, int x), draw_vline)
- _WRAP_VFUNC(void draw_shadow(const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget* widget,
- const Glib::ustring& detail,
- int x, int y, int width, int height), draw_shadow)
- _WRAP_VFUNC(void draw_arrow(const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget* widget,
- const Glib::ustring& detail,
- Gtk::ArrowType arrow_type, bool fill,
- int x, int y, int width, int height), draw_arrow)
- _WRAP_VFUNC(void draw_diamond(const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget* widget,
- const Glib::ustring& detail,
- int x, int y, int width, int height), draw_diamond)
- _WRAP_VFUNC(void draw_box(const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget* widget,
- const Glib::ustring& detail,
- int x, int y, int width, int height), draw_box)
- _WRAP_VFUNC(void draw_flat_box(const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget* widget,
- const Glib::ustring& detail,
- int x, int y, int width, int height), draw_flat_box)
- _WRAP_VFUNC(void draw_check(const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget* widget,
- const Glib::ustring& detail,
- int x, int y, int width, int height), draw_check)
- _WRAP_VFUNC(void draw_option(const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget* widget,
- const Glib::ustring& detail,
- int x, int y, int width, int height), draw_option)
- _WRAP_VFUNC(void draw_tab(const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget* widget,
- const Glib::ustring& detail,
- int x, int y, int width, int height), draw_tab)
- _WRAP_VFUNC(void draw_shadow_gap(const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget* widget,
- const Glib::ustring& detail,
- int x, int y, int width, int height,
- Gtk::PositionType gap_side, int gap_x, int gap_width), draw_shadow_gap)
- _WRAP_VFUNC(void draw_box_gap(const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget* widget,
- const Glib::ustring& detail,
- int x, int y, int width, int height,
- Gtk::PositionType gap_side, int gap_x, int gap_width), draw_box_gap)
- _WRAP_VFUNC(void draw_extension(const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget* widget,
- const Glib::ustring& detail,
- int x, int y, int width, int height,
- PositionType gap_side), draw_extension)
- _WRAP_VFUNC(void draw_focus(const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- Widget* widget,
- const Glib::ustring& detail,
- int x, int y, int width, int height), draw_focus)
- _WRAP_VFUNC(void draw_slider(const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget* widget,
- const Glib::ustring& detail,
- int x, int y, int width, int height,
- Orientation orientation), draw_slider)
- _WRAP_VFUNC(void draw_handle(const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- ShadowType shadow_type,
- Widget* widget,
- const Glib::ustring& detail,
- int x, int y, int width, int height,
- Orientation orientation), draw_handle)
- _WRAP_VFUNC(void draw_expander(const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- Widget* widget,
- const Glib::ustring& detail,
- int x, int y, ExpanderStyle expander_style), draw_expander)
-#m4 _CONVERSION(`PangoLayout*',`const Glib::RefPtr<Pango::Layout>&',Glib::wrap($3, true))
- _WRAP_VFUNC(void draw_layout(const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- bool use_text,
- Widget* widget,
- const Glib::ustring& detail,
- int x, int y,
- const Glib::RefPtr<Pango::Layout>& layout), draw_layout)
- _WRAP_VFUNC(void draw_resize_grip(const Cairo::RefPtr<Cairo::Context>& cr,
- Gtk::StateType state_type,
- Widget* widget,
- const Glib::ustring& detail,
- Gdk::WindowEdge edge,
- int x, int y, int width, int height), draw_resize_grip)
-
- _WRAP_SIGNAL(void realize(), realize)
- _WRAP_SIGNAL(void unrealize(), unrealize)
+ _IGNORE(gtk_style_context_new)
+
+ _WRAP_METHOD(static void add_provider_for_screen(const Glib::RefPtr<Gdk::Screen>& screen, GtkStyleProvider *provider, guint priority), gtk_style_context_add_provider_for_screen)
+ _WRAP_METHOD(static void remove_provider_for_screen(const Glib::RefPtr<Gdk::Screen>& screen, GtkStyleProvider *provider), gtk_style_context_remove_provider_for_screen)
+
+ _WRAP_METHOD(void add_provider(GtkStyleProvider *provider, guint priority), gtk_style_context_add_provider)
+
+ _WRAP_METHOD(void remove_provider(GtkStyleProvider *provider), gtk_style_context_remove_provider)
+
+ _WRAP_METHOD(void context_save(), gtk_style_context_save)
+ _WRAP_METHOD(void context_restore(), gtk_style_context_restore)
+
+/* TODO:
+ _WRAP_METHOD(void get_property (
+ const Glib::ustring& property,
+ StateFlags state,
+ GValue *value), tk_style_context_get_property)
+ _WRAP_METHOD(void get_valist (
+ StateFlags state,
+ va_list args), gtk_style_context_get_valist)
+ _WRAP_METHOD(void get (
+ StateFlags state,
+ ...) G_GNUC_NULL_TERMINATED;
+*/
+
+ _WRAP_METHOD(void set_state(StateFlags flags), gtk_style_context_set_state)
+ _WRAP_METHOD(StateFlags get_state() const, gtk_style_context_get_state)
+
+ _WRAP_METHOD(bool state_is_running(GtkStateType state, gdouble* progress), gtk_style_context_state_is_running)
+
+ _WRAP_METHOD(void set_path(GtkWidgetPath *path), gtk_style_context_set_path)
+ _WRAP_METHOD(const GtkWidgetPath* get_path(), gtk_style_context_get_path)
+
+ //TODO: _WRAP_METHOD(GList * list_classes (), gtk_style_context_list_classes)
+
+ _WRAP_METHOD(void add_class(const Glib::ustring& class_name), gtk_style_context_add_class)
+ _WRAP_METHOD(void remove_class(const Glib::ustring& class_name), gtk_style_context_remove_class)
+ _WRAP_METHOD(bool has_class(const Glib::ustring& class_name), gtk_style_context_has_class)
+
+ _WRAP_METHOD(GList* list_regions (), gtk_style_context_list_regions)
+
+ _WRAP_METHOD(void add_region(const Glib::ustring& region_name, RegionFlags flags), gtk_style_context_add_region)
+ _WRAP_METHOD(void remove_region(const Glib::ustring& region_name), gtk_style_context_remove_region)
+ _WRAP_METHOD(bool has_region(const Glib::ustring& region_name, RegionFlags& flags_return), gtk_style_context_has_region)
+/*
+ _WRAP_METHOD(void get_style_property (
+ const Glib::ustring& property_name,
+ GValue *value), gtk_style_context_get_style_property)
+ _WRAP_METHOD(void get_style_valist (
+ va_list args), gtk_style_context_get_style_valis)
+ _WRAP_METHOD(void get_style (
+ ...), gtk_style_context_get_style)
+*/
+
+ _WRAP_METHOD(GtkIconSet* lookup_icon_set(const Glib::ustring& stock_id), gtk_style_context_lookup_icon_set)
+
+/* TODO: Move this to Iconset?
+ _WRAP_METHOD(GdkPixbuf * gtk_icon_set_render_icon_pixbuf (GtkIconSet *icon_set,
+ GtkStyleContext *context,
+ GtkIconSize size), gtk_icon_set_render_icon_pixbuf)
+*/
+
+ _WRAP_METHOD(void set_screen(const Glib::RefPtr<Gdk::Screen>& screen), gtk_style_context_set_screen)
+
+ //TODO: _WRAP_METHOD(Glib::RefPtr<Gdk::Screen> get_screen(), gtk_style_context_get_screen, refreturn)
+ //TODO: _WRAP_METHOD(Glib::RefPtr<const Gdk::Screen> get_screen() const , gtk_style_context_get_screen, refreturn, constversion)
+
+ _WRAP_METHOD(void set_direction(TextDirection direction), gtk_style_context_set_direction)
+ _WRAP_METHOD(TextDirection get_direction() const, gtk_style_context_get_direction)
+
+ _WRAP_METHOD(void set_junction_sides(JunctionSides sides), gtk_style_context_set_junction_sides)
+ _WRAP_METHOD(JunctionSides get_junction_sides() const, gtk_style_context_get_junction_sides)
+
+ _WRAP_METHOD(bool lookup_color(const Glib::ustring& color_name, Gdk::RGBA& color), gtk_style_context_lookup_color)
+
+ _WRAP_METHOD(void notify_state_change(const Glib::RefPtr<Gdk::Window>& window, gpointer region_id, GtkStateType state, bool state_value), gtk_style_context_notify_state_change)
+ _WRAP_METHOD(void push_animatable_region(gpointer region_id), gtk_style_context_push_animatable_region)
+ _WRAP_METHOD(void pop_animatable_region(), gtk_style_context_pop_animatable_region)
+
+/* Some helper functions to retrieve most common properties */
+ _WRAP_METHOD(void get_color(StateFlags state, Gdk::RGBA& color) const, gtk_style_context_get_color)
+ _WRAP_METHOD(void get_background_color(StateFlags state, Gdk::RGBA& color) const, gtk_style_context_get_background_color)
+ _WRAP_METHOD(void get_border_color(StateFlags state, Gdk::RGBA& color) const, gtk_style_context_get_border_color)
+
+ _WRAP_METHOD(void get_border(StateFlags state, Border& border) const, gtk_style_context_get_border)
+ _WRAP_METHOD(void get_padding(StateFlags state, Border& padding) const, gtk_style_context_get_padding)
+ _WRAP_METHOD(void get_margin (StateFlags state, Border& margin) const, gtk_style_context_get_margin)
+
+ _WRAP_METHOD(void invalidate(), gtk_style_context_invalidate)
+ //TODO: _WRAP_METHOD(void reset_widgets(const Glib::RefPtr<Gdk::Screen>& screen), gtk_style_context_reset_widgets)
+
+ _WRAP_METHOD(void set_background(const Glib::RefPtr<Gdk::Window>& window), gtk_style_context_set_background)
+
+ _WRAP_SIGNAL(void changed(), "changed")
+
+ _WRAP_PROPERTY("screen", Glib::RefPtr<Gdk::Screen>)
+ _WRAP_PROPERTY("direction", TextDirection)
};
-
-template <class PropertyType> inline
-void Style::get_style_property(GType widget_type, const Glib::ustring& property_name, PropertyType& value) const
-{
- Glib::Value<PropertyType> property_value;
- property_value.init(Glib::Value<PropertyType>::value_type());
-
- //We cast away the const.
- //TODO: Either this get_style_property() should be non-const,
- //or get_style_property_value() should be const.
- //We can't really have both const and unconst versions of them because output parameters can't be const.
- //Bug https://bugzilla.gnome.org/show_bug.cgi?id=594171
- Style* unconst_this = const_cast<Style*>(this);
- unconst_this->get_style_property_value(widget_type, property_name, property_value);
-
- value = property_value.get();
-}
-
} // namespace Gtk
diff --git a/tools/m4/convert_gdk.m4 b/tools/m4/convert_gdk.m4
index ec08016..3b92093 100644
--- a/tools/m4/convert_gdk.m4
+++ b/tools/m4/convert_gdk.m4
@@ -92,6 +92,8 @@ _CONVERSION(`GdkColor',`Gdk::Color', `Gdk::Color(const_cast<GdkColor*>(&($3)), t
_CONVERSION(`Color&',`GdkColor*',($3).gobj())
_CONVERSION(`const Gdk::Color&',`const GdkColor*',`($3).gobj()')
_CONVERSION(`const RGBA&',`const GdkRGBA*',`($3).gobj()')
+_CONVERSION(`RGBA&',`GdkRGBA*',`($3).gobj()')
+_CONVERSION(`Gdk::RGBA&',`GdkRGBA*',`($3).gobj()')
_CONVERSION(`const RGBA&',`GdkRGBA*',`const_cast<RGBA&>($3).gobj()')
_CONVERSION(`const Gdk::RGBA&',`const GdkRGBA*',`($3).gobj()')
_CONVERSION(`const Color&',`const GdkColor*',`($3).gobj()')
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index 6440e67..d8e8231 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -152,6 +152,9 @@ _CONV_ENUM(Gtk,WrapBoxPacking)
_CONV_ENUM(Gtk,WrapBoxSpreading)
_CONV_ENUM(Gtk,SizeRequestMode)
_CONV_ENUM(Gtk,ScrollablePolicy)
+_CONV_ENUM(Gtk,RegionFlags)
+_CONV_ENUM(Gtk,JunctionSides)
+_CONV_ENUM(Gtk,StateFlags)
_CONVERSION(`GtkIconSize',`IconSize',`IconSize(static_cast<int>($3))')
_CONVERSION(`GtkIconSize',`Gtk::IconSize',`Gtk::IconSize(static_cast<int>($3))')
@@ -167,6 +170,7 @@ _CONVERSION(`SortType&',`GtkSortType*',`(($2) &($3))')
_CONVERSION(`SortType*',`GtkSortType*',`(($2) ($3))')
_CONVERSION(`GtkSortType*',`SortType*',`(($2) ($3))')
_CONVERSION(`guint8',`Gtk::StateType',`static_cast<StateType>($3)')
+_CONVERSION(`RegionFlags&',`GtkRegionFlags*',`(($2) &($3))')
@@ -542,6 +546,7 @@ _CONVERSION(`Entry&',`GtkEntry*',__FR2P)
_CONVERSION(`Gtk::Border&',`GtkBorder*',__FR2P)
_CONVERSION(`GtkBorder*',`Gtk::Border&',`Glib::wrap($3)')
_CONVERSION(`const Border&',`const GtkBorder*',__FR2P)
+_CONVERSION(`Border&',`GtkBorder*',__FR2P)
_CONVERSION(`const GtkBorder*',`Border',`Glib::wrap(const_cast<GtkBorder*>($3))')
#RecentFilter
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]