[gtkmm] StyleContext: Deprecate some functions and add others.



commit 91295688d955e665d815abc431966f027bb608f8
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Tue May 29 14:53:03 2012 +0200

    StyleContext: Deprecate some functions and add others.
    
    * gtk/src/stylecontext.hg: Deprecate functions that have been deprecated in
    gtk+. Add render_icon() and render_insertion_cursor(). Add an overload of
    render_layout() that takes a const Glib::RefPtr<Pango::Layout>& instead of
    a PangoLayout*.
    * gtk/src/widget.[hg|ccg]: Deprecate draw_insertion_cursor(). Bug #675632.

 ChangeLog               |   10 ++++++++++
 gtk/src/stylecontext.hg |   34 +++++++++++++++++++---------------
 gtk/src/widget.ccg      |    2 ++
 gtk/src/widget.hg       |    9 ++++++++-
 4 files changed, 39 insertions(+), 16 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d625c0a..9cc92eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-05-29  Kjell Ahlstedt  <kjell ahlstedt bredband net>
+
+	StyleContext: Deprecate some functions and add others.
+
+	* gtk/src/stylecontext.hg: Deprecate functions that have been deprecated in
+	gtk+. Add render_icon() and render_insertion_cursor(). Add an overload of
+	render_layout() that takes a const Glib::RefPtr<Pango::Layout>& instead of
+	a PangoLayout*.
+	* gtk/src/widget.[hg|ccg]: Deprecate draw_insertion_cursor(). Bug #675632.
+
 2012-05-28  Mark Vender <markv743 yahoo co uk>
 
 	Widget: Document get_style_property_value() and get_style_property()
diff --git a/gtk/src/stylecontext.hg b/gtk/src/stylecontext.hg
index cbf13c3..53e4d50 100644
--- a/gtk/src/stylecontext.hg
+++ b/gtk/src/stylecontext.hg
@@ -19,6 +19,11 @@ _DEFS(gtkmm,gtk)
 _PINCLUDE(glibmm/private/object_p.h)
 _PINCLUDE(gtk/gtk.h)
 
+#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
+#undef GTK_DISABLE_DEPRECATED
+#define GDK_DISABLE_DEPRECATION_WARNINGS 1
+#m4 _POP()
+
 #include <gtkmm/styleprovider.h>
 #include <gtkmm/border.h>
 #include <gtkmm/enums.h>
@@ -29,7 +34,9 @@ _PINCLUDE(gtk/gtk.h)
 #include <gtkmm/iconsource.h>
 #include <gtkmm/iconset.h>
 #include <gtkmm/widgetpath.h>
+#include <pangomm/context.h>
 #include <pangomm/fontdescription.h>
+#include <pangomm/layout.h>
 #include <gtkmmconfig.h>
 
 
@@ -39,7 +46,6 @@ namespace Gtk
 class IconSet;
 
 //TODO: Add (and translate to C++) the code examples from the C documentation.
-//TODO: Find a way to show the headings as headings in this doxygen comment.
 /** This object stores styling information affecting a widget defined by WidgetPath.
  *
  * In order to construct the final style information, StyleContext
@@ -62,7 +68,7 @@ class IconSet;
  * Settings::property_gtk_theme_name() setting or a hierarchy change in the rendered
  * widget.
  *
- * Transition animations
+ * <h2>Transition animations</h2>
  * 
  * StyleContext has built-in support for state change transitions.
  * Note that these animations respect the Settings::property_gtk_enable_animations()
@@ -132,7 +138,7 @@ public:
   _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(StateType state, gdouble* progress), gtk_style_context_state_is_running)
+  _WRAP_METHOD(bool state_is_running(StateType state, gdouble* progress), gtk_style_context_state_is_running, deprecated "This function always returns <tt>false</tt>.")
 
   _WRAP_METHOD(void set_path(const WidgetPath& path), gtk_style_context_set_path)
   
@@ -171,11 +177,7 @@ public:
 
   _WRAP_METHOD(Glib::RefPtr<IconSet> lookup_icon_set(const Glib::ustring& stock_id), gtk_style_context_lookup_icon_set, refreturn)
 
-/* TODO: Move this to Iconset?
-  _WRAP_METHOD(GdkPixbuf  * gtk_icon_set_render_icon_pixbuf   (const Glib::RefPtr<IconSet>& con_set,
-                                                GtkStyleContext *context,
-                                                GtkIconSize      size), gtk_icon_set_render_icon_pixbuf)
-*/
+  // gtk_icon_set_render_icon_pixbuf() in gtkstylecontext.h is wrapped in IconSet::render_icon_pixbuf().
 
   _WRAP_METHOD(void set_screen(const Glib::RefPtr<Gdk::Screen>& screen), gtk_style_context_set_screen)
                                           
@@ -190,14 +192,13 @@ public:
 
   _WRAP_METHOD(bool lookup_color(const Glib::ustring& color_name, Gdk::RGBA& color), gtk_style_context_lookup_color)
 
-  //TODO: region_id can be NULL.
-  _WRAP_METHOD(void notify_state_change(const Glib::RefPtr<Gdk::Window>& window, gpointer region_id, StateType state, bool state_value), gtk_style_context_notify_state_change)
+  _WRAP_METHOD(void notify_state_change(const Glib::RefPtr<Gdk::Window>& window, gpointer region_id, StateType state, bool state_value), gtk_style_context_notify_state_change, deprecated "This function does nothing.")
   
-  _WRAP_METHOD(void cancel_animations(gpointer region_id), gtk_style_context_cancel_animations)
-  _WRAP_METHOD(void scroll_animations(const Glib::RefPtr<Gdk::Window>& window, int dx, int dy), gtk_style_context_scroll_animations)
+  _WRAP_METHOD(void cancel_animations(gpointer region_id), gtk_style_context_cancel_animations, deprecated "This function does nothing.")
+  _WRAP_METHOD(void scroll_animations(const Glib::RefPtr<Gdk::Window>& window, int dx, int dy), gtk_style_context_scroll_animations, deprecated "This function does nothing.")
   
-  _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)
+  _WRAP_METHOD(void push_animatable_region(gpointer region_id), gtk_style_context_push_animatable_region, deprecated "This function does nothing.")
+  _WRAP_METHOD(void pop_animatable_region(), gtk_style_context_pop_animatable_region, deprecated "This function does nothing.")
 
   //TODO: Documentation
   Gdk::RGBA get_color(StateFlags state = (StateFlags)0) const;
@@ -233,7 +234,8 @@ public:
   _WRAP_METHOD(void render_frame(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x,  double y, double width, double height), gtk_render_frame)
   _WRAP_METHOD(void render_expander(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x, double y, double width, double height), gtk_render_expander)
   _WRAP_METHOD(void render_focus(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x, double y, double width, double height), gtk_render_focus)
-  _WRAP_METHOD(void render_layout(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x, double y,  PangoLayout     *layout), gtk_render_layout)
+  _WRAP_METHOD(void render_layout(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x, double y, PangoLayout* layout), gtk_render_layout, deprecated "Use the render_layout() taking a const Glib::RefPtr<Pango::Layout>& layout.")
+  _WRAP_METHOD(void render_layout(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x, double y, const Glib::RefPtr<Pango::Layout>& layout), gtk_render_layout)
   _WRAP_METHOD(void render_line(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x0, double y0,  double x1, double y1), gtk_render_line)
   _WRAP_METHOD(void render_slider(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x, double y, double width, double height,  Orientation orientation), gtk_render_slider)
   _WRAP_METHOD(void render_frame_gap(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x, double y, double width, double height,  PositionType  gap_side, double xy0_gap, double xy1_gap), gtk_render_frame_gap)
@@ -241,6 +243,8 @@ public:
   _WRAP_METHOD(void render_handle(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x, double y, double width, double height), gtk_render_handle)
   _WRAP_METHOD(void render_activity(const ::Cairo::RefPtr< ::Cairo::Context>& cr,  double x,  double y, double width, double height), gtk_render_activity)
   _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> render_icon_pixbuf(const IconSource& source, IconSize size), gtk_render_icon_pixbuf)
+  _WRAP_METHOD(void render_icon(const ::Cairo::RefPtr< ::Cairo::Context>& cr, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf, double x, double y), gtk_render_icon)
+  _WRAP_METHOD(void render_insertion_cursor(const ::Cairo::RefPtr< ::Cairo::Context>& cr, double x, double y, const Glib::RefPtr<Pango::Layout>& layout, int index, Pango::Direction direction), gtk_render_insertion_cursor)
                                     
   
   _WRAP_SIGNAL(void changed(), "changed")
diff --git a/gtk/src/widget.ccg b/gtk/src/widget.ccg
index a6f205d..6edb1af 100644
--- a/gtk/src/widget.ccg
+++ b/gtk/src/widget.ccg
@@ -597,10 +597,12 @@ Glib::ustring Widget::drag_dest_find_target(const Glib::RefPtr<Gdk::DragContext>
   return Gdk::AtomString::to_cpp_type(gtk_drag_dest_find_target(const_cast<GtkWidget*>(gobj()), Glib::unwrap(context), 0 /* See GTK+ docs */));
 }
 
+#ifndef GTKMM_DISABLE_DEPRECATED
 void Widget::draw_insertion_cursor(const Cairo::RefPtr<Cairo::Context>& cr, const Gdk::Rectangle& location, bool is_primary, TextDirection direction, bool draw_arrow)
 {
   gtk_draw_insertion_cursor(gobj(), cr->cobj(), const_cast<GdkRectangle*>(location.gobj()), is_primary, (GtkTextDirection)direction, draw_arrow);
 }
+#endif // GTKMM_DISABLE_DEPRECATED
 
 Requisition Widget::get_requisition() const
 {
diff --git a/gtk/src/widget.hg b/gtk/src/widget.hg
index 578c519..4e2d83e 100644
--- a/gtk/src/widget.hg
+++ b/gtk/src/widget.hg
@@ -508,8 +508,15 @@ public:
   _WRAP_METHOD(void map(), gtk_widget_map)
   _WRAP_METHOD(void unmap(), gtk_widget_unmap)
 
-  //TODO: Documentation:
+#ifndef GTKMM_DISABLE_DEPRECATED
+  /** Draws a text caret on @a cr at @a location.
+   * This is not a style function but merely a convenience function for drawing
+   * the standard cursor shape.
+   *
+   * @deprecated Use StyleContext::render_insertion_cursor() instead.
+   */
   void draw_insertion_cursor(const ::Cairo::RefPtr< ::Cairo::Context>& cr, const Gdk::Rectangle& location, bool is_primary, TextDirection direction, bool draw_arrow = true);
+#endif // GTKMM_DISABLE_DEPRECATED
   _IGNORE(gtk_draw_insertion_cursor)
 
   // Gtk+ 2.12 tooltip API



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]