gtkmm r1115 - in trunk: . gdk/src gtk/src



Author: murrayc
Date: Mon Mar 16 11:18:25 2009
New Revision: 1115
URL: http://svn.gnome.org/viewvc/gtkmm?rev=1115&view=rev

Log:
2009-03-16  Murray Cumming  <murrayc murrayc com>

* gdk/src/pixbufanimation.[hg|ccg]: create_from_file(): Throw an exception 
when the GError is not null.

* gtk/src/entry.[hg|ccg]: *_icon_* methods(): Rearrange parameters to make 
these consistent and so we can have more default parameter values.

* gdk/src/pixbufanimation.hg:
* gdk/src/pixbufanimationiter.hg:
* gdk/src/dragcontext.hg:
* gtk/src/accelgroup.hg:
* gtk/src/enums.hg:
* gtk/src/iconset.hg:
* gtk/src/printoperationpreview.hg: Dealt with some documentation TODOs.

Modified:
   trunk/ChangeLog
   trunk/gdk/src/dragcontext.hg
   trunk/gdk/src/pixbufanimation.ccg
   trunk/gdk/src/pixbufanimation.hg
   trunk/gdk/src/pixbufanimationiter.hg
   trunk/gtk/src/accelgroup.hg
   trunk/gtk/src/entry.ccg
   trunk/gtk/src/entry.hg
   trunk/gtk/src/enums.hg
   trunk/gtk/src/iconset.hg
   trunk/gtk/src/printoperationpreview.hg

Modified: trunk/gdk/src/dragcontext.hg
==============================================================================
--- trunk/gdk/src/dragcontext.hg	(original)
+++ trunk/gdk/src/dragcontext.hg	Mon Mar 16 11:18:25 2009
@@ -70,7 +70,12 @@
   _WRAP_METHOD(void drop_finish(bool success, guint32 time), gdk_drop_finish)
   _WRAP_METHOD(Glib::ustring get_selection() const, gdk_drag_get_selection)
 
-  //TODO: This is not in our *_docs.xml file: Regenerate it.
+  //For some reason this is not in our *_docs.xml file.
+  /** Informs the drag source that the drop is finished, and that the data of the drag will no longer be required.
+   * @param success A flag indicating whether the drop was successful.
+   * @param del Aa flag indicating whether the source should delete the original data. (This should be true for a move.)
+   * time The timestamp from the "drag_data_drop" signal.
+   */
   _WRAP_METHOD(void drag_finish(bool success, bool del, guint32 time), gtk_drag_finish)
   //Gtk::Widget* get_source_widget() - see Gtk::Widget::drag_get_source_widget()
 

Modified: trunk/gdk/src/pixbufanimation.ccg
==============================================================================
--- trunk/gdk/src/pixbufanimation.ccg	(original)
+++ trunk/gdk/src/pixbufanimation.ccg	Mon Mar 16 11:18:25 2009
@@ -25,11 +25,22 @@
 namespace Gdk
 {
 
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
 Glib::RefPtr<PixbufAnimation> PixbufAnimation::create_from_file(const Glib::ustring& filename)
+#else
+Glib::RefPtr<PixbufAnimation> PixbufAnimation::create_from_file(const Glib::ustring& filename, std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
 {
-  GError* pError = 0;
-  return Glib::wrap(gdk_pixbuf_animation_new_from_file(filename.c_str(), &pError));
-  //TODO: Handle the error (don't just leak it).
+  GError* gerror = 0;
+  return Glib::wrap(gdk_pixbuf_animation_new_from_file(filename.c_str(), &gerror));
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
 }
 
 } //Gdk

Modified: trunk/gdk/src/pixbufanimation.hg
==============================================================================
--- trunk/gdk/src/pixbufanimation.hg	(original)
+++ trunk/gdk/src/pixbufanimation.hg	Mon Mar 16 11:18:25 2009
@@ -31,6 +31,13 @@
 namespace Gdk
 {
 
+/** The gdk-pixbuf library provides a simple mechanism to load and represent animations. 
+ * An animation is conceptually a series of frames to be displayed over time. 
+ * Each frame is the same size. The animation may not be represented as a series of frames internally; 
+ * for example, it may be stored as a sprite and instructions for moving the sprite around a background. 
+ * To display an animation you don't need to understand its representation, however; you just ask 
+ * gdk-pixbuf what should be displayed at a given point in time.
+ */
 class PixbufAnimation : public Glib::Object
 {
   _CLASS_GOBJECT(PixbufAnimation, GdkPixbufAnimation, GDK_PIXBUF_ANIMATION, Glib::Object, GObject)
@@ -39,7 +46,11 @@
 
 public:
 
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
   static Glib::RefPtr<PixbufAnimation> create_from_file(const Glib::ustring& filename);
+  #else
+  static Glib::RefPtr<PixbufAnimation> create_from_file(const Glib::ustring& filename, std::auto_ptr<Glib::Error>& error);
+  #endif //GLIBMM_EXCEPTIONS_ENABLED
 
   _WRAP_METHOD(int get_width() const, gdk_pixbuf_animation_get_width)
   _WRAP_METHOD(int get_height() const, gdk_pixbuf_animation_get_height)

Modified: trunk/gdk/src/pixbufanimationiter.hg
==============================================================================
--- trunk/gdk/src/pixbufanimationiter.hg	(original)
+++ trunk/gdk/src/pixbufanimationiter.hg	Mon Mar 16 11:18:25 2009
@@ -31,7 +31,8 @@
 {
 
 
-//TODO: Documentation:
+/** An iterator which points to a certain position in a PixbufAnimation.
+ */
 class PixbufAnimationIter : public Glib::Object
 {
   _CLASS_GOBJECT(PixbufAnimationIter, GdkPixbufAnimationIter, GDK_PIXBUF_ANIMATION_ITER, Glib::Object, GObject)

Modified: trunk/gtk/src/accelgroup.hg
==============================================================================
--- trunk/gtk/src/accelgroup.hg	(original)
+++ trunk/gtk/src/accelgroup.hg	Mon Mar 16 11:18:25 2009
@@ -102,7 +102,7 @@
   /// See set_default_mod_mask().
   static Gdk::ModifierType get_default_mod_mask();
 
-  //TODO: This is undocumented in GTK+ at the moment. When would it be used and where does the quark come from? murrayc.
+  //TODO: Add an overload that takes a ustring instead of a GQuark.
   _WRAP_METHOD(bool activate(GQuark accel_quark, const Glib::RefPtr<Glib::Object>& acceleratable, guint	accel_key, Gdk::ModifierType accel_mods), gtk_accel_group_activate)
 
   _IGNORE(gtk_accel_group_find)
@@ -112,8 +112,9 @@
                             
   _WRAP_METHOD(static bool activate(Gtk::Object& object, guint accel_key, Gdk::ModifierType accel_mods), gtk_accel_groups_activate)
 
-  //TODO: Discover real parameter names:
-  _WRAP_SIGNAL(bool accel_activate(const Glib::RefPtr<Glib::Object>& object, guint param2, Gdk::ModifierType param3), "accel_activate", no_default_handler)   
+
+  _WRAP_SIGNAL(bool accel_activate(const Glib::RefPtr<Glib::Object>& acceleratable, guint keyval, Gdk::ModifierType modifier), "accel_activate", no_default_handler)   
+
   //TODO: The C type is unpleasant:
   //This has C docs, but it isn't worth mentioning them for such a useless signal. murrayc.
   _WRAP_SIGNAL(void accel_changed(guint keyval, Gdk::ModifierType modifier, GClosure* accel_closure), "accel_changed")

Modified: trunk/gtk/src/entry.ccg
==============================================================================
--- trunk/gtk/src/entry.ccg	(original)
+++ trunk/gtk/src/entry.ccg	Mon Mar 16 11:18:25 2009
@@ -22,3 +22,49 @@
 
 #include <gtk/gtk.h>
 
+namespace Gtk
+{
+
+
+void Entry::set_icon_from_pixbuf(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf, EntryIconPosition icon_pos)
+{
+  gtk_entry_set_icon_from_pixbuf(gobj(), ((GtkEntryIconPosition)(icon_pos)), Glib::unwrap(pixbuf)); 
+}
+
+void Entry::set_icon_from_stock(const StockID& stock_id, EntryIconPosition icon_pos)
+{
+  gtk_entry_set_icon_from_stock(gobj(), ((GtkEntryIconPosition)(icon_pos)), (stock_id).get_c_str()); 
+}
+
+void Entry::set_icon_from_icon_name(const Glib::ustring& icon_name, EntryIconPosition icon_pos)
+{
+  gtk_entry_set_icon_from_icon_name(gobj(), ((GtkEntryIconPosition)(icon_pos)), icon_name.c_str()); 
+}
+
+void Entry::set_icon_from_gicon(const Glib::RefPtr<Gio::Icon>& icon, EntryIconPosition icon_pos)
+{
+  gtk_entry_set_icon_from_gicon(gobj(), ((GtkEntryIconPosition)(icon_pos)), const_cast<GIcon*>(Glib::unwrap<Gio::Icon>(icon))); 
+}
+
+void Entry::set_icon_activatable(bool activatable, EntryIconPosition icon_pos)
+{
+  gtk_entry_set_icon_activatable(gobj(), ((GtkEntryIconPosition)(icon_pos)), static_cast<int>(activatable)); 
+}
+
+void Entry::set_icon_tooltip_text(const Glib::ustring& tooltip, EntryIconPosition icon_pos)
+{
+  gtk_entry_set_icon_tooltip_text(gobj(), ((GtkEntryIconPosition)(icon_pos)), tooltip.c_str()); 
+}
+
+void Entry::set_icon_tooltip_markup(const Glib::ustring& tooltip, EntryIconPosition icon_pos)
+{
+  gtk_entry_set_icon_tooltip_markup(gobj(), ((GtkEntryIconPosition)(icon_pos)), tooltip.c_str()); 
+}
+
+void Entry::set_icon_drag_source(const Glib::RefPtr<TargetList>& target_list, Gdk::DragAction actions, EntryIconPosition icon_pos)
+{
+  gtk_entry_set_icon_drag_source(gobj(), ((GtkEntryIconPosition)(icon_pos)), const_cast<GtkTargetList*>(Glib::unwrap(target_list)), ((GdkDragAction)(actions))); 
+}
+
+
+} //namespace Gtk

Modified: trunk/gtk/src/entry.hg
==============================================================================
--- trunk/gtk/src/entry.hg	(original)
+++ trunk/gtk/src/entry.hg	Mon Mar 16 11:18:25 2009
@@ -112,13 +112,23 @@
   _WRAP_METHOD(double get_progress_pulse_step(), gtk_entry_get_progress_pulse_step)
   _WRAP_METHOD(void progress_pulse(), gtk_entry_progress_pulse)
 
-  //TODO: Reorder some parameters so we can always have default values for icon_pos?
-  _WRAP_METHOD(void set_icon_from_pixbuf(EntryIconPosition icon_pos, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf), gtk_entry_set_icon_from_pixbuf)
-  _WRAP_METHOD(void set_icon_from_stock(EntryIconPosition icon_pos,
-							  const StockID& stock_id), gtk_entry_set_icon_from_stock)
-  _WRAP_METHOD(void set_icon_from_icon_name(EntryIconPosition icon_pos,
-							  const Glib::ustring& icon_name), gtk_entry_set_icon_from_icon_name)
-  _WRAP_METHOD(void set_icon_from_gicon(EntryIconPosition icon_pos, const Glib::RefPtr<Gio::Icon>& icon), gtk_entry_set_icon_from_gicon)
+
+  _WRAP_METHOD_DOCS_ONLY(gtk_entry_set_icon_from_pixbuf)
+  void set_icon_from_pixbuf(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf, EntryIconPosition icon_pos = ENTRY_ICON_PRIMARY);
+  _IGNORE(gtk_entry_set_icon_from_pixbuf)
+  
+  _WRAP_METHOD_DOCS_ONLY(gtk_entry_set_icon_from_stock)
+  void set_icon_from_stock(const StockID& stock_id, EntryIconPosition icon_pos = ENTRY_ICON_PRIMARY);
+  _IGNORE(gtk_entry_set_icon_from_stock)
+  
+  _WRAP_METHOD_DOCS_ONLY(gtk_entry_set_icon_from_icon_name)
+  void set_icon_from_icon_name(const Glib::ustring& icon_name, EntryIconPosition icon_pos = ENTRY_ICON_PRIMARY);
+  _IGNORE(gtk_entry_set_icon_from_icon_name)
+
+  _WRAP_METHOD_DOCS_ONLY(gtk_entry_set_icon_from_gicon)
+  void set_icon_from_gicon(const Glib::RefPtr<Gio::Icon>& icon, EntryIconPosition icon_pos = ENTRY_ICON_PRIMARY);
+  _IGNORE(gtk_entry_set_icon_from_gicon)
+    
   _WRAP_METHOD(ImageType get_icon_storage_type(EntryIconPosition icon_pos = ENTRY_ICON_PRIMARY) const, gtk_entry_get_icon_storage_type)
   _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> get_icon_pixbuf(EntryIconPosition icon_pos = ENTRY_ICON_PRIMARY), gtk_entry_get_icon_pixbuf, refreturn)
   _WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> get_icon_pixbuf(EntryIconPosition icon_pos = ENTRY_ICON_PRIMARY) const, gtk_entry_get_icon_pixbuf, refreturn, constversion)
@@ -126,16 +136,32 @@
   _WRAP_METHOD(Glib::ustring get_icon_name(EntryIconPosition icon_pos = ENTRY_ICON_PRIMARY) const, gtk_entry_get_icon_name)
   _WRAP_METHOD(Glib::RefPtr<Gio::Icon> get_icon_gicon(EntryIconPosition icon_pos = ENTRY_ICON_PRIMARY), gtk_entry_get_icon_gicon, refreturn)
   _WRAP_METHOD(Glib::RefPtr<const Gio::Icon> get_icon_gicon(EntryIconPosition icon_pos = ENTRY_ICON_PRIMARY) const, gtk_entry_get_icon_gicon, refreturn, constversion)
-  _WRAP_METHOD(void set_icon_activatable(EntryIconPosition icon_pos, bool activatable), gtk_entry_set_icon_activatable)
+
+  _WRAP_METHOD_DOCS_ONLY(gtk_entry_set_icon_activatable)
+  void set_icon_activatable(bool activatable = true, EntryIconPosition icon_pos = ENTRY_ICON_PRIMARY);
+  _IGNORE(gtk_entry_set_icon_activatable)
+
   _WRAP_METHOD(bool get_icon_activatable(EntryIconPosition icon_pos = ENTRY_ICON_PRIMARY) const, gtk_entry_get_icon_activatable)
   _WRAP_METHOD(void set_icon_sensitive(EntryIconPosition icon_pos = ENTRY_ICON_PRIMARY, bool sensitive = true), gtk_entry_set_icon_sensitive)
   _WRAP_METHOD(bool get_icon_sensitive(EntryIconPosition icon_pos = ENTRY_ICON_PRIMARY), gtk_entry_get_icon_sensitive)
   _WRAP_METHOD(int get_icon_at_pos(int x, int y) const, gtk_entry_get_icon_at_pos)
-  _WRAP_METHOD(void set_icon_tooltip_text(EntryIconPosition icon_pos, const Glib::ustring& tooltip), gtk_entry_set_icon_tooltip_text)
+  
+  _WRAP_METHOD_DOCS_ONLY(gtk_entry_set_icon_tooltip_text)
+  void set_icon_tooltip_text(const Glib::ustring& tooltip, EntryIconPosition icon_pos = ENTRY_ICON_PRIMARY);
+  _IGNORE(gtk_entry_set_icon_tooltip_text)  
+  
   _WRAP_METHOD(Glib::ustring get_icon_tooltip_text(EntryIconPosition icon_pos = ENTRY_ICON_PRIMARY) const, gtk_entry_get_icon_tooltip_text)
-  _WRAP_METHOD(void set_icon_tooltip_markup(EntryIconPosition icon_pos, const Glib::ustring& tooltip), gtk_entry_set_icon_tooltip_markup)
+  
+  _WRAP_METHOD_DOCS_ONLY(gtk_entry_set_icon_tooltip_markup)
+  void set_icon_tooltip_markup(const Glib::ustring& tooltip, EntryIconPosition icon_pos = ENTRY_ICON_PRIMARY);
+  _IGNORE(gtk_entry_set_icon_tooltip_markup) 
+  
   _WRAP_METHOD(Glib::ustring get_icon_tooltip_markup(EntryIconPosition icon_pos = ENTRY_ICON_PRIMARY) const, gtk_entry_get_icon_tooltip_markup)
-  _WRAP_METHOD(void set_icon_drag_source(EntryIconPosition icon_pos, const Glib::RefPtr<TargetList>& target_list, Gdk::DragAction actions = Gdk::ACTION_COPY), gtk_entry_set_icon_drag_source)
+  
+  _WRAP_METHOD_DOCS_ONLY(gtk_entry_set_icon_drag_source)
+  void set_icon_drag_source(const Glib::RefPtr<TargetList>& target_list, Gdk::DragAction actions = Gdk::ACTION_COPY, EntryIconPosition icon_pos = ENTRY_ICON_PRIMARY);
+  _IGNORE(gtk_entry_set_icon_drag_source)
+    
   _WRAP_METHOD(int get_current_icon_drag_source(), gtk_entry_get_current_icon_drag_source)
 
   _WRAP_SIGNAL(void populate_popup(Menu* menu), "populate_popup")
@@ -161,9 +187,6 @@
   _IGNORE_SIGNAL("toggle_overwrite")
   _IGNORE_SIGNAL("backspace")
 
-  //TODO: Wrap the icon-release and icon-press signals? Or are they just useless activate signals? murrayc.
-  //See bug http://bugzilla.gnome.org/show_bug.cgi?id=574622
-
   _WRAP_PROPERTY("cursor-position", int)
   _WRAP_PROPERTY("selection-bound", int)
   _WRAP_PROPERTY("editable", bool)

Modified: trunk/gtk/src/enums.hg
==============================================================================
--- trunk/gtk/src/enums.hg	(original)
+++ trunk/gtk/src/enums.hg	Mon Mar 16 11:18:25 2009
@@ -171,10 +171,34 @@
    */
   static bool lookup(IconSize size, int& width, int& height, const Glib::RefPtr<Gtk::Settings>& settings);
 
-  //TODO: Documentation:
+  /** Registers a new icon size, along the same lines as ICON_SIZE_MENU, etc. Returns the integer value for the size.
+   *
+   * @param	name Name of the icon size.
+   * @param width The icon width.
+   * @param height The icon height.
+   * @result Integer value representing the size. 
+   */
   static IconSize register_new(const Glib::ustring& name, int width, int height);
+  
+  /** Registers @a alias as another name for @a target so calling from_name() with @a alias as argument will return @a target.
+   *
+   * @param alias An alias for target.
+   * @param target An existing icon size.
+   */
   static void register_alias(const Glib::ustring& alias, IconSize target);
+  
+  /** Looks up the icon size associated with @a name.
+   *
+   * @param name the name to look up.
+   * result The icon size with the given name.
+   */
   static IconSize from_name(const Glib::ustring& name);
+  
+  /** Gets the canonical name of the given icon size.
+   *
+   * @param size size AnIconSize. 
+   * @result The name of the given icon size.
+   */
   static Glib::ustring get_name(IconSize size);
 };
 

Modified: trunk/gtk/src/iconset.hg
==============================================================================
--- trunk/gtk/src/iconset.hg	(original)
+++ trunk/gtk/src/iconset.hg	Mon Mar 16 11:18:25 2009
@@ -37,7 +37,8 @@
 //TODO_API: Is _CLASS_BOXEDTYPE the appropriate thing to use here.
 //This seems to be reference-counted, not copied.
 
-/* TODO: Documentation, thought the C API has no documentation for this either. */
+// TODO: Documentation, thought the C API has no documentation for this either.
+// See http://bugzilla.gnome.org/show_bug.cgi?id=575537
 class IconSet
 {
   _CLASS_BOXEDTYPE(IconSet, GtkIconSet, gtk_icon_set_new, gtk_icon_set_ref, gtk_icon_set_unref)

Modified: trunk/gtk/src/printoperationpreview.hg
==============================================================================
--- trunk/gtk/src/printoperationpreview.hg	(original)
+++ trunk/gtk/src/printoperationpreview.hg	Mon Mar 16 11:18:25 2009
@@ -29,6 +29,7 @@
 {
 
 //TODO: There is no GtkPrintOperationPreview documentation either.
+// See http://bugzilla.gnome.org/show_bug.cgi?id=575538
 /** 
  * @newin2p10
  *



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