[gtkmm/vector] Adapted rest of Gtk to vector utils.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm/vector] Adapted rest of Gtk to vector utils.
- Date: Sun, 23 Jan 2011 21:42:10 +0000 (UTC)
commit 8a615b75a19a0ddb2fe626735dadb51c9a117491
Author: Krzesimir Nowak <qdlacz gmail com>
Date: Sun Jan 23 19:41:52 2011 +0100
Adapted rest of Gtk to vector utils.
This probably does not compile anyway.
gtk/gtkmm/listviewtext.cc | 4 +-
gtk/gtkmm/targetentry.h | 4 +--
gtk/src/icontheme.ccg | 2 +-
gtk/src/icontheme.hg | 2 +-
gtk/src/iconview.ccg | 13 +++++------
gtk/src/iconview.hg | 11 ++++-----
gtk/src/liststore.ccg | 6 +++-
gtk/src/liststore.hg | 4 ++-
gtk/src/main.ccg | 2 +-
gtk/src/main.hg | 2 +-
gtk/src/papersize.ccg | 3 +-
gtk/src/papersize.hg | 9 +++----
gtk/src/printer.ccg | 2 +
gtk/src/printer.hg | 10 +++++---
gtk/src/printsettings.ccg | 38 ++++++++------------------------
gtk/src/printsettings.hg | 20 +++++++++++++++-
gtk/src/recentchooser.ccg | 9 +++----
gtk/src/recentchooser.hg | 17 +++++++++-----
gtk/src/recentinfo.ccg | 10 +++++---
gtk/src/recentinfo.hg | 6 +++-
gtk/src/recentmanager.ccg | 5 +--
gtk/src/recentmanager.hg | 7 +++--
gtk/src/scalebutton.ccg | 2 +
gtk/src/scalebutton.hg | 9 +++++--
gtk/src/selectiondata.ccg | 6 +++-
gtk/src/selectiondata.hg | 17 ++++++++------
gtk/src/sizegroup.ccg | 2 +
gtk/src/sizegroup.hg | 8 +++++-
gtk/src/targetlist.ccg | 10 +++++---
gtk/src/targetlist.hg | 6 +++-
gtk/src/textbuffer.ccg | 50 +++++++++++++-----------------------------
gtk/src/textbuffer.hg | 17 ++++++++------
gtk/src/textchildanchor.ccg | 2 +
gtk/src/textchildanchor.hg | 8 ++++--
gtk/src/textiter.ccg | 2 +
gtk/src/textiter.hg | 19 ++++++++++------
gtk/src/treemodel.ccg | 16 ++++++++++---
gtk/src/treemodel.hg | 8 ++++--
gtk/src/treepath.hg | 5 +---
gtk/src/treeselection.ccg | 12 ++++++----
gtk/src/treeselection.hg | 7 ++---
gtk/src/treestore.ccg | 6 +++-
gtk/src/treestore.hg | 4 ++-
gtk/src/treeview.ccg | 12 +++++++---
gtk/src/treeview.hg | 13 +++++++----
gtk/src/uimanager.ccg | 2 +
gtk/src/uimanager.hg | 18 ++++++++-------
gtk/src/widget.ccg | 12 +++++++---
gtk/src/widget.hg | 11 ++++++---
gtk/src/window.ccg | 2 +
gtk/src/window.hg | 20 ++++++++++-------
51 files changed, 277 insertions(+), 215 deletions(-)
---
diff --git a/gtk/gtkmm/listviewtext.cc b/gtk/gtkmm/listviewtext.cc
index e9eee8a..68653e9 100644
--- a/gtk/gtkmm/listviewtext.cc
+++ b/gtk/gtkmm/listviewtext.cc
@@ -163,7 +163,7 @@ guint ListViewText::get_num_columns() const
ListViewText::SelectionList ListViewText::get_selected()
{
Glib::RefPtr<Gtk::TreeSelection> selected = get_selection();
- Gtk::TreeSelection::ListHandle_Path selectedRows = selected->get_selected_rows();
+ std::vector<TreeModel::Path> selectedRows = selected->get_selected_rows();
// Reserve space
SelectionList selectionList;
@@ -171,7 +171,7 @@ ListViewText::SelectionList ListViewText::get_selected()
// Save selected rows
- for(Gtk::TreeSelection::ListHandle_Path::const_iterator iter = selectedRows.begin(); iter != selectedRows.end(); ++iter)
+ for (std::vector<TreeModel::Path>::const_iterator iter = selectedRows.begin(); iter != selectedRows.end(); ++iter)
{
selectionList.push_back( *((*iter).begin()) );
}
diff --git a/gtk/gtkmm/targetentry.h b/gtk/gtkmm/targetentry.h
index 16622bd..0fa93ed 100644
--- a/gtk/gtkmm/targetentry.h
+++ b/gtk/gtkmm/targetentry.h
@@ -69,7 +69,7 @@ protected:
};
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-struct TargetEntry_Traits
+struct TargetEntryTraits
{
typedef TargetEntry CppType;
typedef GtkTargetEntry CType;
@@ -88,8 +88,6 @@ struct TargetEntry_Traits
};
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-typedef Glib::ArrayHandle< TargetEntry, TargetEntry_Traits > ArrayHandle_TargetEntry;
-
} /* namespace Gtk */
diff --git a/gtk/src/icontheme.ccg b/gtk/src/icontheme.ccg
index 3499060..cf9550f 100644
--- a/gtk/src/icontheme.ccg
+++ b/gtk/src/icontheme.ccg
@@ -28,7 +28,7 @@ void IconTheme::set_search_path(const std::vector<std::string>& path)
gtk_icon_theme_set_search_path(gobj(), const_cast<const char**>(Glib::ArrayHandler<std::string>::vector_to_array (path).data ()), path.size());
}
-Glib::ArrayHandle<std::string> IconTheme::get_search_path() const
+std::vector<std::string> IconTheme::get_search_path() const
{
int temp_int = 0;
gchar** temp_path = 0;
diff --git a/gtk/src/icontheme.hg b/gtk/src/icontheme.hg
index 26794ce..8865b0c 100644
--- a/gtk/src/icontheme.hg
+++ b/gtk/src/icontheme.hg
@@ -69,7 +69,7 @@ public:
_WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> load_icon(const Glib::ustring& icon_name, int size, IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_load_icon, errthrow)
-#m4 _CONVERSION(`GList*',`std::vector<Glib::ustring>',`Glib::ListHandle<Glib::ustring>::list_to_vector ($3, Glib::OWNERSHIP_DEEP)')
+#m4 _CONVERSION(`GList*',`std::vector<Glib::ustring>',`Glib::ListHandler<Glib::ustring>::list_to_vector ($3, Glib::OWNERSHIP_DEEP)')
_WRAP_METHOD(std::vector<Glib::ustring> list_icons(const Glib::ustring& context) const, gtk_icon_theme_list_icons)
/** Lists the icons in the current icon theme.
diff --git a/gtk/src/iconview.ccg b/gtk/src/iconview.ccg
index 977369d..e17f510 100644
--- a/gtk/src/iconview.ccg
+++ b/gtk/src/iconview.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtkmm/adjustment.h>
#include <gtk/gtk.h>
@@ -45,9 +47,6 @@ static void proxy_foreach_callback(GtkIconView* /* icon_view */, GtkTreePath* pa
namespace Gtk
{
-//Allow the generated code to work without the prefix:
-typedef IconView::ArrayHandle_TreePaths ArrayHandle_TreePaths;
-
void IconView::unset_model()
{
gtk_icon_view_set_model(gobj(), 0);
@@ -178,15 +177,15 @@ bool IconView::get_dest_item_at_pos(int drag_x, int drag_y, IconViewDropPosition
}
-void IconView::enable_model_drag_source(const ArrayHandle_TargetEntry& targets, Gdk::ModifierType start_button_mask, Gdk::DragAction actions)
+void IconView::enable_model_drag_source(const std::vector<TargetEntry>& targets, Gdk::ModifierType start_button_mask, Gdk::DragAction actions)
{
- gtk_icon_view_enable_model_drag_source(gobj(), (GdkModifierType)start_button_mask, targets.data(), targets.size(), (GdkDragAction)actions);
+ gtk_icon_view_enable_model_drag_source(gobj(), (GdkModifierType)start_button_mask, Glib::ArrayHandler<TargetEntry, TargetEntryTraits>::vector_to_array (targets).data (), targets.size(), (GdkDragAction)actions);
}
-void IconView::enable_model_drag_dest(const ArrayHandle_TargetEntry& targets, Gdk::DragAction actions)
+void IconView::enable_model_drag_dest(const std::vector<TargetEntry>& targets, Gdk::DragAction actions)
{
- gtk_icon_view_enable_model_drag_dest(gobj(), targets.data(), targets.size(), (GdkDragAction)actions);
+ gtk_icon_view_enable_model_drag_dest(gobj(), Glib::ArrayHandler<TargetEntry>::vector_to_array (targets).data(), targets.size(), (GdkDragAction)actions);
}
bool
diff --git a/gtk/src/iconview.hg b/gtk/src/iconview.hg
index 8f507f3..93579f2 100644
--- a/gtk/src/iconview.hg
+++ b/gtk/src/iconview.hg
@@ -19,6 +19,7 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
#include <gtkmm/container.h>
#include <gtkmm/treemodel.h>
@@ -180,10 +181,8 @@ public:
};
#endif //DOXYGEN_SHOULD_SKIP_THIS
- typedef Glib::ListHandle<TreePath, TreePathTraits> ArrayHandle_TreePaths;
-
- _CONVERSION(`GList*',`ArrayHandle_TreePaths',__FL2H_SHALLOW)
- _WRAP_METHOD(ArrayHandle_TreePaths get_selected_items() const, gtk_icon_view_get_selected_items)
+ _CONVERSION(`GList*',`std::vector<TreePath>',`Glib::ListHandler<TreePath, TreePathTraits>::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector<TreePath> get_selected_items() const, gtk_icon_view_get_selected_items)
_WRAP_METHOD(void select_all(), gtk_icon_view_select_all)
_WRAP_METHOD(void unselect_all(), gtk_icon_view_unselect_all)
@@ -237,7 +236,7 @@ public:
* @param start_button_mask Mask of allowed buttons to start drag.
* @param actions The bitmask of possible actions for a drag from this widget.
*/
- void enable_model_drag_source(const ArrayHandle_TargetEntry& targets,
+ void enable_model_drag_source(const std::vector<TargetEntry>& targets,
Gdk::ModifierType start_button_mask = Gdk::MODIFIER_MASK,
Gdk::DragAction actions = Gdk::ACTION_COPY | Gdk::ACTION_MOVE);
_IGNORE(gtk_icon_view_enable_model_drag_source)
@@ -247,7 +246,7 @@ public:
* @param targets The table of targets that the drag will support.
* @param actions The bitmask of possible actions for a drag from this widget.
*/
- void enable_model_drag_dest(const ArrayHandle_TargetEntry& targets, Gdk::DragAction actions = Gdk::ACTION_COPY | Gdk::ACTION_MOVE);
+ void enable_model_drag_dest(const std::vector<TargetEntry>& targets, Gdk::DragAction actions = Gdk::ACTION_COPY | Gdk::ACTION_MOVE);
_IGNORE(gtk_icon_view_enable_model_drag_dest)
_WRAP_METHOD(void unset_model_drag_source(), gtk_icon_view_unset_model_drag_source)
diff --git a/gtk/src/liststore.ccg b/gtk/src/liststore.ccg
index 610490c..3eea244 100644
--- a/gtk/src/liststore.ccg
+++ b/gtk/src/liststore.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h>
@@ -115,9 +117,9 @@ void ListStore::move(const iterator& source, const iterator& destination)
const_cast<GtkTreeIter*>(destination.get_gobject_if_not_end()));
}
-void ListStore::reorder(const Glib::ArrayHandle<int>& new_order)
+void ListStore::reorder(const std::vector<int>& new_order)
{
- gtk_list_store_reorder(gobj(), const_cast<int*>(new_order.data()));
+ gtk_list_store_reorder(gobj(), const_cast<int*>(Glib::ArrayHandler<int>vector_to_array (new_order).data()));
}
void ListStore::set_value_impl(const iterator& row, int column, const Glib::ValueBase& value)
diff --git a/gtk/src/liststore.hg b/gtk/src/liststore.hg
index 045e9c1..7a1ce06 100644
--- a/gtk/src/liststore.hg
+++ b/gtk/src/liststore.hg
@@ -17,6 +17,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <gtkmm/treeiter.h>
#include <gtkmm/treemodel.h>
#include <gtkmm/treesortable.h>
@@ -139,7 +141,7 @@ public:
/** Reorders the list store to follow the order indicated by @a new_order.
* Note that this function only works with unsorted stores.
*/
- void reorder(const Glib::ArrayHandle<int>& new_order);
+ void reorder(const std::vector<int>& new_order);
_WRAP_METHOD(void clear(), gtk_list_store_clear)
diff --git a/gtk/src/main.ccg b/gtk/src/main.ccg
index 1194955..347d818 100644
--- a/gtk/src/main.ccg
+++ b/gtk/src/main.ccg
@@ -256,7 +256,7 @@ Main::Main(int* argc, char*** argv, bool set_locale)
init(argc, argv, set_locale);
}
-/*Main::Main(int* argc, char*** argv, const std::string& parameter_string, const Glib::ArrayHandle<const Glib::OptionEntry&>& entries, const std::string& translation_domain)
+/*Main::Main(int* argc, char*** argv, const std::string& parameter_string, const std::vector<const Glib::OptionEntry&>& entries, const std::string& translation_domain)
{
init(argc, argv, parameter_string, entries, translation_domain);
}*/
diff --git a/gtk/src/main.hg b/gtk/src/main.hg
index f0c9c0a..b5aeb06 100644
--- a/gtk/src/main.hg
+++ b/gtk/src/main.hg
@@ -204,7 +204,7 @@ protected:
void init(int* argc, char*** argv, bool set_locale);
// TODO: implement this to use the new Glib::OptionEntry argument parsing classes.
- //void init(int* argc, char*** argv, const std::string& parameter_string, const Glib::ArrayHandle<const Glib::OptionEntry&>& entries, const std::string& translation_domain);
+ //void init(int* argc, char*** argv, const std::string& parameter_string, const std::vector<const Glib::OptionEntry&>& entries, const std::string& translation_domain);
virtual void run_impl();
virtual void quit_impl();
diff --git a/gtk/src/papersize.ccg b/gtk/src/papersize.ccg
index a9201e3..8d6b090 100644
--- a/gtk/src/papersize.ccg
+++ b/gtk/src/papersize.ccg
@@ -15,12 +15,13 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h>
namespace Gtk
{
-typedef PaperSize::ListHandle_PaperSizes ListHandle_PaperSizes;
//PaperSize::PaperSize()
//:
// gobject_(gtk_paper_size_new(gtk_paper_size_get_default()))
diff --git a/gtk/src/papersize.hg b/gtk/src/papersize.hg
index 2e5700d..e4b4e51 100644
--- a/gtk/src/papersize.hg
+++ b/gtk/src/papersize.hg
@@ -17,6 +17,8 @@
_DEFS(gtkmm,gtk)
+#include <vector>
+
namespace Gtk
{
@@ -71,11 +73,8 @@ public:
*/
operator bool() const;
- typedef Glib::ListHandle<PaperSize, PaperSizeTraits> ListHandle_PaperSizes;
- _CONVERSION(`GList*',`ListHandle_RecentInfos',__FL2H_SHALLOW)
-
- #m4 _CONVERSION(`GList*', `ListHandle_PaperSizes', __FL2H_DEEP)
- _WRAP_METHOD(static ListHandle_PaperSizes get_paper_sizes(bool include_custom = true), gtk_paper_size_get_paper_sizes)
+ #m4 _CONVERSION(`GList*', `std::vector<PaperSize>',`Glib::ListHandler<PaperSize, PaperSizeTraits>::list_to_vector ($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(static std::vector<PaperSize> get_paper_sizes(bool include_custom = true), gtk_paper_size_get_paper_sizes)
_WRAP_METHOD(Glib::ustring get_name() const, gtk_paper_size_get_name)
_WRAP_METHOD(Glib::ustring get_display_name() const, gtk_paper_size_get_display_name)
diff --git a/gtk/src/printer.ccg b/gtk/src/printer.ccg
index df721e9..ba167b2 100644
--- a/gtk/src/printer.ccg
+++ b/gtk/src/printer.ccg
@@ -16,6 +16,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtkunixprint.h>
// This Signal Proxy allows the C++ coder to specify a sigc::slot instead of a static function.
diff --git a/gtk/src/printer.hg b/gtk/src/printer.hg
index b09a7a6..c681c07 100644
--- a/gtk/src/printer.hg
+++ b/gtk/src/printer.hg
@@ -15,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <gtkmm/pagesetup.h>
_DEFS(gtkmm,gtk)
@@ -70,13 +72,13 @@ public:
_WRAP_METHOD(bool accepts_pdf() const, gtk_printer_accepts_pdf)
_WRAP_METHOD(bool accepts_ps() const, gtk_printer_accepts_ps)
-#m4 _CONVERSION(`GList*', `Glib::ListHandle< Glib::RefPtr<PageSetup> >', __FL2H_DEEP)
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<PageSetup> > list_papers(), gtk_printer_list_papers)
+#m4 _CONVERSION(`GList*', `std::vector< Glib::RefPtr<PageSetup> >', `Glib::ListHandler< Glib::RefPtr<PageSetup> >::list_to_vector ($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<PageSetup> > list_papers(), gtk_printer_list_papers)
_WRAP_METHOD(Glib::RefPtr<PageSetup> get_default_page_size() const, gtk_printer_get_default_page_size, refreturn)
-#m4 _CONVERSION(`GList*', `Glib::ListHandle< Glib::RefPtr<const PageSetup> >', __FL2H_DEEP)
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<const PageSetup> > list_papers() const, gtk_printer_list_papers)
+#m4 _CONVERSION(`GList*', `std::vector< Glib::RefPtr<const PageSetup> >', `Glib::ListHandler< Glib::RefPtr<const PageSetup> >::list_to_vector ($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<const PageSetup> > list_papers() const, gtk_printer_list_papers)
_IGNORE(gtk_printer_compare)
_IGNORE(gtk_enumerate_printers)
diff --git a/gtk/src/printsettings.ccg b/gtk/src/printsettings.ccg
index 8782a58..4b69991 100644
--- a/gtk/src/printsettings.ccg
+++ b/gtk/src/printsettings.ccg
@@ -15,9 +15,9 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <gtk/gtk.h>
+#include <glibmm/vectorutils.h>
-#include <vector>
+#include <gtk/gtk.h>
#include <glib.h>
@@ -119,39 +119,21 @@ PrintSettings::PageRange::PageRange(int start_, int end_)
end(end_)
{}
-Glib::ArrayHandle<PrintSettings::PageRange> PrintSettings::get_page_ranges() const
+std::vector<PrintSettings::PageRange> PrintSettings::get_page_ranges() const
{
- int num_ranges;
+ int num_ranges (0);
GtkPageRange* page_ranges =
gtk_print_settings_get_page_ranges(const_cast<GtkPrintSettings*>(gobj()), &num_ranges);
- std::vector<PrintSettings::PageRange> v(num_ranges);
-
- for (int i = 0; i < num_ranges; ++i)
- {
- v.push_back(PrintSettings::PageRange(page_ranges[i].start, page_ranges[i].end));
- }
-
- g_free(page_ranges);
- Glib::ArrayHandle<PrintSettings::PageRange> ah(v);
-
- return ah;
+ // no need for deep ownership.
+ return Glib::ArrayHandler<PageRange, PageRangeTraits>::array_to_vector (page_ranges, num_ranges, Glib::OWNERSHIP_SHALLOW);
}
-void PrintSettings::set_page_ranges(const Glib::ArrayHandle<PrintSettings::PageRange>& page_ranges)
+void PrintSettings::set_page_ranges(const std::vector<PrintSettings::PageRange>& page_ranges)
{
- int n = page_ranges.size();
- GtkPageRange* ranges = g_new0(GtkPageRange, n);
- std::vector<PrintSettings::PageRange> v_ranges(page_ranges);
-
- for (int i = 0; i < n; ++i)
- {
- ranges[i].start = v_ranges[i].start;
- ranges[i].end = v_ranges[i].end;
- }
-
- gtk_print_settings_set_page_ranges(const_cast<GtkPrintSettings*>(gobj()), ranges, n);
- g_free(ranges);
+ gtk_print_settings_set_page_ranges(gobj(),
+ Glib::ArrayHandler<PageRange, PageRangeTraits>::vector_to_array (page_ranges).data (),
+ page_ranges.size ());
}
diff --git a/gtk/src/printsettings.hg b/gtk/src/printsettings.hg
index 8e08805..508d875 100644
--- a/gtk/src/printsettings.hg
+++ b/gtk/src/printsettings.hg
@@ -15,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <glibmm/object.h>
#include <gtkmm/enums.h>
#include <gtkmm/papersize.h>
@@ -271,8 +273,22 @@ public:
int end;
};
- Glib::ArrayHandle<PageRange> get_page_ranges() const;
- void set_page_ranges(const Glib::ArrayHandle<PageRange>& page_ranges);
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+ struct PageRangeTraits
+ {
+ typedef PageRange CppType;
+ typedef const GtkPageRange CType;
+ typedef GtkPageRange CTypeNonConst;
+
+ static CType to_c_type (CType c_obj) { return c_obj; }
+ static void release_c_type (CType) {}
+ static CType to_c_type (const CppType& cpp_obj) { CTypeNonConst c_obj = {cpp_obj.start, cpp_obj.end}; return c_obj; }
+ static CppType to_cpp_type (CType c_obj) { return CppType (c_obj.start, c_obj.end); }
+ };
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+ std::vector<PageRange> get_page_ranges() const;
+ void set_page_ranges(const std::vector<PageRange>& page_ranges);
_IGNORE(gtk_print_settings_get_page_ranges, gtk_print_settings_set_page_ranges)
diff --git a/gtk/src/recentchooser.ccg b/gtk/src/recentchooser.ccg
index 4aaecbc..b011cbd 100644
--- a/gtk/src/recentchooser.ccg
+++ b/gtk/src/recentchooser.ccg
@@ -15,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h>
// This Signal Proxy allows the C++ coder to specify a sigc::slot instead of a static function.
@@ -44,9 +46,6 @@ static void SignalProxy_Compare_gtk_callback_destroy(gpointer data)
namespace Gtk
{
-//Allow the generated code to work without the prefix:
-typedef RecentChooser::ListHandle_RecentInfos ListHandle_RecentInfos;
-
void RecentChooser::set_sort_func(const SlotCompare& slot)
{
SlotCompare* slot_copy = new SlotCompare(slot);
@@ -57,9 +56,9 @@ void RecentChooser::set_sort_func(const SlotCompare& slot)
&SignalProxy_Compare_gtk_callback_destroy);
}
-Glib::StringArrayHandle RecentChooser::get_uris() const
+std::vector<Glib::ustring> RecentChooser::get_uris() const
{
- return Glib::StringArrayHandle(gtk_recent_chooser_get_uris(const_cast<GtkRecentChooser*>(gobj()), NULL));
+ return Glib::ArrayHandler<Glib::ustring>::array_to_vector (gtk_recent_chooser_get_uris(const_cast<GtkRecentChooser*>(gobj()), NULL), Glib::OWNERSHIP_DEEP);
}
void RecentChooser::unset_limit()
diff --git a/gtk/src/recentchooser.hg b/gtk/src/recentchooser.hg
index 0fa0d33..72036ab 100644
--- a/gtk/src/recentchooser.hg
+++ b/gtk/src/recentchooser.hg
@@ -15,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <glibmm/interface.h>
#include <gtkmm/recentinfo.h>
#include <gtkmm/recentfilter.h>
@@ -100,24 +102,26 @@ public:
_WRAP_METHOD(void select_all(), gtk_recent_chooser_select_all)
_WRAP_METHOD(void unselect_all(), gtk_recent_chooser_unselect_all)
- typedef Glib::ListHandle<RecentInfo, RecentInfoTraits> ListHandle_RecentInfos;
- _CONVERSION(`GList*',`ListHandle_RecentInfos',__FL2H_SHALLOW)
+ //typedef Glib::ListHandle<RecentInfo, RecentInfoTraits> ListHandle_RecentInfos;
+ _CONVERSION(`GList*',`std::vector<RecentInfo>',`Glib::ListHandler<RecentInfo, RecentInfoTraits>::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
- _WRAP_METHOD(ListHandle_RecentInfos get_items() const, gtk_recent_chooser_get_items)
+ _WRAP_METHOD(std::vector<RecentInfo> get_items() const, gtk_recent_chooser_get_items)
/** Gets the URI of the recently used resources.
*
* The return value of this function is affected by the "sort-type" and
* "limit" properties of the recent chooser.
*/
- Glib::StringArrayHandle get_uris() const;
+ std::vector<Glib::ustring> get_uris() const;
_IGNORE(gtk_recent_chooser_get_uris)
_WRAP_METHOD(void add_filter(const Glib::RefPtr<RecentFilter>& filter), gtk_recent_chooser_add_filter)
_WRAP_METHOD(void remove_filter(const Glib::RefPtr<RecentFilter>& filter), gtk_recent_chooser_remove_filter)
- _WRAP_METHOD(Glib::SListHandle< Glib::RefPtr<RecentFilter> > list_filters(), gtk_recent_chooser_list_filters)
- _WRAP_METHOD(Glib::SListHandle< Glib::RefPtr<const RecentFilter> > list_filters() const, gtk_recent_chooser_list_filters)
+#m4 _CONVERSION(`GSList*',`std::vector< Glib::RefPtr<RecentFilter> >',`Glib::SListHandler<Glib::RefPtr<RecentFilter> >::slist_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<RecentFilter> > list_filters(), gtk_recent_chooser_list_filters)
+#m4 _CONVERSION(`GSList*',`std::vector< Glib::RefPtr<const RecentFilter> >',`Glib::SListHandler<Glib::RefPtr<RecentFilter> >::slist_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<const RecentFilter> > list_filters() const, gtk_recent_chooser_list_filters)
_WRAP_METHOD(void set_filter(const Glib::RefPtr<RecentFilter>& filter), gtk_recent_chooser_set_filter)
_WRAP_METHOD(Glib::RefPtr<RecentFilter> get_filter(), gtk_recent_chooser_get_filter, refreturn)
@@ -152,6 +156,7 @@ protected:
#m4 _CONVERSION(`Glib::ustring', `gchar*', `g_strdup(($3).c_str())')
// TODO: How to wrap those vfuncs?
+ // TODO: Also: use vectorutils.
//_CONVERSION(`ListHandle_RecentInfos', `GList*', `($3).data()')
//_CONVERSION(`Glib::SListHandle<RecentFilter*>', `GSList*', `($3).data()')
diff --git a/gtk/src/recentinfo.ccg b/gtk/src/recentinfo.ccg
index cae9dc3..a5a93f4 100644
--- a/gtk/src/recentinfo.ccg
+++ b/gtk/src/recentinfo.ccg
@@ -15,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h>
namespace Gtk
@@ -25,13 +27,13 @@ RecentInfo::operator bool() const
return gobj() != 0;
}
-Glib::StringArrayHandle RecentInfo::get_applications() const
+std::vector<Glib::ustring> RecentInfo::get_applications() const
{
gsize length = 0;
char** const applications =
gtk_recent_info_get_applications(const_cast<GtkRecentInfo*>(gobj()), &length);
- return Glib::StringArrayHandle(applications, length, Glib::OWNERSHIP_DEEP);
+ return Glib::ArrayHandler<Glib::ustring>::array_to_vector (applications, length, Glib::OWNERSHIP_DEEP);
}
bool RecentInfo::get_application_info(const Glib::ustring& app_name, std::string& app_exec,
@@ -49,12 +51,12 @@ bool RecentInfo::get_application_info(const Glib::ustring& app_name, std::string
return (found != 0);
}
-Glib::StringArrayHandle RecentInfo::get_groups() const
+std::vector<Glib::ustring> RecentInfo::get_groups() const
{
gsize length = 0;
char** const groups = gtk_recent_info_get_groups(const_cast<GtkRecentInfo*>(gobj()), &length);
- return Glib::StringArrayHandle(groups, length, Glib::OWNERSHIP_DEEP);
+ return Glib::ArrayHandler<Glib::ustring>::array_to_vector (groups, length, Glib::OWNERSHIP_DEEP);
}
RecentInfoTraits::CppType RecentInfoTraits::to_cpp_type(const CType& obj)
diff --git a/gtk/src/recentinfo.hg b/gtk/src/recentinfo.hg
index e86ba3e..c6eedda 100644
--- a/gtk/src/recentinfo.hg
+++ b/gtk/src/recentinfo.hg
@@ -15,6 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <gdkmm/pixbuf.h>
#include <giomm/icon.h>
#include <giomm/appinfo.h>
@@ -74,14 +76,14 @@ public:
guint& count, time_t& time_) const;
_WRAP_METHOD_DOCS_ONLY(gtk_recent_info_get_applications)
- Glib::StringArrayHandle get_applications() const;
+ std::vector<Glib::ustring> get_applications() const;
_WRAP_METHOD(Glib::ustring last_application() const, gtk_recent_info_last_application)
_WRAP_METHOD(bool has_application(const Glib::ustring& app_name) const,
gtk_recent_info_has_application)
_WRAP_METHOD_DOCS_ONLY(gtk_recent_info_get_groups)
- Glib::StringArrayHandle get_groups() const;
+ std::vector<Glib::ustring> get_groups() const;
_WRAP_METHOD(bool has_group(const Glib::ustring& group) const, gtk_recent_info_has_group)
diff --git a/gtk/src/recentmanager.ccg b/gtk/src/recentmanager.ccg
index 2933f5a..b4805e9 100644
--- a/gtk/src/recentmanager.ccg
+++ b/gtk/src/recentmanager.ccg
@@ -15,14 +15,13 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h>
namespace Gtk
{
-//Allow the generated code to work without the prefix:
-typedef RecentManager::ListHandle_RecentInfos ListHandle_RecentInfos;
-
bool RecentManager::add_item(const Glib::ustring& uri, const Data& data)
{
GtkRecentData c_data;
diff --git a/gtk/src/recentmanager.hg b/gtk/src/recentmanager.hg
index b47d9e7..825fc98 100644
--- a/gtk/src/recentmanager.hg
+++ b/gtk/src/recentmanager.hg
@@ -17,6 +17,8 @@
_CONFIGINCLUDE(gtkmmconfig.h)
+#include <vector>
+
#include <gdkmm/screen.h>
#include <gdkmm/pixbuf.h>
@@ -122,10 +124,9 @@ public:
_WRAP_METHOD(bool has_item(const Glib::ustring& uri) const, gtk_recent_manager_has_item)
_WRAP_METHOD(bool move_item(const Glib::ustring& uri, const Glib::ustring& new_uri), gtk_recent_manager_move_item, errthrow)
- typedef Glib::ListHandle<RecentInfo, RecentInfoTraits> ListHandle_RecentInfos;
- _CONVERSION(`GList*',`ListHandle_RecentInfos',__FL2H_SHALLOW)
+ _CONVERSION(`GList*',`std::vector<RecentInfo>',`Glib::ListHandler<RecentInfo, RecentInfoTraits>::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
- _WRAP_METHOD(ListHandle_RecentInfos get_items() const, gtk_recent_manager_get_items)
+ _WRAP_METHOD(std::vector<RecentInfo> get_items() const, gtk_recent_manager_get_items)
_WRAP_METHOD(int purge_items(), gtk_recent_manager_purge_items, errthrow)
diff --git a/gtk/src/scalebutton.ccg b/gtk/src/scalebutton.ccg
index 2269b5d..3d07691 100644
--- a/gtk/src/scalebutton.ccg
+++ b/gtk/src/scalebutton.ccg
@@ -20,6 +20,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h>
namespace Gtk
diff --git a/gtk/src/scalebutton.hg b/gtk/src/scalebutton.hg
index 8de1a4e..336b936 100644
--- a/gtk/src/scalebutton.hg
+++ b/gtk/src/scalebutton.hg
@@ -18,6 +18,8 @@
_CONFIGINCLUDE(gtkmmconfig.h)
+#include <vector>
+
#include <gtkmm/button.h>
#include <gtkmm/adjustment.h>
#include <gtkmm/orientable.h>
@@ -45,9 +47,10 @@ class ScaleButton
_IMPLEMENTS_INTERFACE(Orientable)
public:
- _WRAP_CTOR(ScaleButton(IconSize size, double min, double max, double step, const Glib::StringArrayHandle& icons), gtk_scale_button_new)
+#m4 _CONVERSION(`const std::vector<Glib::ustring>&',`const gchar**',`Glib::ArrayHandler<Glib::ustring>::vector_to_array ($3)')
+ _WRAP_CTOR(ScaleButton(IconSize size, double min, double max, double step, const std::vector<Glib::ustring>& icons), gtk_scale_button_new)
- _WRAP_METHOD(void set_icons(const Glib::StringArrayHandle& icons), gtk_scale_button_set_icons)
+ _WRAP_METHOD(void set_icons(const std::vector<Glib::ustring>& icons), gtk_scale_button_set_icons)
_WRAP_METHOD(double get_value() const, gtk_scale_button_get_value)
_WRAP_METHOD(void set_value(double value), gtk_scale_button_set_value)
@@ -74,7 +77,7 @@ public:
_WRAP_PROPERTY("value", double)
_WRAP_PROPERTY("size", IconSize)
_WRAP_PROPERTY("adjustment", Adjustment*)
- _WRAP_PROPERTY("icons", Glib::StringArrayHandle)
+ _WRAP_PROPERTY("icons", std::vector<Glib::ustring>)
_WRAP_PROPERTY("orientation", Orientation)
};
diff --git a/gtk/src/selectiondata.ccg b/gtk/src/selectiondata.ccg
index 20b6332..ec60df6 100644
--- a/gtk/src/selectiondata.ccg
+++ b/gtk/src/selectiondata.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtkmm/textbuffer.h>
#include <gdkmm/pixbuf.h>
#include <glibmm/utility.h> //For ScopedPtr<>.
@@ -73,7 +75,7 @@ std::string SelectionData::get_target() const
gdk_atom_name( gtk_selection_data_get_target(const_cast<GtkSelectionData*>(gobj())) ) );
}
-Gdk::ArrayHandle_AtomString SelectionData::get_targets() const
+std::vector<std::string> SelectionData::get_targets() const
{
GdkAtom* targets = 0;
int n_targets = 0;
@@ -82,7 +84,7 @@ Gdk::ArrayHandle_AtomString SelectionData::get_targets() const
n_targets = 0; // it's set to -1 otherwise
//Note that we free the GdkAtom* array, but we don't need to free its items:
- return Gdk::ArrayHandle_AtomString(targets, n_targets, Glib::OWNERSHIP_SHALLOW);
+ return Glib::ArrayHandler<std::string, Gdk::AtomStringTraits>::array_to_vector (targets, n_targets, Glib::OWNERSHIP_SHALLOW);
}
diff --git a/gtk/src/selectiondata.hg b/gtk/src/selectiondata.hg
index 06a4a07..fdfe52f 100644
--- a/gtk/src/selectiondata.hg
+++ b/gtk/src/selectiondata.hg
@@ -19,6 +19,8 @@
_DEFS(gtkmm,gtk)
+#include <vector>
+
#include <gdkmm/display.h>
#include <gdkmm/pixbuf.h>
@@ -79,11 +81,12 @@ public:
_WRAP_METHOD(bool set_pixbuf(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf), gtk_selection_data_set_pixbuf)
_WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> get_pixbuf(), gtk_selection_data_get_pixbuf)
_WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> get_pixbuf() const, gtk_selection_data_get_pixbuf, constversion)
-
+
#dnl The constness of gtk_selection_data_set_uris() is not quite right:
-#m4 _CONVERSION(`const Glib::StringArrayHandle&',`gchar**',`const_cast<char**>(($3).data())')
- _WRAP_METHOD(bool set_uris(const Glib::StringArrayHandle& uris), gtk_selection_data_set_uris)
- _WRAP_METHOD(Glib::StringArrayHandle get_uris() const, gtk_selection_data_get_uris)
+#m4 _CONVERSION(`const std::vector<Glib::ustring>&',`gchar**',`const_cast<char**>(Glib::ArrayHandler<Glib::ustring>::vector_to_array ($3).data())')
+ _WRAP_METHOD(bool set_uris(const std::vector<Glib::ustring>& uris), gtk_selection_data_set_uris)
+#m4 _CONVERSION(`gchar**',`std::vector<Glib::ustring>',`Glib::ArrayHandler<Glib::ustring>::array_to_vector ($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector<Glib::ustring> get_uris() const, gtk_selection_data_get_uris)
_WRAP_METHOD(const guchar* get_data() const, gtk_selection_data_get_data)
@@ -91,8 +94,8 @@ public:
std::string get_data_as_string() const;
- //TODO: Change the return type to std::string, when we can break ABI:
- _WRAP_METHOD(GdkAtom get_selection() const, gtk_selection_data_get_selection)
+#m4 _CONVERSION(`GdkAtom',`std::string',`Gdk::AtomString::to_cpp_type ($3)')
+ _WRAP_METHOD(std::string get_selection() const, gtk_selection_data_get_selection)
/** Retrieves the target of the selection.
*
@@ -102,7 +105,7 @@ public:
_IGNORE(gtk_selection_data_get_target)
/// See also Gtk::Clipboard::request_targets()
- Gdk::ArrayHandle_AtomString get_targets() const;
+ std::vector<std::string> get_targets() const;
_IGNORE(gtk_selection_data_get_targets)
/** Returns the type of the data as set by SelectionData::set().
diff --git a/gtk/src/sizegroup.ccg b/gtk/src/sizegroup.ccg
index b9fa611..c489272 100644
--- a/gtk/src/sizegroup.ccg
+++ b/gtk/src/sizegroup.ccg
@@ -20,6 +20,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h>
namespace Gtk
diff --git a/gtk/src/sizegroup.hg b/gtk/src/sizegroup.hg
index b14e046..7f019a4 100644
--- a/gtk/src/sizegroup.hg
+++ b/gtk/src/sizegroup.hg
@@ -19,6 +19,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <glibmm/object.h>
#include <gtkmm/widget.h>
_DEFS(gtkmm,gtk)
@@ -70,8 +72,10 @@ public:
_WRAP_METHOD(void add_widget(Widget& widget), gtk_size_group_add_widget)
_WRAP_METHOD(void remove_widget(Widget& widget), gtk_size_group_remove_widget)
- _WRAP_METHOD(Glib::SListHandle<Widget*> get_widgets(), gtk_size_group_get_widgets)
- _WRAP_METHOD(Glib::SListHandle<const Widget*> get_widgets() const, gtk_size_group_get_widgets)
+#m4 _CONVERSION(`GSList*',`std::vector<Widget*>',`Glib::SListHandler<Widget*>::slist_to_vector ($3, Glib::OWNERSHIP_NONE)')
+ _WRAP_METHOD(std::vector<Widget*> get_widgets(), gtk_size_group_get_widgets)
+#m4 _CONVERSION(`GSList*',`std::vector<const Widget*>',`Glib::SListHandler<const Widget*>::slist_to_vector ($3, Glib::OWNERSHIP_NONE)')
+ _WRAP_METHOD(std::vector<const Widget*> get_widgets() const, gtk_size_group_get_widgets)
_WRAP_PROPERTY("mode", SizeGroupMode)
_WRAP_PROPERTY("ignore_hidden", bool)
diff --git a/gtk/src/targetlist.ccg b/gtk/src/targetlist.ccg
index d6e0023..ffe5159 100644
--- a/gtk/src/targetlist.ccg
+++ b/gtk/src/targetlist.ccg
@@ -15,17 +15,19 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
namespace Gtk
{
-Glib::RefPtr<Gtk::TargetList> TargetList::create(const ArrayHandle_TargetEntry& targets)
+Glib::RefPtr<Gtk::TargetList> TargetList::create(const std::vector<TargetEntry>& targets)
{
- return Glib::wrap(gtk_target_list_new(targets.data(), targets.size()));
+ return Glib::wrap(gtk_target_list_new(Glib::ArrayHandler<TargetEntry, TargetEntryTraits>::vector_to_array (targets).data(), targets.size()));
}
-void TargetList::add(const ArrayHandle_TargetEntry& targets)
+void TargetList::add(const std::vector<TargetEntry>& targets)
{
- gtk_target_list_add_table(gobj(), targets.data(), targets.size());
+ gtk_target_list_add_table(gobj(), Glib::ArrayHandler<TargetEntry, TargetEntryTraits>::vector_to_array (targets).data(), targets.size());
}
} // namespace Gtk
diff --git a/gtk/src/targetlist.hg b/gtk/src/targetlist.hg
index 318e5bf..571556f 100644
--- a/gtk/src/targetlist.hg
+++ b/gtk/src/targetlist.hg
@@ -17,6 +17,8 @@
_DEFS(gtkmm,gtk)
+#include <vector>
+
#include <gtkmm/enums.h>
#include <gtkmm/targetentry.h>
#include <gdkmm/types.h>
@@ -31,11 +33,11 @@ class TargetList
_CLASS_OPAQUE_REFCOUNTED(TargetList, GtkTargetList, NONE, gtk_target_list_ref, gtk_target_list_unref)
_IGNORE(gtk_selection_data_copy, gtk_selection_data_free)
public:
- static Glib::RefPtr<Gtk::TargetList> create(const ArrayHandle_TargetEntry& targets);
+ static Glib::RefPtr<Gtk::TargetList> create(const std::vector<TargetEntry>& targets);
#m4 _CONVERSION(`TargetFlags', `guint', `($2)($3)')
_WRAP_METHOD(void add(const Glib::ustring& target, TargetFlags flags = TargetFlags(0), guint info = 0), gtk_target_list_add)
- void add(const ArrayHandle_TargetEntry& targets);
+ void add(const std::vector<TargetEntry>& targets);
_WRAP_METHOD(void remove(const Glib::ustring& target), gtk_target_list_remove)
_WRAP_METHOD(bool find(const Glib::ustring& target, guint* info) const, gtk_target_list_find)
};
diff --git a/gtk/src/textbuffer.ccg b/gtk/src/textbuffer.ccg
index c8fc251..7bb5b8e 100644
--- a/gtk/src/textbuffer.ccg
+++ b/gtk/src/textbuffer.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h>
#include <glib.h>
#include <gtkmm/textmark.h>
@@ -332,7 +334,7 @@ TextBuffer::iterator TextBuffer::insert_with_tag(const iterator& pos,
}
TextBuffer::iterator TextBuffer::insert_with_tags(const iterator& pos, const Glib::ustring& text,
- const Glib::ArrayHandle< Glib::RefPtr<Tag> >& tags)
+ const std::vector< Glib::RefPtr<Tag> >& tags)
{
const char *const text_begin = text.data();
return insert_with_tags(pos, text_begin, text_begin + text.bytes(), tags);
@@ -340,7 +342,7 @@ TextBuffer::iterator TextBuffer::insert_with_tags(const iterator& pos, const Gli
TextBuffer::iterator TextBuffer::insert_with_tags(const iterator& pos,
const char* text_begin, const char* text_end,
- const Glib::ArrayHandle< Glib::RefPtr<Tag> >& tags)
+ const std::vector< Glib::RefPtr<Tag> >& tags)
{
const int start_offset = pos.get_offset();
iterator range_end (insert(pos, text_begin, text_end));
@@ -348,14 +350,15 @@ TextBuffer::iterator TextBuffer::insert_with_tags(const iterator& pos,
GtkTextIter range_begin;
gtk_text_buffer_get_iter_at_offset(gobj(), &range_begin, start_offset);
+ Glib::ArrayHandler<Glib::RefPtr<Tag> >::ArrayKeeperType array_keeper (Glib::ArrayHandler<Glib::RefPtr<Tag> >::vector_to_array (tags));
+
//This was GtkTextTag* const * const, but the SUN Forte compiler said that it couldn't convert to that. murrayc
- const GtkTextTag* const* tags_begin = tags.data();
+ const GtkTextTag* const* tags_begin = array_keeper.data();
const GtkTextTag* const* tags_end = tags_begin + tags.size();
//TODO: Investigate if this const_cast<> is really necessary.
//I added it for the SUN Forte compiler. murrayc.
- for(GtkTextTag *const * ptag = const_cast<GtkTextTag* const *>(tags_begin); ptag != const_cast<GtkTextTag* const *>(tags_end);
-++ptag)
+ for(GtkTextTag *const * ptag = const_cast<GtkTextTag* const *>(tags_begin); ptag != const_cast<GtkTextTag* const *>(tags_end); ++ptag)
{
gtk_text_buffer_apply_tag(gobj(), *ptag, &range_begin, range_end.gobj());
}
@@ -364,7 +367,7 @@ TextBuffer::iterator TextBuffer::insert_with_tags(const iterator& pos,
}
TextBuffer::iterator TextBuffer::insert_with_tags_by_name(const iterator& pos, const Glib::ustring& text,
- const Glib::ArrayHandle<Glib::ustring>& tag_names)
+ const std::vector<Glib::ustring>& tag_names)
{
const char *const text_begin = text.data();
return insert_with_tags_by_name(pos, text_begin, text_begin + text.bytes(), tag_names);
@@ -372,7 +375,7 @@ TextBuffer::iterator TextBuffer::insert_with_tags_by_name(const iterator& pos, c
TextBuffer::iterator TextBuffer::insert_with_tags_by_name(const iterator& pos,
const char* text_begin, const char* text_end,
- const Glib::ArrayHandle<Glib::ustring>& tag_names)
+ const std::vector<Glib::ustring>& tag_names)
{
// gtk_buffer_insert_with_tags_by_name() is a convenience wrapper, so it's kind of OK to reimplement it:
@@ -383,8 +386,9 @@ TextBuffer::iterator TextBuffer::insert_with_tags_by_name(const iterator& pos,
gtk_text_buffer_get_iter_at_offset(gobj(), &range_begin, start_offset);
GtkTextTagTable *const tag_table = gtk_text_buffer_get_tag_table(gobj());
+ Glib::ArrayHandler<Glib::ustring>::ArrayKeeperType array_keeper (Glib::ArrayHandler<Glib::ustring>::vector_to_array (tag_names));
- const char *const *const names_begin = tag_names.data();
+ const char *const *const names_begin = array_keeper.data();
const char *const *const names_end = names_begin + tag_names.size();
for(const char *const * pname = names_begin; pname != names_end; ++pname)
@@ -489,46 +493,24 @@ int TextBuffer::size() const
return get_char_count();
}
-//This is not public API:
-//(and it is copy/pasted from clipboard.ccg)
-typedef std::list<Glib::ustring> listStrings;
-static listStrings util_convert_atoms_to_strings(GdkAtom* targets, int n_targets)
-{
- listStrings listTargets;
-
- //Add the targets to the C++ container:
- for(int i = 0; i < n_targets; i++)
- {
- //Convert the atom to a string:
- char* atom_name = gdk_atom_name(targets[i]);
- if(atom_name)
- {
- listTargets.push_back( Glib::ustring(atom_name) );
- g_free(atom_name);
- }
- }
-
- return listTargets;
-}
-
Glib::ustring TextBuffer::get_text(bool include_hidden_chars) const
{
TextBuffer* unconst = const_cast<TextBuffer*>(this); //Because begin() and end() are not const.
return get_text(unconst->begin(), unconst->end(), include_hidden_chars);
}
-Glib::StringArrayHandle TextBuffer::get_serialize_formats() const
+std::vector<std::vector> TextBuffer::get_serialize_formats() const
{
int n_atoms = 0;
GdkAtom* atoms = gtk_text_buffer_get_serialize_formats(const_cast<GtkTextBuffer*>(gobj()), &n_atoms);
- return util_convert_atoms_to_strings(atoms, n_atoms);
+ return Glib::ArrayHandler<std::string, Gdk::AtomStringTraits>::array_to_vector(atoms, n_atoms, Glib::OWNERSHIP_SHALLOW);
}
-Glib::StringArrayHandle TextBuffer::get_deserialize_formats() const
+std::vector<Glib::ustring> TextBuffer::get_deserialize_formats() const
{
int n_atoms = 0;
GdkAtom* atoms = gtk_text_buffer_get_deserialize_formats(const_cast<GtkTextBuffer*>(gobj()), &n_atoms);
- return util_convert_atoms_to_strings(atoms, n_atoms);
+ return Glib::ArrayHandler<std::string, Gdk::AtomStringTraits>::array_to_vector(atoms, n_atoms, Glib::OWNERSHIP_SHALLOW);
}
/*
diff --git a/gtk/src/textbuffer.hg b/gtk/src/textbuffer.hg
index c91333d..f602947 100644
--- a/gtk/src/textbuffer.hg
+++ b/gtk/src/textbuffer.hg
@@ -21,6 +21,8 @@
// the #ifndef GTKMM_DISABLE_DEPRECATED in deprecated classes) is generated:
_CONFIGINCLUDE(gtkmmconfig.h)
+#include <vector>
+
#include <gtkmm/texttagtable.h>
#include <gtkmm/textchildanchor.h>
#include <gtkmm/textmark.h>
@@ -250,7 +252,7 @@ public:
* @result Whether text was actually inserted
*/
iterator insert_with_tags(const iterator& pos, const Glib::ustring& text,
- const Glib::ArrayHandle< Glib::RefPtr<Tag> >& tags);
+ const std::vector< Glib::RefPtr<Tag> >& tags);
/** Inserts text into buffer at @a pos, applying the list of tags to the newly-inserted text.
* Equivalent to calling insert(), then apply_tag() on the inserted text; This is just a convenience function.
@@ -262,7 +264,7 @@ public:
* @result Whether text was actually inserted
*/
iterator insert_with_tags(const iterator& pos, const char* text_begin, const char* text_end,
- const Glib::ArrayHandle< Glib::RefPtr<Tag> >& tags);
+ const std::vector< Glib::RefPtr<Tag> >& tags);
/** Inserts text into buffer at @a pos, applying the list of tags to the newly-inserted text.
* Equivalent to calling insert(), then apply_tag() on the inserted text; This is just a convenience function.
@@ -273,7 +275,7 @@ public:
* @result Whether text was actually inserted
*/
iterator insert_with_tags_by_name(const iterator& pos, const Glib::ustring& text,
- const Glib::StringArrayHandle& tag_names);
+ const std::vector<Glib::ustring>& tag_names);
/** Equivalent to calling insert(), then apply_tag() on the inserted text; This is just a convenience function.
@@ -285,7 +287,7 @@ public:
* @result Whether text was actually inserted
*/
iterator insert_with_tags_by_name(const iterator& pos, const char* text_begin, const char* text_end,
- const Glib::StringArrayHandle& tag_names);
+ const std::vector<Glib::ustring>& tag_names);
/* Deletes all text between @a range_begin and @a range_end. The order of range_begin and range_end is not actually relevant.
* This function actually emits the "delete_range" signal, and the default handler of that signal deletes the text.
@@ -469,6 +471,7 @@ public:
//TODO: Use ArrayHandle, or just use guint8* to be more efficient?
+// TODO: Or rather - vector utils.
// typedef sigc::slot<bool, const Glib::RefPtr<TextBuffer>& /* content_buffer */, iterator& /* iter */, const guint8* /* data */, gsize /* length */, bool /* create_tags */> SlotDeserialize;
/*
@@ -491,9 +494,9 @@ public:
_WRAP_METHOD(bool get_can_create_tags(const Glib::ustring& format) const, gtk_text_buffer_deserialize_get_can_create_tags)
- Glib::StringArrayHandle get_serialize_formats() const;
+ std::vector<Glib::ustring> get_serialize_formats() const;
_IGNORE(gtk_text_buffer_get_serialize_formats)
- Glib::StringArrayHandle get_deserialize_formats() const;
+ std::vector<Glib::ustring> get_deserialize_formats() const;
_IGNORE(gtk_text_buffer_get_deserialize_formats)
/*
@@ -508,7 +511,7 @@ public:
gsize& length), gtk_text_buffer_serialize)
//TODO: Is the bool superfluous?
-//TODO: Use an ArrayHandle?
+//TODO: Use an ArrayHandle? Or rather - vector utils.
_WRAP_METHOD(bool deserialize(const Glib::RefPtr<TextBuffer>& content_buffer,
const Glib::ustring& format,
const iterator& iter, const guint8* data,
diff --git a/gtk/src/textchildanchor.ccg b/gtk/src/textchildanchor.ccg
index 7adf20d..e8f5126 100644
--- a/gtk/src/textchildanchor.ccg
+++ b/gtk/src/textchildanchor.ccg
@@ -20,4 +20,6 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h>
diff --git a/gtk/src/textchildanchor.hg b/gtk/src/textchildanchor.hg
index 553180e..0f15a79 100644
--- a/gtk/src/textchildanchor.hg
+++ b/gtk/src/textchildanchor.hg
@@ -19,9 +19,9 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
#include <gtkmm/widget.h>
-#include <glibmm/listhandle.h>
_DEFS(gtkmm,gtk)
_PINCLUDE(glibmm/private/object_p.h)
@@ -45,8 +45,10 @@ protected:
public:
_WRAP_CREATE()
- _WRAP_METHOD(Glib::ListHandle<Widget*> get_widgets(), gtk_text_child_anchor_get_widgets)
- _WRAP_METHOD(Glib::ListHandle<const Widget*> get_widgets() const, gtk_text_child_anchor_get_widgets)
+#m4 _CONVERSION(`GList*',`std::vector<Widget*>',`Glib::ListHandler<Widget*>::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector<Widget*> get_widgets(), gtk_text_child_anchor_get_widgets)
+#m4 _CONVERSION(`GList*',`std::vector<const Widget*>',`Glib::ListHandler<const Widget*>::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector<const Widget*> get_widgets() const, gtk_text_child_anchor_get_widgets)
_WRAP_METHOD(bool get_deleted() const, gtk_text_child_anchor_get_deleted)
//These methods, and GtkTextLayout are semi-private:
diff --git a/gtk/src/textiter.ccg b/gtk/src/textiter.ccg
index 303cbc4..af48bc2 100644
--- a/gtk/src/textiter.ccg
+++ b/gtk/src/textiter.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtkmm/texttag.h>
#include <gtkmm/textbuffer.h>
diff --git a/gtk/src/textiter.hg b/gtk/src/textiter.hg
index 0bdafd4..5a9a6d6 100644
--- a/gtk/src/textiter.hg
+++ b/gtk/src/textiter.hg
@@ -17,8 +17,9 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <glibmm/exceptionhandler.h>
-#include <glibmm/slisthandle.h>
#include <gdkmm/pixbuf.h>
#include <gtkmm/texttag.h>
#include <gtkmm/textchildanchor.h>
@@ -116,14 +117,18 @@ public:
_WRAP_METHOD(Glib::ustring get_visible_text(const TextIter& end) const, gtk_text_iter_get_visible_text)
_WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> get_pixbuf() const, gtk_text_iter_get_pixbuf, refreturn)
- _WRAP_METHOD(Glib::SListHandle< Glib::RefPtr<TextMark> > get_marks(), gtk_text_iter_get_marks)
- _WRAP_METHOD(Glib::SListHandle< Glib::RefPtr<const TextMark> > get_marks() const, gtk_text_iter_get_marks)
+#m4 _CONVERSION(`GSList*',`std::vector< Glib::RefPtr<TextMark> >',`Glib::SListHandler<Glib::RefPtr<TextMark> >::slist_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<TextMark> > get_marks(), gtk_text_iter_get_marks)
+#m4 _CONVERSION(`GSList*',`std::vector< Glib::RefPtr<const TextMark> >',`Glib::SListHandler<Glib::RefPtr<const TextMark> >::slist_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<const TextMark> > get_marks() const, gtk_text_iter_get_marks)
_WRAP_METHOD(Glib::RefPtr<TextChildAnchor> get_child_anchor(), gtk_text_iter_get_child_anchor, refreturn)
_WRAP_METHOD(Glib::RefPtr<const TextChildAnchor> get_child_anchor() const, gtk_text_iter_get_child_anchor, refreturn)
- _WRAP_METHOD(Glib::SListHandle< Glib::RefPtr<TextTag> > get_toggled_tags(bool toggled_on = true), gtk_text_iter_get_toggled_tags)
- _WRAP_METHOD(Glib::SListHandle< Glib::RefPtr<const TextTag> > get_toggled_tags(bool toggled_on = true) const, gtk_text_iter_get_toggled_tags)
+#m4 _CONVERSION(`GSList*',`std::vector< Glib::RefPtr<TextTag> >',`Glib::SListHandler<Glib::RefPtr<TextTag> >::slist_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<TextTag> > get_toggled_tags(bool toggled_on = true), gtk_text_iter_get_toggled_tags)
+#m4 _CONVERSION(`GSList*',`std::vector< Glib::RefPtr<const TextTag> >',`Glib::SListHandler<Glib::RefPtr<const TextTag> >::slist_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<const TextTag> > get_toggled_tags(bool toggled_on = true) const, gtk_text_iter_get_toggled_tags)
_WRAP_METHOD(bool begins_tag(const Glib::RefPtr<const TextTag>& tag) const, gtk_text_iter_begins_tag)
bool begins_tag() const;
@@ -135,8 +140,8 @@ public:
_WRAP_METHOD(bool has_tag(const Glib::RefPtr<const TextTag>& tag) const, gtk_text_iter_has_tag)
bool has_tag() const;
- _WRAP_METHOD(Glib::SListHandle< Glib::RefPtr<TextTag> > get_tags(), gtk_text_iter_get_tags)
- _WRAP_METHOD(Glib::SListHandle< Glib::RefPtr<const TextTag> > get_tags() const, gtk_text_iter_get_tags)
+ _WRAP_METHOD(std::vector< Glib::RefPtr<TextTag> > get_tags(), gtk_text_iter_get_tags)
+ _WRAP_METHOD(std::vector< Glib::RefPtr<const TextTag> > get_tags() const, gtk_text_iter_get_tags)
_WRAP_METHOD(bool editable(bool default_setting = true) const, gtk_text_iter_editable)
_WRAP_METHOD(bool can_insert(bool default_editability = true) const, gtk_text_iter_can_insert)
diff --git a/gtk/src/treemodel.ccg b/gtk/src/treemodel.ccg
index cac516e..80339e4 100644
--- a/gtk/src/treemodel.ccg
+++ b/gtk/src/treemodel.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtkmm/treeiter.h>
#include <gtkmm/treepath.h>
#include <gtk/gtk.h>
@@ -590,16 +592,22 @@ g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) /
-void TreeModel::rows_reordered(const Path& path, const iterator& iter, const Glib::ArrayHandle<int>& new_order)
+void TreeModel::rows_reordered(const Path& path, const iterator& iter, const std::vector<int>& new_order)
{
//The size of the array seems to be based on the known number of children. murrayc.
- gtk_tree_model_rows_reordered(gobj(), const_cast<GtkTreePath*>((path).gobj()), const_cast<GtkTreeIter*>((iter).gobj()), const_cast<int*>(new_order.data()));
+ gtk_tree_model_rows_reordered(gobj(),
+ const_cast<GtkTreePath*>((path).gobj()),
+ const_cast<GtkTreeIter*>((iter).gobj()),
+ const_cast<int*>(Glib::ArrayHandler<int>::vector_to_data (new_order).data ()));
}
-void TreeModel::rows_reordered(const Path& path, const Glib::ArrayHandle<int>& new_order)
+void TreeModel::rows_reordered(const Path& path, const std::vector<int>& new_order)
{
//The size of the array seems to be based on the known number of children. murrayc.
- gtk_tree_model_rows_reordered(gobj(), const_cast<GtkTreePath*>((path).gobj()), 0, const_cast<int*>(new_order.data()));
+ gtk_tree_model_rows_reordered(gobj(),
+ const_cast<GtkTreePath*>((path).gobj()),
+ 0,
+ const_cast<int*>(Glib::ArrayHandler<int>::vector_to_array (new_order).data ()));
}
} // namespace Gtk
diff --git a/gtk/src/treemodel.hg b/gtk/src/treemodel.hg
index 252f5e2..6bbfd1e 100644
--- a/gtk/src/treemodel.hg
+++ b/gtk/src/treemodel.hg
@@ -17,6 +17,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <gtk/gtk.h>
#include <glibmm/interface.h>
#include <gtkmm/treeiter.h>
@@ -192,11 +194,11 @@ public:
* custom models when their rows have been reordered.
*
* @param path A tree path pointing to the tree node whose children have been reordered.
- * @param iter A valid iterator pointing to the node whose children have been reordered. See also, rows_reordered(const Path& path, const Glib::ArrayHandle<int>& new_order), if the path has a depth of 0.
+ * @param iter A valid iterator pointing to the node whose children have been reordered. See also, rows_reordered(const Path& path, const std::vector<int>& new_order), if the path has a depth of 0.
* @param new_order An array of integers mapping the current position of each child
* to its old position before the re-ordering, i.e. @a new_order<literal>[newpos] = oldpos.
*/
- void rows_reordered(const Path& path, const iterator& iter, const Glib::ArrayHandle<int>& new_order);
+ void rows_reordered(const Path& path, const iterator& iter, const std::vector<int>& new_order);
/** Emits the "rows_reordered" signal on the tree model. This should be called by
* custom models when their rows have been reordered. This method overload is for nodes whose
@@ -207,7 +209,7 @@ public:
* @param new_order An array of integers mapping the current position of each child
* to its old position before the re-ordering, i.e. @a new_order<literal>[newpos] = oldpos.
*/
- void rows_reordered(const Path& path, const Glib::ArrayHandle<int>& new_order);
+ void rows_reordered(const Path& path, const std::vector<int>& new_order);
_WRAP_METHOD(void rows_reordered(const Path& path, const iterator& iter, int* new_order), gtk_tree_model_rows_reordered)
diff --git a/gtk/src/treepath.hg b/gtk/src/treepath.hg
index 1f7bd69..a5ccafd 100644
--- a/gtk/src/treepath.hg
+++ b/gtk/src/treepath.hg
@@ -196,10 +196,7 @@ void TreePath::assign(In pbegin, In pend)
this->swap(temp);
}
-
-/* Traits for use of TreePath in a Glib::ListHandle<>.
- */
-struct TreePath_Traits
+struct TreePathTraits
{
typedef TreePath CppType;
typedef const GtkTreePath* CType;
diff --git a/gtk/src/treeselection.ccg b/gtk/src/treeselection.ccg
index 3f11b8b..2659591 100644
--- a/gtk/src/treeselection.ccg
+++ b/gtk/src/treeselection.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtkmm/treeview.h>
#include <gtk/gtk.h>
@@ -163,18 +165,18 @@ void TreeSelection::selected_foreach(const SlotForeachPathAndIter& slot) const
gtk_tree_selection_selected_foreach(const_cast<GtkTreeSelection*>(gobj()), &proxy_foreach_selection_path_and_iter_callback, &slot_copy);
}
-TreeSelection::ListHandle_Path TreeSelection::get_selected_rows() const
+std::vector<TreeModel::Path> TreeSelection::get_selected_rows() const
{
- return ListHandle_Path(gtk_tree_selection_get_selected_rows(
+ return Glib::ListHandler<TreeModel::Path, TreePathTraits>::array_to_vector (gtk_tree_selection_get_selected_rows(
const_cast<GtkTreeSelection*>(gobj()), 0), Glib::OWNERSHIP_DEEP);
}
-TreeSelection::ListHandle_Path TreeSelection::get_selected_rows(Glib::RefPtr<TreeModel>& model)
+std::vector<TreeModel::Path> TreeSelection::get_selected_rows(Glib::RefPtr<TreeModel>& model)
{
GtkTreeModel* model_gobject = 0;
- const ListHandle_Path result (gtk_tree_selection_get_selected_rows(
- const_cast<GtkTreeSelection*>(gobj()), &model_gobject), Glib::OWNERSHIP_DEEP);
+ const std::vector<TreeModel::Path> result (Glib::ListHandler<TreeModel::Path, TreePathTraits>::array_to_vector (gtk_tree_selection_get_selected_rows(
+ const_cast<GtkTreeSelection*>(gobj()), &model_gobject), Glib::OWNERSHIP_DEEP));
model = Glib::wrap(model_gobject, true);
return result;
diff --git a/gtk/src/treeselection.hg b/gtk/src/treeselection.hg
index a95a33c..e859c5e 100644
--- a/gtk/src/treeselection.hg
+++ b/gtk/src/treeselection.hg
@@ -17,6 +17,7 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
#include <gtkmm/enums.h>
#include <gtkmm/treemodel.h>
@@ -116,15 +117,13 @@ public:
*/
TreeModel::iterator get_selected(Glib::RefPtr<TreeModel>& model);
- typedef Glib::ListHandle<TreeModel::Path, TreePath_Traits> ListHandle_Path;
-
/** Creates a list of paths of all selected rows.
* Additionally, if you are planning on modifying the model after calling this function,
* you may want to convert the returned list into a list of GtkTreeRowReferences.
*
* @returns a standard container containing a Gtk::Model::Path for each selected row.
*/
- ListHandle_Path get_selected_rows() const;
+ std::vector<TreeModel::Path> get_selected_rows() const;
/** Creates a list of paths of all selected rows.
* Additionally, if you are planning on modifying the model after calling this function,
@@ -133,7 +132,7 @@ public:
* @retval model The current TreeModel.
* @returns a standard container containing a Gtk::Model::Path for each selected row.
*/
- ListHandle_Path get_selected_rows(Glib::RefPtr<TreeModel>& model);
+ std::vector<TreeModel::Path> get_selected_rows(Glib::RefPtr<TreeModel>& model);
_WRAP_METHOD(int count_selected_rows() const, gtk_tree_selection_count_selected_rows)
diff --git a/gtk/src/treestore.ccg b/gtk/src/treestore.ccg
index beeb792..8d1f008 100644
--- a/gtk/src/treestore.ccg
+++ b/gtk/src/treestore.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h>
@@ -122,11 +124,11 @@ void TreeStore::move(const iterator& source, const iterator& destination)
const_cast<GtkTreeIter*>(destination.get_gobject_if_not_end()));
}
-void TreeStore::reorder(const TreeNodeChildren& node, const Glib::ArrayHandle<int>& new_order)
+void TreeStore::reorder(const TreeNodeChildren& node, const std::vector<int>& new_order)
{
gtk_tree_store_reorder(gobj(),
const_cast<GtkTreeIter*>(node.get_parent_gobject()),
- const_cast<int*>(new_order.data()));
+ const_cast<int*>(Glib::ArrayHandler<int>::vector_to_array (new_order).data ()));
}
void TreeStore::set_value_impl(const iterator& row, int column, const Glib::ValueBase& value)
diff --git a/gtk/src/treestore.hg b/gtk/src/treestore.hg
index ed1233d..35be487 100644
--- a/gtk/src/treestore.hg
+++ b/gtk/src/treestore.hg
@@ -17,6 +17,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <gtkmm/treeiter.h>
#include <gtkmm/treemodel.h>
#include <gtkmm/treesortable.h>
@@ -152,7 +154,7 @@ public:
/** Reorders the children of @a node to follow the order indicated by @a new_order.
* Note that this function only works with unsorted stores.
*/
- void reorder(const TreeNodeChildren& node, const Glib::ArrayHandle<int>& new_order);
+ void reorder(const TreeNodeChildren& node, const std::vector<int>& new_order);
_WRAP_METHOD(void clear(), gtk_tree_store_clear)
_WRAP_METHOD(bool is_ancestor(const iterator& iter, const iterator& descendant) const, gtk_tree_store_is_ancestor)
diff --git a/gtk/src/treeview.ccg b/gtk/src/treeview.ccg
index d3f16cc..446c3ff 100644
--- a/gtk/src/treeview.ccg
+++ b/gtk/src/treeview.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtkmm/treeviewcolumn.h>
#include <gtkmm/treeview_private.h>
#include <gtkmm/treemodel.h>
@@ -145,13 +147,14 @@ void TreeView::get_cursor(TreeModel::Path& path, TreeViewColumn*& focus_column)
}
-void TreeView::enable_model_drag_source(const ArrayHandle_TargetEntry& targets,
+void TreeView::enable_model_drag_source(const std::vector<TargetEntry>& targets,
Gdk::ModifierType start_button_mask,
Gdk::DragAction actions)
{
gtk_tree_view_enable_model_drag_source(
gobj(), (GdkModifierType) start_button_mask,
- targets.data(), targets.size(), (GdkDragAction) actions);
+ Glib::ArrayHandler<TargetEntry, TargetEntryTraits>::vector_to_array (targets).data(),
+ targets.size(), (GdkDragAction) actions);
}
void TreeView::enable_model_drag_source(Gdk::ModifierType start_button_mask, Gdk::DragAction actions)
@@ -161,10 +164,11 @@ void TreeView::enable_model_drag_source(Gdk::ModifierType start_button_mask, Gdk
enable_model_drag_source(listTargets, start_button_mask, actions);
}
-void TreeView::enable_model_drag_dest(const ArrayHandle_TargetEntry& targets, Gdk::DragAction actions)
+void TreeView::enable_model_drag_dest(const std::vector<TargetEntry>& targets, Gdk::DragAction actions)
{
gtk_tree_view_enable_model_drag_dest(
- gobj(), targets.data(), targets.size(), (GdkDragAction) actions);
+ gobj(), Glib::ArrayHandler<TargetEntry, TargetEntryTraits>::vector_to_array (targets).data(),
+ targets.size(), (GdkDragAction) actions);
}
void TreeView::enable_model_drag_dest(Gdk::DragAction actions)
diff --git a/gtk/src/treeview.hg b/gtk/src/treeview.hg
index 341d641..191d399 100644
--- a/gtk/src/treeview.hg
+++ b/gtk/src/treeview.hg
@@ -19,7 +19,8 @@
// the #ifndef GTKMM_DISABLE_DEPRECATED in deprecated classes) is generated:
_CONFIGINCLUDE(gtkmmconfig.h)
-#include <glibmm/listhandle.h>
+#include <vector>
+
#include <gtkmm/container.h>
#include <gtkmm/treeviewcolumn.h>
#include <gtkmm/treeselection.h>
@@ -300,8 +301,10 @@ public:
*/
const CellRenderer* get_column_cell_renderer(int n) const;
- _WRAP_METHOD(Glib::ListHandle<TreeViewColumn*> get_columns(), gtk_tree_view_get_columns)
- _WRAP_METHOD(Glib::ListHandle<const TreeViewColumn*> get_columns() const, gtk_tree_view_get_columns)
+#m4 _CONVERSION(`GList*',`std::vector<TreeViewColumn*>',`Glib::ListHandler<TreeViewColumn*>::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector<TreeViewColumn*> get_columns(), gtk_tree_view_get_columns)
+#m4 _CONVERSION(`GList*',`std::vector<const TreeViewColumn*>',`Glib::ListHandler<const TreeViewColumn*>::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector<const TreeViewColumn*> get_columns() const, gtk_tree_view_get_columns)
_WRAP_METHOD(void move_column_after(TreeViewColumn& column, TreeViewColumn& base_column), gtk_tree_view_move_column_after)
@@ -563,7 +566,7 @@ public:
* @param start_button_mask Mask of allowed buttons to start drag.
* @param actions The bitmask of possible actions for a drag from this widget.
*/
- void enable_model_drag_source(const ArrayHandle_TargetEntry& targets,
+ void enable_model_drag_source(const std::vector<TargetEntry>& targets,
Gdk::ModifierType start_button_mask = Gdk::MODIFIER_MASK,
Gdk::DragAction actions = Gdk::ACTION_COPY | Gdk::ACTION_MOVE);
@@ -584,7 +587,7 @@ public:
* @param targets The table of targets that the drag will support.
* @param actions The bitmask of possible actions for a drag from this widget.
*/
- void enable_model_drag_dest(const ArrayHandle_TargetEntry& targets, Gdk::DragAction actions = Gdk::ACTION_COPY | Gdk::ACTION_MOVE);
+ void enable_model_drag_dest(const std::vector<TargetEntry>& targets, Gdk::DragAction actions = Gdk::ACTION_COPY | Gdk::ACTION_MOVE);
/** Turns the TreeView into a drop destination for automatic DND. This uses the default
* "GTK_TREE_MODEL_ROW" target, which the TreeView can handle automatically.
diff --git a/gtk/src/uimanager.ccg b/gtk/src/uimanager.ccg
index 03a501d..6460ef1 100644
--- a/gtk/src/uimanager.ccg
+++ b/gtk/src/uimanager.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtk/gtk.h>
diff --git a/gtk/src/uimanager.hg b/gtk/src/uimanager.hg
index e63c402..0f1f0e8 100644
--- a/gtk/src/uimanager.hg
+++ b/gtk/src/uimanager.hg
@@ -17,10 +17,11 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <gtkmm/widget.h>
#include <gtkmm/action.h>
#include <gtkmm/actiongroup.h>
-#include <gtkmm/uimanager.h>
_DEFS(gtkmm,gtk)
_PINCLUDE(glibmm/private/object_p.h)
@@ -188,19 +189,20 @@ public:
_WRAP_METHOD(void remove_action_group(const Glib::RefPtr<ActionGroup>& action_group), gtk_ui_manager_remove_action_group)
#m4 dnl // Override the conversion in convert_gtk.m4, because the default behaviour is wrong for this method:
-#m4 _CONVERSION(`GList*', `Glib::ListHandle Glib::RefPtr<ActionGroup> >', __FL2H_NONE)
-#m4 _CONVERSION(`GList*', `Glib::ListHandle< Glib::RefPtr<ActionGroup> >', __FL2H_NONE)
-
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<ActionGroup> > get_action_groups(), gtk_ui_manager_get_action_groups)
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<const ActionGroup> > get_action_groups() const, gtk_ui_manager_get_action_groups)
+#m4 _CONVERSION(`GList*', `std::vector< Glib::RefPtr<ActionGroup> >', `Glib::ListHandler<Glib::RefPtr<ActionGroup> >::list_to_vector ($3, Glib::OWNERSHIP_NONE)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<ActionGroup> > get_action_groups(), gtk_ui_manager_get_action_groups)
+#m4 _CONVERSION(`GList*', `std::vector< Glib::RefPtr<const ActionGroup> >', `Glib::ListHandler<Glib::RefPtr<const ActionGroup> >::list_to_vector ($3, Glib::OWNERSHIP_NONE)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<const ActionGroup> > get_action_groups() const, gtk_ui_manager_get_action_groups)
_WRAP_METHOD(Glib::RefPtr<AccelGroup> get_accel_group(), gtk_ui_manager_get_accel_group, refreturn)
_WRAP_METHOD(Glib::RefPtr<const AccelGroup> get_accel_group() const, gtk_ui_manager_get_accel_group, refreturn, constversion)
_WRAP_METHOD(Widget* get_widget(const Glib::ustring& path), gtk_ui_manager_get_widget)
_WRAP_METHOD(const Widget* get_widget(const Glib::ustring& path) const, gtk_ui_manager_get_widget, constversion)
- _WRAP_METHOD(Glib::SListHandle<Widget*> get_toplevels(UIManagerItemType types), gtk_ui_manager_get_toplevels)
- _WRAP_METHOD(Glib::SListHandle<const Widget*> get_toplevels(UIManagerItemType types) const, gtk_ui_manager_get_toplevels)
+#m4 _CONVERSION(`GSList*',`std::vector<Widget*>',`Glib::SListHandler<Widget*>::slist_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector<Widget*> get_toplevels(UIManagerItemType types), gtk_ui_manager_get_toplevels)
+#m4 _CONVERSION(`GSList*',`std::vector<const Widget*>',`Glib::SListHandler<const Widget*>::slist_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector<const Widget*> get_toplevels(UIManagerItemType types) const, gtk_ui_manager_get_toplevels)
_WRAP_METHOD(Glib::RefPtr<Action> get_action(const Glib::ustring& path), gtk_ui_manager_get_action, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Action> get_action(const Glib::ustring& path) const, gtk_ui_manager_get_action, refreturn, constversion)
diff --git a/gtk/src/widget.ccg b/gtk/src/widget.ccg
index f297a69..726e99d 100644
--- a/gtk/src/widget.ccg
+++ b/gtk/src/widget.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtkmm/adjustment.h>
#include <gtkmm/window.h>
#include <gtkmm/accelgroup.h>
@@ -224,24 +226,26 @@ void Widget::drag_dest_set(DestDefaults flags, Gdk::DragAction actions)
gtk_drag_dest_set(gobj(), (GtkDestDefaults)flags, 0, 0, (GdkDragAction)actions);
}
-void Widget::drag_dest_set(const ArrayHandle_TargetEntry& targets,
+void Widget::drag_dest_set(const std::vector<TargetEntry>& targets,
DestDefaults flags, Gdk::DragAction actions)
{
// I've used Gdk::ACTION_COPY as the default, because Gdk::ACTION_DEFAULT means that
// it's never a drag destination, so it would seem like this method didn't work. murrayc.
gtk_drag_dest_set(
gobj(), (GtkDestDefaults)flags,
- targets.data(), targets.size(), (GdkDragAction)actions);
+ Glib::ArrayHandler<TargetEntry, TargetEntryTraits>::vector_to_array (targets).data(),
+ targets.size(), (GdkDragAction)actions);
}
-void Widget::drag_source_set(const ArrayHandle_TargetEntry& targets,
+void Widget::drag_source_set(const std::vector<TargetEntry>& targets,
Gdk::ModifierType start_button_mask, Gdk::DragAction actions)
{
// I've used Gdk::MODIFIER_MASK as the default, because it seems
// to mean 'whatever is possible in the context'. murrayc.
gtk_drag_source_set(
gobj(), (GdkModifierType)start_button_mask,
- targets.data(), targets.size(), (GdkDragAction)actions);
+ Glib::ArrayHandler<TargetEntry, TargetEntryTraits>::vector_to_array (targets).data(),
+ targets.size(), (GdkDragAction)actions);
}
Widget* Widget::drag_get_source_widget(const Glib::RefPtr<Gdk::DragContext>& context) //static
diff --git a/gtk/src/widget.hg b/gtk/src/widget.hg
index 6ba1152..850b24f 100644
--- a/gtk/src/widget.hg
+++ b/gtk/src/widget.hg
@@ -17,6 +17,7 @@
_CONFIGINCLUDE(gtkmmconfig.h)
+#include <vector>
#include <pangomm/context.h>
#include <pangomm/layout.h>
@@ -411,8 +412,10 @@ public:
_WRAP_METHOD(WidgetPath get_path() const, gtk_widget_get_path)
_IGNORE(gtk_widget_path, gtk_widget_class_path) //deprecated
- _WRAP_METHOD(Glib::ListHandle<Widget*> list_mnemonic_labels(), gtk_widget_list_mnemonic_labels)
- _WRAP_METHOD(Glib::ListHandle<const Widget*> list_mnemonic_labels() const, gtk_widget_list_mnemonic_labels)
+#m4 _CONVERSION(`GList*',`std::vector<Widget*>',`Glib::ListHandler<Widget*>::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector<Widget*> list_mnemonic_labels(), gtk_widget_list_mnemonic_labels)
+#m4 _CONVERSION(`GList*',`std::vector<const Widget*>',`Glib::ListHandler<const Widget*>::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector<const Widget*> list_mnemonic_labels() const, gtk_widget_list_mnemonic_labels)
_WRAP_METHOD(void add_mnemonic_label(Widget& label), gtk_widget_add_mnemonic_label)
_WRAP_METHOD(void remove_mnemonic_label(Widget& label), gtk_widget_remove_mnemonic_label)
@@ -424,7 +427,7 @@ public:
//TODO: Change the defaults? Maybe we should use ALL for DestDefaults. See other drag_dest_set() methods here and in other widgets.
void drag_dest_set(DestDefaults flags = DestDefaults(0), Gdk::DragAction actions = Gdk::DragAction(0));
- void drag_dest_set(const ArrayHandle_TargetEntry& targets, DestDefaults flags = DEST_DEFAULT_ALL, Gdk::DragAction actions = Gdk::ACTION_COPY);
+ void drag_dest_set(const std::vector<TargetEntry>& targets, DestDefaults flags = DEST_DEFAULT_ALL, Gdk::DragAction actions = Gdk::ACTION_COPY);
_IGNORE(gtk_drag_dest_set)
_WRAP_METHOD(void drag_dest_set_proxy(const Glib::RefPtr<Gdk::Window>& proxy_window, Gdk::DragProtocol protocol, bool use_coordinates), gtk_drag_dest_set_proxy)
@@ -440,7 +443,7 @@ public:
_WRAP_METHOD(void drag_dest_add_image_targets(), gtk_drag_dest_add_image_targets)
_WRAP_METHOD(void drag_dest_add_uri_targets(), gtk_drag_dest_add_uri_targets)
- void drag_source_set(const ArrayHandle_TargetEntry& targets, Gdk::ModifierType start_button_mask = Gdk::MODIFIER_MASK, Gdk::DragAction actions = Gdk::ACTION_COPY);
+ void drag_source_set(const std::vector<TargetEntry>& targets, Gdk::ModifierType start_button_mask = Gdk::MODIFIER_MASK, Gdk::DragAction actions = Gdk::ACTION_COPY);
_IGNORE(gtk_drag_source_set)
_WRAP_METHOD(void drag_source_unset(), gtk_drag_source_unset)
diff --git a/gtk/src/window.ccg b/gtk/src/window.ccg
index 18f68be..2dd3e91 100644
--- a/gtk/src/window.ccg
+++ b/gtk/src/window.ccg
@@ -20,6 +20,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gtkmm/accelgroup.h>
#include <gdkmm/cursor.h>
#include <gtk/gtk.h>
diff --git a/gtk/src/window.hg b/gtk/src/window.hg
index 28434ef..0bbbcb4 100644
--- a/gtk/src/window.hg
+++ b/gtk/src/window.hg
@@ -19,6 +19,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <glibmm/object.h>
#include <glibmm/listhandle.h>
#include <gtkmm/bin.h>
@@ -218,10 +220,13 @@ dnl
_WRAP_METHOD(void set_deletable(bool setting = true), gtk_window_set_deletable)
_WRAP_METHOD(bool get_deletable() const, gtk_window_get_deletable)
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> > get_icon_list(), gtk_window_get_icon_list)
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<const Gdk::Pixbuf> > get_icon_list() const, gtk_window_get_icon_list)
+#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<Gdk::Pixbuf> >',`Glib::ListHandler< Glib::RefPtr<Gdk::Pixbuf> >::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<Gdk::Pixbuf> > get_icon_list(), gtk_window_get_icon_list)
+#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<const Gdk::Pixbuf> >',`Glib::ListHandler< Glib::RefPtr<const Gdk::Pixbuf> >::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<const Gdk::Pixbuf> > get_icon_list() const, gtk_window_get_icon_list)
- _WRAP_METHOD(void set_icon_list(const Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> >& list),
+#m4 _CONVERSION(`const std::vector< Glib::RefPtr<Gdk::Pixbuf> >&',`GList*',`Glib::ListHandler< Glib::RefPtr<Gdk::Pixbuf> >::vector_to_list ($3).data ()')
+ _WRAP_METHOD(void set_icon_list(const std::vector< Glib::RefPtr<Gdk::Pixbuf> >& list),
gtk_window_set_icon_list)
_WRAP_METHOD(void set_icon(const Glib::RefPtr<Gdk::Pixbuf>& icon),
@@ -237,10 +242,10 @@ dnl
_WRAP_METHOD(Glib::ustring get_icon_name() const, gtk_window_get_icon_name)
_WRAP_METHOD(static void set_default_icon_list(
- const Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> >& list),
+ const std::vector< Glib::RefPtr<Gdk::Pixbuf> >& list),
gtk_window_set_default_icon_list)
- _WRAP_METHOD(static Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> > get_default_icon_list(), gtk_window_get_default_icon_list)
+ _WRAP_METHOD(static std::vector< Glib::RefPtr<Gdk::Pixbuf> > get_default_icon_list(), gtk_window_get_default_icon_list)
_WRAP_METHOD(static void set_default_icon(const Glib::RefPtr<Gdk::Pixbuf>& icon), gtk_window_set_default_icon)
_WRAP_METHOD(static void set_default_icon_name(const Glib::ustring& name), gtk_window_set_default_icon_name)
@@ -251,9 +256,8 @@ dnl
_WRAP_METHOD(bool get_modal() const, gtk_window_get_modal)
-
- _WRAP_METHOD(static Glib::ListHandle<Window*> list_toplevels(), gtk_window_list_toplevels)
-
+#m4 _CONVERSION(`GList*',`std::vector<Window*>',`Glib::ListHandler<Window*>::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(static std::vector<Window*> list_toplevels(), gtk_window_list_toplevels)
_WRAP_METHOD(void add_mnemonic(guint keyval, Widget& target),
gtk_window_add_mnemonic)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]