[gtkmm/vector] Adapt Gdk to use vector utils.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm/vector] Adapt Gdk to use vector utils.
- Date: Sat, 22 Jan 2011 22:12:19 +0000 (UTC)
commit 0f517e03e4ff5b20d9da09a363d8b6bca1006aa2
Author: Krzesimir Nowak <qdlacz gmail com>
Date: Sat Jan 22 23:11:45 2011 +0100
Adapt Gdk to use vector utils.
gdk/src/color.hg | 2 --
gdk/src/device.ccg | 4 ++--
gdk/src/device.hg | 10 ++++++----
gdk/src/devicemanager.ccg | 2 ++
gdk/src/devicemanager.hg | 8 ++++++--
gdk/src/display.ccg | 31 ++++++++++++-------------------
gdk/src/display.hg | 4 +++-
gdk/src/displaymanager.hg | 5 ++++-
gdk/src/dragcontext.ccg | 6 ++++--
gdk/src/dragcontext.hg | 5 +++--
gdk/src/pixbuf.ccg | 20 ++++++++++++--------
gdk/src/pixbuf.hg | 13 +++++++------
gdk/src/pixbufformat.hg | 6 ++++--
gdk/src/rgba.hg | 2 --
gdk/src/screen.hg | 12 ++++++------
gdk/src/timecoord.hg | 1 -
gdk/src/types.hg | 3 ---
gdk/src/window.ccg | 25 ++-----------------------
gdk/src/window.hg | 11 +++++++----
19 files changed, 80 insertions(+), 90 deletions(-)
---
diff --git a/gdk/src/color.hg b/gdk/src/color.hg
index 70ee4df..78029e4 100644
--- a/gdk/src/color.hg
+++ b/gdk/src/color.hg
@@ -169,6 +169,4 @@ struct ColorTraits
};
#endif //DOXYGEN_SHOULD_SKIP_THIS
-typedef Glib::ArrayHandle<Color,ColorTraits> ArrayHandle_Color;
-
} // namespace Gdk
diff --git a/gdk/src/device.ccg b/gdk/src/device.ccg
index 2149fee..c2a40d1 100644
--- a/gdk/src/device.ccg
+++ b/gdk/src/device.ccg
@@ -26,7 +26,7 @@
namespace Gdk
{
-ArrayHandle_TimeCoords Device::get_history(const Glib::RefPtr<Window>& window, guint32 start, guint32 stop) const
+std::vector<TimeCoord> Device::get_history(const Glib::RefPtr<Window>& window, guint32 start, guint32 stop) const
{
GdkTimeCoord** coords = 0;
int events_count = 0;
@@ -34,7 +34,7 @@ ArrayHandle_TimeCoords Device::get_history(const Glib::RefPtr<Window>& window, g
// we don't care about returned value - false means that either getting history is unsupported or no motion events happened.
// it is undistinguishable.
gdk_device_get_history(const_cast<GdkDevice*>(gobj()), Glib::unwrap(window), start, stop, &coords, &events_count);
- return ArrayHandle_TimeCoords(coords, events_count, Glib::OWNERSHIP_DEEP);
+ return Glib::ArrayHandler<TimeCoord, TimeCoordPtrTraits>::array_to_vector (coords, events_count, Glib::OWNERSHIP_DEEP);
}
void Device::get_position(int& x, int& y) const
diff --git a/gdk/src/device.hg b/gdk/src/device.hg
index ad789ed..efe0565 100644
--- a/gdk/src/device.hg
+++ b/gdk/src/device.hg
@@ -17,6 +17,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
//#include <gdkmm/window.h>
#include <gdkmm/cursor.h>
#include <gdkmm/event.h>
@@ -65,11 +67,11 @@ public:
_WRAP_METHOD(void get_state(const Glib::RefPtr<Window>& window, double& axes, ModifierType& mask), gdk_device_get_state)
// TODO: docs.
- ArrayHandle_TimeCoords get_history(const Glib::RefPtr<Window>& window, guint32 start, guint32 stop) const;
+ std::vector<TimeCoord> get_history(const Glib::RefPtr<Window>& window, guint32 start, guint32 stop) const;
_IGNORE(gdk_device_get_history)
-//#m4 _CONVERSION(`GList*',`Glib::ListHandle<Glib::RefPtr<Gdk::Device> >',`$2($3, Glib::OWNERSHIP_SHALLOW)')
- //_WRAP_METHOD(Glib::ListHandle<Glib::RefPtr<Gdk::Device> > list_slave_devices(), gdk_device_list_slave_devices)
- //_WRAP_METHOD(Glib::ListHandle<Glib::RefPtr<const Gdk::Device> > list_slave_devices() const, gdk_device_list_slave_devices, constversion)
+//#m4 _CONVERSION(`GList*',`std::vector<Glib::RefPtr<Gdk::Device> >',`Glib::ListHandler<Glib::RefPtr<Gdk::Device> >::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ //_WRAP_METHOD(std::vector<Glib::RefPtr<Gdk::Device> > list_slave_devices(), gdk_device_list_slave_devices)
+ //_WRAP_METHOD(std::vector<Glib::RefPtr<const Gdk::Device> > list_slave_devices() const, gdk_device_list_slave_devices, constversion)
_WRAP_METHOD(int get_n_axes() const, gdk_device_get_n_axes)
//TODO: A list of GdkAtom, which we should show as strings: _WRAP_METHOD(GList * gdk_device_list_axes () const, gdk_device_list_axes)
diff --git a/gdk/src/devicemanager.ccg b/gdk/src/devicemanager.ccg
index 3d58fb7..fc4efe2 100644
--- a/gdk/src/devicemanager.ccg
+++ b/gdk/src/devicemanager.ccg
@@ -16,3 +16,5 @@
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+
+#include <glibmm/vectorutils.h>
diff --git a/gdk/src/devicemanager.hg b/gdk/src/devicemanager.hg
index fbf8894..d728f70 100644
--- a/gdk/src/devicemanager.hg
+++ b/gdk/src/devicemanager.hg
@@ -17,6 +17,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <gdkmm/device.h>
#include <gdkmm/display.h>
#include <gdk/gdk.h>
@@ -43,8 +45,10 @@ public:
_WRAP_METHOD(Glib::RefPtr<Display> get_display(), gdk_device_manager_get_display, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Display> get_display() const, gdk_device_manager_get_display, refreturn, constversion)
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Device> > list_devices(DeviceType type), gdk_device_manager_list_devices)
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<const Device> > list_devices(DeviceType type) const, gdk_device_manager_list_devices)
+#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<Device> >',`Glib::ListHandler<Glib::RefPtr<Device> >::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<Device> > list_devices(DeviceType type), gdk_device_manager_list_devices)
+#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<const Device> >',`Glib::ListHandler<Glib::RefPtr<const Device> >::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<const Device> > list_devices(DeviceType type) const, gdk_device_manager_list_devices)
_WRAP_METHOD(Glib::RefPtr<Device> get_client_pointer(), gdk_device_manager_get_client_pointer, refreturn)
diff --git a/gdk/src/display.ccg b/gdk/src/display.ccg
index a831b6d..0dee5dd 100644
--- a/gdk/src/display.ccg
+++ b/gdk/src/display.ccg
@@ -20,6 +20,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <gdkmm/devicemanager.h>
#include <gdkmm/window.h>
#include <gdk/gdk.h>
@@ -47,25 +49,16 @@ void Display::store_clipboard(const Glib::RefPtr<Gdk::Window>& clipboard_window,
gdk_display_store_clipboard(gobj(), clipboard_window->gobj(), time_, 0 /* see the C docs */, 0);
}
-void Display::store_clipboard(const Glib::RefPtr<Gdk::Window>& clipboard_window, guint32 time_, const Glib::StringArrayHandle& targets)
- {
- //Put it into a real container that we can use:
- std::vector<Glib::ustring> targets_copy = targets;
-
- //Create array of target GdkAtoms from target strings:
- if(!targets_copy.empty())
- {
- GdkAtom* pAtoms = new GdkAtom[targets_copy.size()];
-
- for(guint i = 0; i < targets_copy.size(); ++i)
- {
- *pAtoms = Gdk::AtomString::to_c_type(targets_copy[i]);
- }
-
- gdk_display_store_clipboard(gobj(), clipboard_window->gobj(), time_, 0 /* see the C docs */, 0);
-
- delete[] pAtoms;
- }
+void Display::store_clipboard(const Glib::RefPtr<Gdk::Window>& clipboard_window, guint32 time_, const std::vector<std::string>& targets)
+{
+ if (!targets.size ())
+ {
+ gdk_display_store_clipboard (gobj(),
+ Glib::unwrap (clipboard_window),
+ time_,
+ Glib::ArrayHandler<std::string, AtomStringTraits>::vector_to_array (targets).data (),
+ targets.size ());
+ }
}
} //Gdk
diff --git a/gdk/src/display.hg b/gdk/src/display.hg
index 6d8cb7a..af3d5b0 100644
--- a/gdk/src/display.hg
+++ b/gdk/src/display.hg
@@ -19,6 +19,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <gdkmm/screen.h>
//#include <gdkmm/devicemanager.h>
#include <gdkmm/types.h> //For ModifierType
@@ -156,7 +158,7 @@ public:
*/
void store_clipboard(const Glib::RefPtr<Gdk::Window>& clipboard_window, guint32 time_);
- void store_clipboard(const Glib::RefPtr<Gdk::Window>& clipboard_window, guint32 time_, const Glib::StringArrayHandle& targets);
+ void store_clipboard(const Glib::RefPtr<Gdk::Window>& clipboard_window, guint32 time_, const std::vector<std::string>& targets);
_IGNORE(gdk_display_store_clipboard)
_WRAP_METHOD(bool supports_shapes() const, gdk_display_supports_shapes)
diff --git a/gdk/src/displaymanager.hg b/gdk/src/displaymanager.hg
index 603442d..db5f8e6 100644
--- a/gdk/src/displaymanager.hg
+++ b/gdk/src/displaymanager.hg
@@ -19,6 +19,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <glibmm/object.h>
#include <gdkmm/display.h>
@@ -45,7 +47,8 @@ public:
_WRAP_METHOD(void set_default_display(const Glib::RefPtr<Display>& display), gdk_display_manager_set_default_display)
- _WRAP_METHOD(Glib::SListHandle< Glib::RefPtr<Display> > list_displays(), gdk_display_manager_list_displays)
+#m4 _CONVERSION(`GSList*',`std::vector< Glib::RefPtr<Display> >',`Glib::SListHandler<Glib::RefPtr<Display> >::slist_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<Display> > list_displays(), gdk_display_manager_list_displays)
_WRAP_METHOD(Glib::RefPtr<Display> open_display(const Glib::ustring& name), gdk_display_manager_open_display, refreturn)
diff --git a/gdk/src/dragcontext.ccg b/gdk/src/dragcontext.ccg
index 0f07a1d..ee5cef9 100644
--- a/gdk/src/dragcontext.ccg
+++ b/gdk/src/dragcontext.ccg
@@ -20,6 +20,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gdkmm/window.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
@@ -42,10 +44,10 @@ void DragContext::drag_refuse(guint32 time)
gdk_drag_status(gobj(), ((GdkDragAction)(0)) /* see GDK docs */, time);
}
-Gdk::ListHandle_AtomString DragContext::list_targets() const
+std::vector<Glib::ustring> DragContext::list_targets() const
{
//Note that we don't free the GList* (or it's items), because we are accessing the struct directly:
- return ListHandle_AtomString( gdk_drag_context_list_targets(const_cast<GdkDragContext*>(gobj())), Glib::OWNERSHIP_NONE);
+ return Glib::ListHandler<Glib::ustring, AtomStringTraits>::list_to_vector ( gdk_drag_context_list_targets(const_cast<GdkDragContext*>(gobj())), Glib::OWNERSHIP_NONE);
}
} /* namespace Gdk */
diff --git a/gdk/src/dragcontext.hg b/gdk/src/dragcontext.hg
index 7bb38eb..3d1c549 100644
--- a/gdk/src/dragcontext.hg
+++ b/gdk/src/dragcontext.hg
@@ -19,11 +19,12 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <vector>
+
#include <gdkmm/color.h>
#include <gdkmm/pixbuf.h>
#include <gdkmm/device.h>
#include <glibmm/object.h>
-#include <glibmm/listhandle.h>
#include <cairomm/surface.h>
#include <gdk/gdk.h>
_DEFS(gdkmm,gdk)
@@ -106,7 +107,7 @@ public:
/** Get a list of targets offered by the source.
* @result a list of targets offered by the source.
*/
- Gdk::ListHandle_AtomString list_targets() const;
+ std::vector<Glib::ustring> list_targets() const;
_IGNORE(gdk_drag_context_list_targets)
_WRAP_METHOD(DragAction get_actions() const, gdk_drag_context_get_actions)
diff --git a/gdk/src/pixbuf.ccg b/gdk/src/pixbuf.ccg
index 4086710..1592db6 100644
--- a/gdk/src/pixbuf.ccg
+++ b/gdk/src/pixbuf.ccg
@@ -18,6 +18,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/vectorutils.h>
+
#include <gdkmm/window.h>
#include <gdk/gdk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
@@ -119,14 +121,15 @@ void Pixbuf::save(const std::string& filename, const Glib::ustring& type)
void Pixbuf::save(const std::string& filename, const Glib::ustring& type,
- const Glib::StringArrayHandle& option_keys,
- const Glib::StringArrayHandle& option_values)
+ const std::vector<Glib::ustring>& option_keys,
+ const std::vector<Glib::ustring>& option_values)
{
GError* gerror = 0;
gdk_pixbuf_savev(
gobj(), filename.c_str(), type.c_str(),
- const_cast<char**>(option_keys.data()), const_cast<char**>(option_values.data()),
+ const_cast<char**>(Glib::ArrayHandler<Glib::ustring>::vector_to_array (option_keys).data ()),
+ const_cast<char**>(Glib::ArrayHandler<Glib::ustring>::vector_to_array (option_values).data ()),
&gerror);
if(gerror)
@@ -150,24 +153,25 @@ void Pixbuf::save_to_buffer(gchar*& buffer, gsize& buffer_size,
void Pixbuf::save_to_buffer(gchar*& buffer, gsize& buffer_size,
const Glib::ustring& type,
- const Glib::StringArrayHandle& option_keys,
- const Glib::StringArrayHandle& option_values)
+ const std::vector<Glib::ustring>& option_keys,
+ const std::vector<Glib::ustring>& option_values)
{
GError* gerror = 0;
gdk_pixbuf_save_to_bufferv(
gobj(), &buffer, &buffer_size,
type.c_str(),
- const_cast<char**>(option_keys.data()), const_cast<char**>(option_values.data()),
+ const_cast<char**>(Glib::ArrayHandler<Glib::ustring>::vector_to_array (option_keys).data ()),
+ const_cast<char**>(Glib::ArrayHandler<Glib::ustring>::vector_to_array (option_values).data ()),
&gerror);
if(gerror)
::Glib::Error::throw_exception(gerror);
}
-Pixbuf::SListHandle_PixbufFormat Pixbuf::get_formats()
+std::vector<PixbufFormat> Pixbuf::get_formats()
{
- return SListHandle_PixbufFormat(gdk_pixbuf_get_formats(), Glib::OWNERSHIP_SHALLOW);
+ return Glib::SListHandler<PixbufFormat, PixbufFormatTraits>::slist_to_vector (gdk_pixbuf_get_formats(), Glib::OWNERSHIP_SHALLOW);
}
} // namespace Gdk
diff --git a/gdk/src/pixbuf.hg b/gdk/src/pixbuf.hg
index 8b5fff8..b152fa4 100644
--- a/gdk/src/pixbuf.hg
+++ b/gdk/src/pixbuf.hg
@@ -19,6 +19,8 @@
// the #ifndef GDKMM_DISABLE_DEPRECATED in deprecated classes) is generated:
_CONFIGINCLUDE(gdkmmconfig.h)
+#include <vector>
+
//#include <gdkmm/window.h>
#include <gdkmm/pixbufformat.h>
#include <gdkmm/types.h>
@@ -301,8 +303,8 @@ public:
* @throw Gdk::PixbufError
*/
void save(const std::string& filename, const Glib::ustring& type,
- const Glib::StringArrayHandle& option_keys,
- const Glib::StringArrayHandle& option_values);
+ const std::vector<Glib::ustring>& option_keys,
+ const std::vector<Glib::ustring>& option_values);
_IGNORE(gdk_pixbuf_savev)
@@ -357,8 +359,8 @@ gboolean gdk_pixbuf_save_to_callbackv (GdkPixbuf *pixbuf,
*/
void save_to_buffer(gchar*& buffer, gsize& buffer_size,
const Glib::ustring& type,
- const Glib::StringArrayHandle& option_keys,
- const Glib::StringArrayHandle& option_values);
+ const std::vector<Glib::ustring>& option_keys,
+ const std::vector<Glib::ustring>& option_values);
_IGNORE(gdk_pixbuf_save_to_bufferv, gdk_pixbuf_save_to_buffer)
@@ -434,8 +436,7 @@ gboolean gdk_pixbuf_save_to_callbackv (GdkPixbuf *pixbuf,
_WRAP_METHOD(Glib::RefPtr<Pixbuf> apply_embedded_orientation(), gdk_pixbuf_apply_embedded_orientation)
//TODO: Documentation
- typedef Glib::SListHandle< Glib::RefPtr<PixbufFormat>, PixbufFormatTraits > SListHandle_PixbufFormat;
- static SListHandle_PixbufFormat get_formats();
+ static std::vector<PixbufFormat> get_formats();
_IGNORE(gdk_pixbuf_get_formats)
};
diff --git a/gdk/src/pixbufformat.hg b/gdk/src/pixbufformat.hg
index fd0c524..8b4bbce 100644
--- a/gdk/src/pixbufformat.hg
+++ b/gdk/src/pixbufformat.hg
@@ -35,8 +35,10 @@ public:
_WRAP_METHOD(Glib::ustring get_name() const, gdk_pixbuf_format_get_name)
_WRAP_METHOD(Glib::ustring get_description() const, gdk_pixbuf_format_get_description)
- _WRAP_METHOD(Glib::StringArrayHandle get_mime_types() const, gdk_pixbuf_format_get_mime_types)
- _WRAP_METHOD(Glib::StringArrayHandle get_extensions() const, gdk_pixbuf_format_get_extensions)
+
+#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_mime_types() const, gdk_pixbuf_format_get_mime_types)
+ _WRAP_METHOD(std::vector<Glib::ustring> get_extensions() const, gdk_pixbuf_format_get_extensions)
_WRAP_METHOD(bool is_writable() const, gdk_pixbuf_format_is_writable)
_WRAP_METHOD(bool is_scalable() const, gdk_pixbuf_format_is_scalable)
diff --git a/gdk/src/rgba.hg b/gdk/src/rgba.hg
index 32a4b33..f0e9f22 100644
--- a/gdk/src/rgba.hg
+++ b/gdk/src/rgba.hg
@@ -179,6 +179,4 @@ struct RGBATraits
};
#endif //DOXYGEN_SHOULD_SKIP_THIS
-typedef Glib::ArrayHandle<RGBA,RGBATraits> ArrayHandle_RGBA;
-
} // namespace Gdk
diff --git a/gdk/src/screen.hg b/gdk/src/screen.hg
index 7a6a6e5..373f446 100644
--- a/gdk/src/screen.hg
+++ b/gdk/src/screen.hg
@@ -67,11 +67,11 @@ public:
_WRAP_METHOD(int get_width_mm() const, gdk_screen_get_width_mm)
_WRAP_METHOD(int get_height_mm() const, gdk_screen_get_height_mm)
-#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<Visual> >',`$2($3, Glib::OWNERSHIP_SHALLOW)')
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Visual> > list_visuals(), gdk_screen_list_visuals)
+#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<Visual> >',`Glib::ListHandler< Glib::RefPtr<Visual> >::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<Visual> > list_visuals(), gdk_screen_list_visuals)
-#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<Window> >',`$2($3, Glib::OWNERSHIP_SHALLOW)')
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Window> > get_toplevel_windows(), gdk_screen_get_toplevel_windows)
+#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<Window> >',`Glib::ListHandler< Glib::RefPtr<Window> >::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<Window> > get_toplevel_windows(), gdk_screen_get_toplevel_windows)
_WRAP_METHOD(Glib::ustring make_display_name(), gdk_screen_make_display_name)
@@ -105,8 +105,8 @@ public:
_WRAP_METHOD(Glib::RefPtr<Gdk::Window> get_active_window(), gdk_screen_get_active_window, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Gdk::Window> get_active_window() const, gdk_screen_get_active_window, refreturn, constversion)
-#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<Window> >',`$2($3, Glib::OWNERSHIP_DEEP)')
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Window> > get_window_stack(), gdk_screen_get_window_stack)
+#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<Window> >',`Glib::ListHandler< Glib::RefPtr<Window> >::list_to_vector ($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<Window> > get_window_stack(), gdk_screen_get_window_stack)
//We use no_default_handler because GdkDisplayManagerClass is private.
diff --git a/gdk/src/timecoord.hg b/gdk/src/timecoord.hg
index 7f79824..975fc26 100644
--- a/gdk/src/timecoord.hg
+++ b/gdk/src/timecoord.hg
@@ -62,6 +62,5 @@ struct TimeCoordPtrTraits
static void release_c_type(const CType& obj) { g_free(const_cast<CType>(obj)); }
};
#endif
-typedef Glib::ArrayHandle<TimeCoord, TimeCoordPtrTraits> ArrayHandle_TimeCoords;
} // namespace Gdk
diff --git a/gdk/src/types.hg b/gdk/src/types.hg
index 2715530..7e9c86b 100644
--- a/gdk/src/types.hg
+++ b/gdk/src/types.hg
@@ -121,9 +121,6 @@ struct AtomStringTraits
typedef AtomStringTraits AtomString;
#endif //DOXYGEN_SHOULD_SKIP_THIS
-typedef Glib::ArrayHandle<std::string,AtomStringTraits> ArrayHandle_AtomString;
-typedef Glib::ListHandle<std::string,AtomStringTraits> ListHandle_AtomString;
-
} // namespace Gdk
diff --git a/gdk/src/window.ccg b/gdk/src/window.ccg
index cbc0458..bcf0dc8 100644
--- a/gdk/src/window.ccg
+++ b/gdk/src/window.ccg
@@ -59,30 +59,9 @@ void Window::restack(bool above)
gdk_window_restack(gobj(), NULL, above);
}
-Glib::RefPtr<DragContext> Window::drag_begin(const Glib::StringArrayHandle& targets)
+Glib::RefPtr<DragContext> Window::drag_begin (const std::vector<std::string>& targets)
{
- Glib::RefPtr<DragContext> result;
-
- //Put it into a real container that we can use:
- std::vector<Glib::ustring> targets_copy = targets;
-
- //Create GList from target strings:
- if(!targets_copy.empty())
- {
- GList* list = 0;
-
- for(guint i = 0; i < targets_copy.size(); ++i)
- {
- GdkAtom atom = Gdk::AtomString::to_c_type(targets_copy[i]);
- list = g_list_append (list, GUINT_TO_POINTER (atom));
- }
-
- result = Glib::wrap(gdk_drag_begin(gobj(), list), true);
-
- g_list_free(list);
- }
-
- return result;
+ return Glib::wrap (gdk_drag_begin (gobj (), Glib::ListHandler<std::string, AtomStringTraits>::vector_to_list (targets).data ()), true);
}
diff --git a/gdk/src/window.hg b/gdk/src/window.hg
index 630cb2b..eeae63c 100644
--- a/gdk/src/window.hg
+++ b/gdk/src/window.hg
@@ -205,8 +205,10 @@ public:
_WRAP_METHOD(Glib::RefPtr<Window> get_effective_toplevel(), gdk_window_get_effective_toplevel, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Window> get_effective_toplevel() const, gdk_window_get_effective_toplevel, refreturn, constversion)
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Window> > get_children(), gdk_window_get_children)
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<const Window> > get_children() const, gdk_window_get_children)
+#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<Window> >',`Glib::ListHandler<Glib::RefPtr<Window> >::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<Window> > get_children(), gdk_window_get_children)
+#m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr<const Window> >',`Glib::ListHandler<Glib::RefPtr<const Window> >::list_to_vector ($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector< Glib::RefPtr<const Window> > get_children() const, gdk_window_get_children)
_IGNORE(gdk_window_peek_children) //gdk_window_peek_children() is the same as gdk_window_get_children() with different memory mangement of the list.
_WRAP_METHOD(EventMask get_events() const, gdk_window_get_events)
@@ -218,7 +220,8 @@ public:
_WRAP_METHOD(EventMask get_source_events(InputSource source) const, gdk_window_get_source_events)
_WRAP_METHOD(void set_source_events(InputSource source, EventMask event_mask), gdk_window_set_source_events)
- _WRAP_METHOD(void set_icon_list(const Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> >& pixbufs), gdk_window_set_icon_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> >& pixbufs), gdk_window_set_icon_list)
void unset_icon();
_WRAP_METHOD(void set_icon_name(const Glib::ustring& name), gdk_window_set_icon_name)
@@ -257,7 +260,7 @@ public:
*
* @newin{2,24}
*/
- Glib::RefPtr<DragContext> drag_begin(const Glib::StringArrayHandle& targets);
+ Glib::RefPtr<DragContext> drag_begin(const std::vector<std::string>& targets);
_IGNORE(gdk_drag_begin)
_WRAP_METHOD(void invalidate_rect(const Rectangle& rect, bool invalidate_children), gdk_window_invalidate_rect)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]