[gtkmm/gtkmm-2-24] Image: Added constructor and a const-correct set(IconSet, size) method.
- From: murrayc src gnome org
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm/gtkmm-2-24] Image: Added constructor and a const-correct set(IconSet, size) method.
- Date: Wed, 2 Feb 2011 09:23:36 +0000 (UTC)
commit 8400e12ca93679461471bda5e9ef104f0727ca49
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Feb 2 10:20:06 2011 +0100
Image: Added constructor and a const-correct set(IconSet, size) method.
* gtk/src/image.[hg|ccg]: set(IconSet, size): Deprecate the existing one
because it takes a non-const IconSet&, adding a correct method overload.
Likewise, deprecate and replace the corresponding constructor.
We use IconSet via RefPtr in gtkmm 3 anyway, so we have already fixed this
problem there.
ChangeLog | 10 ++++++++++
gtk/src/image.ccg | 5 -----
gtk/src/image.hg | 30 ++++++++++++++++++++++++------
3 files changed, 34 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4a22c89..f4d8283 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2011-02-02 Murray Cumming <murrayc murrayc com>
+ Image: Added constructor and a const-correct set(IconSet, size) method.
+
+ * gtk/src/image.[hg|ccg]: set(IconSet, size): Deprecate the existing one
+ because it takes a non-const IconSet&, adding a correct method overload.
+ Likewise, deprecate and replace the corresponding constructor.
+ We use IconSet via RefPtr in gtkmm 3 anyway, so we have already fixed this
+ problem there.
+
+2011-02-02 Murray Cumming <murrayc murrayc com>
+
Pixbuf: Minor documentation improvement.
* gdk/src/pixbuf.hg: Dealt with a TODO comment.
diff --git a/gtk/src/image.ccg b/gtk/src/image.ccg
index 208603a..ce6b65c 100644
--- a/gtk/src/image.ccg
+++ b/gtk/src/image.ccg
@@ -33,11 +33,6 @@ Image::Image(const Gtk::StockID& stock_id, IconSize size)
_CONSTRUCT("stock", stock_id.get_c_str(), "icon-size", (GtkIconSize) int(size))
{}
-Image::Image(IconSet& icon_set, IconSize size)
-:
- _CONSTRUCT("icon-set", icon_set.gobj(), "icon-size", (GtkIconSize) int(size))
-{}
-
Image::Image(const Glib::RefPtr<Gdk::PixbufAnimation>& animation)
:
_CONSTRUCT("pixbuf-animation", Glib::unwrap(animation))
diff --git a/gtk/src/image.hg b/gtk/src/image.hg
index 9856fa6..6db8641 100644
--- a/gtk/src/image.hg
+++ b/gtk/src/image.hg
@@ -89,13 +89,29 @@ public:
*/
_WRAP_CTOR(Image(const std::string& file), gtk_image_new_from_file)
- //TODO: Change this documentation when we have wrapped new_from_icon_set().
/** Creates a new Image widget displaying @a pixbuf.
* Note that this just creates an GtkImage from the pixbuf. The Gtk::Image created will not react to state changes.
- * Should you want that, you should use new_from_icon_set().
+ * Should you want that, you should use the constructor that takes an IconSet.
*/
_WRAP_CTOR(Image(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf), gtk_image_new_from_pixbuf)
- //TODO: Wrap gtk_image_new_from_icon_set()
+
+ /** Creates a new Image displaying an icon set. Sample stock sizes are ICON_SIZE_MENU, ICON_SIZE_SMALL_TOOLBAR.
+ * Instead of using this function, usually it's better to create an IconFactory, put your icon sets in the icon factory,
+ * add the icon factory to the list of default factories with IconFactory::add_default(), and then use the
+ * constructor that takes a StockID. This will allow themes to override the icon you ship with your application.
+ *
+ * @param icon_set An IconSet
+ * @param size A stock icon size.
+ *
+ * @newin{2,24}
+ */
+ _WRAP_CTOR(Image(const IconSet& icon_set, IconSize icon_size), gtk_image_new_from_icon_set)
+
+_DEPRECATE_IFDEF_START
+ /** @deprecated Use the constructor that takes a const IconSet& icon_set instead.
+ */
+ _WRAP_CTOR(Image(IconSet& icon_set, IconSize icon_size), gtk_image_new_from_icon_set)
+_DEPRECATE_IFDEF_END
//We don't wrap gtk_image_new_from_icon_name() to avoid a clash with the from-filename constructor.
//But we do wrap gtk_image_set_from_icon_name()
@@ -109,8 +125,7 @@ public:
* @param size A stock icon size.
*/
Image(const Gtk::StockID& stock_id, IconSize size);
-
- Image(IconSet& icon_set, IconSize size);
+
Image(const Glib::RefPtr<Gdk::PixbufAnimation>& animation);
_WRAP_METHOD(void set(const Glib::RefPtr<Gdk::Pixmap>& pixmap, const Glib::RefPtr<Gdk::Bitmap>& mask), gtk_image_set_from_pixmap)
@@ -118,7 +133,10 @@ public:
_WRAP_METHOD(void set(const std::string& filename), gtk_image_set_from_file)
_WRAP_METHOD(void set(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf), gtk_image_set_from_pixbuf)
_WRAP_METHOD(void set(const Gtk::StockID& stock_id, IconSize size), gtk_image_set_from_stock)
- _WRAP_METHOD(void set(IconSet& icon_set, IconSize size), gtk_image_set_from_icon_set)
+
+ _WRAP_METHOD(void set(IconSet& icon_set, IconSize size), gtk_image_set_from_icon_set, deprecated "Use the method that takes a const IconSet& instead.")
+ _WRAP_METHOD(void set(const IconSet& icon_set, IconSize size), gtk_image_set_from_icon_set)
+
_WRAP_METHOD(void set(const Glib::RefPtr<Gdk::PixbufAnimation>& animation), gtk_image_set_from_animation)
_WRAP_METHOD(void set(const Glib::RefPtr<const Gio::Icon>& icon, IconSize size), gtk_image_set_from_gicon)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]