[gtkmm] Gdk, Gtk: Update for the latest gtk4 (Gdk::Event updated, etc)
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Gdk, Gtk: Update for the latest gtk4 (Gdk::Event updated, etc)
- Date: Mon, 24 Feb 2020 14:51:07 +0000 (UTC)
commit b8fc5412a139db49e904efafa18330c3c1a53579
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Mon Feb 24 15:45:06 2020 +0100
Gdk, Gtk: Update for the latest gtk4 (Gdk::Event updated, etc)
* gdk/src/event.[ccg|hg]: GdkEvent is now a boxed type. Many new methods.
* gdk/src/events.[ccg|hg]: Removed. Gdk::Event does not have subclasses.
* gdk/src/popuplayout.[ccg|hg]: New files.
* gdk/src/types.[ccg|hg]: Remove AtomStringTraits and AtomUstringTraits.
GdkAtom has been removed.
* gtk/src/dropcontrollermotion.[ccg|hg]:
* gtk/src/eventcontrollerfocus.[ccg|hg]: New files.
* gtk/src/selectiondata.[ccg|hg]:
* gtk/gtkmm/selectiondata_private.[cc|h]:
* tools/m4/class_gdkevent.m4: Removed.
Many other changes.
.gitignore | 8 +-
demos/gtk-demo/example_iconbrowser.cc | 38 +-
gdk/gdkmm.h | 3 +-
gdk/gdkmm/general.cc | 10 -
gdk/gdkmm/general.h | 23 --
gdk/src/contentprovider.ccg | 76 +---
gdk/src/contentprovider.hg | 54 +--
gdk/src/device.ccg | 6 -
gdk/src/device.hg | 10 +-
gdk/src/enums.hg | 1 +
gdk/src/event.ccg | 17 +-
gdk/src/event.hg | 134 ++++---
gdk/src/events.ccg | 447 ----------------------
gdk/src/events.hg | 693 ----------------------------------
gdk/src/filelist.am | 2 +-
gdk/src/popuplayout.ccg | 16 +
gdk/src/popuplayout.hg | 58 +++
gdk/src/surface.ccg | 1 -
gdk/src/surface.hg | 25 +-
gdk/src/types.ccg | 31 --
gdk/src/types.hg | 37 --
gtk/gtkmm.h | 2 +
gtk/gtkmm/filelist.am | 2 -
gtk/gtkmm/selectiondata_private.cc | 37 --
gtk/gtkmm/selectiondata_private.h | 49 ---
gtk/src/combobox.ccg | 1 +
gtk/src/combobox.hg | 5 +
gtk/src/dropcontrollermotion.ccg | 18 +
gtk/src/dropcontrollermotion.hg | 66 ++++
gtk/src/droptarget.hg | 8 -
gtk/src/enums.hg | 1 -
gtk/src/eventcontrollerfocus.ccg | 18 +
gtk/src/eventcontrollerfocus.hg | 58 +++
gtk/src/eventcontrollerkey.hg | 17 +-
gtk/src/eventcontrollermotion.hg | 9 +-
gtk/src/filechooser.ccg | 2 -
gtk/src/filechooser.hg | 85 +----
gtk/src/filefilter.hg | 2 +
gtk/src/filelist.am | 3 +-
gtk/src/gesture.ccg | 1 +
gtk/src/gesture.hg | 11 +-
gtk/src/icontheme.ccg | 28 --
gtk/src/icontheme.hg | 32 +-
gtk/src/infobar.hg | 7 -
gtk/src/selectiondata.ccg | 89 -----
gtk/src/selectiondata.hg | 148 --------
gtk/src/textview.hg | 2 +-
gtk/src/treedragdest.ccg | 1 -
gtk/src/treedragdest.hg | 16 +-
gtk/src/treedragsource.ccg | 63 ----
gtk/src/treedragsource.hg | 25 +-
gtk/src/treepath.ccg | 16 +-
gtk/src/treepath.hg | 33 +-
gtk/src/widget.hg | 12 +-
gtk/src/window.ccg | 4 +-
gtk/src/window.hg | 6 +-
tools/m4/class_gdkevent.m4 | 114 ------
tools/m4/convert_gdk.m4 | 6 +
tools/m4/convert_gtk.m4 | 2 -
tools/m4/convert_gtkmm.m4 | 1 -
tools/m4/filelist.am | 3 +-
61 files changed, 494 insertions(+), 2199 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 7c4359d5..da574027 100644
--- a/.gitignore
+++ b/.gitignore
@@ -82,8 +82,6 @@ gdk/gdkmm/enums.cc
gdk/gdkmm/enums.h
gdk/gdkmm/event.cc
gdk/gdkmm/event.h
-gdk/gdkmm/events.cc
-gdk/gdkmm/events.h
gdk/gdkmm/frameclock.cc
gdk/gdkmm/frameclock.h
gdk/gdkmm/frametimings.cc
@@ -106,6 +104,8 @@ gdk/gdkmm/pixbufformat.cc
gdk/gdkmm/pixbufformat.h
gdk/gdkmm/pixbufloader.cc
gdk/gdkmm/pixbufloader.h
+gdk/gdkmm/popuplayout.cc
+gdk/gdkmm/popuplayout.h
gdk/gdkmm/rectangle.cc
gdk/gdkmm/rectangle.h
gdk/gdkmm/rgba.cc
@@ -244,6 +244,8 @@ gtk/gtkmm/dragsource.cc
gtk/gtkmm/dragsource.h
gtk/gtkmm/drawingarea.cc
gtk/gtkmm/drawingarea.h
+gtk/gtkmm/dropcontrollermotion.cc
+gtk/gtkmm/dropcontrollermotion.h
gtk/gtkmm/droptarget.cc
gtk/gtkmm/droptarget.h
gtk/gtkmm/editable.cc
@@ -260,6 +262,8 @@ gtk/gtkmm/enums.cc
gtk/gtkmm/enums.h
gtk/gtkmm/eventcontroller.cc
gtk/gtkmm/eventcontroller.h
+gtk/gtkmm/eventcontrollerfocus.cc
+gtk/gtkmm/eventcontrollerfocus.h
gtk/gtkmm/eventcontrollerkey.cc
gtk/gtkmm/eventcontrollerkey.h
gtk/gtkmm/eventcontrollermotion.cc
diff --git a/demos/gtk-demo/example_iconbrowser.cc b/demos/gtk-demo/example_iconbrowser.cc
index 42bc6975..4cdd8601 100644
--- a/demos/gtk-demo/example_iconbrowser.cc
+++ b/demos/gtk-demo/example_iconbrowser.cc
@@ -73,8 +73,8 @@ protected:
IconInfoStore();
// Overridden virtual function:
- bool drag_data_get_vfunc(const Gtk::TreeModel::Path& path,
- Gtk::SelectionData& selection_data) const override;
+ Glib::RefPtr<Gdk::ContentProvider> drag_data_get_vfunc(
+ const Gtk::TreeModel::Path& path) const override;
private:
Gtk::TreeModelColumn<Glib::ustring> m_text_column;
@@ -93,8 +93,7 @@ public:
protected:
// Signal handler:
void on_image_drag_begin(const Glib::RefPtr<Gdk::Drag>& drag, int size_index);
-
- void on_image_get_texture(Glib::ValueBase& value, int size_index);
+ Glib::RefPtr<Gdk::ContentProvider> on_image_prepare_texture(double x, double y, int size_index);
Glib::RefPtr<const Gdk::Paintable> get_paintable(int size_index);
@@ -912,10 +911,8 @@ DetailDialog::DetailDialog(Gtk::Window& parent)
// Enable dragging an image, and copying it to another program.
m_image_drag_source[i] = Gtk::DragSource::create();
- auto content = Gdk::ContentProvider::create(
- Glib::Value<Glib::RefPtr<Gdk::Texture>>::value_type(),
- sigc::bind(sigc::mem_fun(*this, &DetailDialog::on_image_get_texture), i));
- m_image_drag_source[i]->set_content(content);
+ m_image_drag_source[i]->signal_prepare().connect(
+ sigc::bind(sigc::mem_fun(*this, &DetailDialog::on_image_prepare_texture), i), false);
m_image_drag_source[i]->signal_drag_begin().connect(
sigc::bind(sigc::mem_fun(*this, &DetailDialog::on_image_drag_begin), i));
m_image[i].add_controller(m_image_drag_source[i]);
@@ -969,7 +966,8 @@ void DetailDialog::on_image_drag_begin(const Glib::RefPtr<Gdk::Drag>& /* drag */
}
}
-void DetailDialog::on_image_get_texture(Glib::ValueBase& value, int size_index)
+Glib::RefPtr<Gdk::ContentProvider> DetailDialog::on_image_prepare_texture(
+ double, double, int size_index)
{
auto image_paintable = get_paintable(size_index);
if (image_paintable)
@@ -978,15 +976,17 @@ void DetailDialog::on_image_get_texture(Glib::ValueBase& value, int size_index)
if (image_texture)
{
Glib::Value<Glib::RefPtr<const Gdk::Texture>> texture_value;
- texture_value.init(value.gobj());
+ texture_value.init(texture_value.value_type());
texture_value.set(image_texture);
- value = texture_value;
+ return Gdk::ContentProvider::create(texture_value);
}
else
- std::cout << "DetailDialog::on_image_get_texture(): Could not get a Gdk::Texture" << std::endl;
+ std::cout << "DetailDialog::on_image_prepare_texture(): Could not get a Gdk::Texture" << std::endl;
}
else
- std::cout << "DetailDialog::on_image_get_texture(): Could not get a Gdk::Paintable" << std::endl;
+ std::cout << "DetailDialog::on_image_prepare_texture(): Could not get a Gdk::Paintable" << std::endl;
+
+ return {};
}
Glib::RefPtr<const Gdk::Paintable> DetailDialog::get_paintable(int size_index)
@@ -1016,15 +1016,17 @@ Glib::RefPtr<IconInfoStore> IconInfoStore::create()
return Glib::RefPtr<IconInfoStore>(new IconInfoStore());
}
-bool IconInfoStore::drag_data_get_vfunc(const Gtk::TreeModel::Path& path,
- Gtk::SelectionData& selection_data) const
+Glib::RefPtr<Gdk::ContentProvider> IconInfoStore::drag_data_get_vfunc(
+ const Gtk::TreeModel::Path& path) const
{
const auto iter = get_iter(path);
if (!iter)
- return false;
+ return {};
const auto row = *iter;
const auto name = row[m_text_column];
- selection_data.set_text(name);
- return true;
+ Glib::Value<Glib::ustring> name_value;
+ name_value.init(name_value.value_type());
+ name_value.set(name);
+ return Gdk::ContentProvider::create(name_value);
}
diff --git a/gdk/gdkmm.h b/gdk/gdkmm.h
index c08b2e1f..bc74e68f 100644
--- a/gdk/gdkmm.h
+++ b/gdk/gdkmm.h
@@ -32,7 +32,7 @@
#include <gdkmm/display.h>
#include <gdkmm/displaymanager.h>
#include <gdkmm/drop.h>
-#include <gdkmm/events.h>
+#include <gdkmm/event.h>
#include <gdkmm/frameclock.h>
#include <gdkmm/general.h>
#include <gdkmm/glcontext.h>
@@ -43,6 +43,7 @@
#include <gdkmm/pixbufanimation.h>
#include <gdkmm/pixbufformat.h>
#include <gdkmm/pixbufloader.h>
+#include <gdkmm/popuplayout.h>
#include <gdkmm/rectangle.h>
#include <gdkmm/seat.h>
#include <gdkmm/snapshot.h>
diff --git a/gdk/gdkmm/general.cc b/gdk/gdkmm/general.cc
index 8fee0204..5f5f086d 100644
--- a/gdk/gdkmm/general.cc
+++ b/gdk/gdkmm/general.cc
@@ -47,16 +47,6 @@ void add_region_to_path(const ::Cairo::RefPtr< ::Cairo::Context >& context, cons
gdk_cairo_region(context->cobj(), (region ? region->cobj() : nullptr));
}
-bool get_clip_rectangle(const ::Cairo::RefPtr< ::Cairo::Context >& context, Gdk::Rectangle& rectangle)
-{
- return gdk_cairo_get_clip_rectangle(context->cobj(), rectangle.gobj());
-}
-
-bool get_clip_rectangle(const ::Cairo::RefPtr< ::Cairo::Context >& context)
-{
- return gdk_cairo_get_clip_rectangle(context->cobj(), nullptr);
-}
-
::Cairo::RefPtr< ::Cairo::Region> create_region_from_surface(const ::Cairo::RefPtr< ::Cairo::Surface>&
surface)
{
return Gdk::Cairo::wrap(gdk_cairo_region_create_from_surface(surface->cobj()), true);
diff --git a/gdk/gdkmm/general.h b/gdk/gdkmm/general.h
index 1377e60a..f18f35b9 100644
--- a/gdk/gdkmm/general.h
+++ b/gdk/gdkmm/general.h
@@ -72,29 +72,6 @@ void add_rectangle_to_path(const ::Cairo::RefPtr< ::Cairo::Context >& context, c
*/
void add_region_to_path(const ::Cairo::RefPtr< ::Cairo::Context >& context, const ::Cairo::RefPtr<
::Cairo::Region>& region);
-/** This is a convenience function around Cairo::Context::get_clip_extents().
- * It rounds the clip extents to integer coordinates and returns
- * a boolean indicating if a clip area exists.
- *
- * @param context A cairo context.
- * @param[out] rectangle Return location for the clip rectangle.
- * @returns <tt>true</tt> if a clip rectangle exists, <tt>false</tt> if all
- * of @a context is clipped and all drawing can be skipped.
- *
- * @newin{3,24}
- */
-bool get_clip_rectangle(const ::Cairo::RefPtr< ::Cairo::Context >& context, Gdk::Rectangle& rectangle);
-
-/** This is a convenience function around Cairo::Context::get_clip_extents().
- *
- * @param context A cairo context.
- * @returns <tt>true</tt> if a clip rectangle exists, <tt>false</tt> if all
- * of @a context is clipped and all drawing can be skipped.
- *
- * @newin{3,24}
- */
-bool get_clip_rectangle(const ::Cairo::RefPtr< ::Cairo::Context >& context);
-
/** Creates a region that covers the area where the given
* @a surface is more than 50% opaque.
*
diff --git a/gdk/src/contentprovider.ccg b/gdk/src/contentprovider.ccg
index f00d24f8..650c2b09 100644
--- a/gdk/src/contentprovider.ccg
+++ b/gdk/src/contentprovider.ccg
@@ -17,75 +17,21 @@
#include <giomm/slot_async.h>
#include <giomm/outputstream.h>
-namespace
-{
-
-void ContentProvider_get_value_callback(GValue* value, void* data)
-{
- auto the_slot = static_cast<Gdk::ContentProvider::SlotGetValue*>(data);
- Glib::ValueBase cpp_value;
- cpp_value.init(G_VALUE_TYPE(value));
-
- try
- {
- (*the_slot)(cpp_value);
- g_value_copy(cpp_value.gobj(), value);
- }
- catch (...)
- {
- Glib::exception_handlers_invoke();
- }
-}
-
-GBytes* ContentProvider_get_bytes_callback(const char* mime_type, void* data)
-{
- auto the_slot = static_cast<Gdk::ContentProvider::SlotGetBytes*>(data);
-
- try
- {
- auto bytes = (*the_slot)(mime_type);
- return Glib::unwrap_copy(bytes);
- }
- catch (...)
- {
- Glib::exception_handlers_invoke();
- }
- return nullptr;
-}
-
-} // anonymous namespace
-
namespace Gdk
{
-Glib::RefPtr<ContentProvider> ContentProvider::create(GType type, const SlotGetValue& slot)
-{
- // Create a copy of the slot object. A pointer to this will be passed
- // through the callback's data parameter. It will also be stored
- // in m_slot_get_value. It will be deleted when *this is deleted.
- auto slot_copy = new SlotGetValue(slot);
-
- auto content_provider = Glib::wrap(gdk_content_provider_new_with_callback(
- type, &ContentProvider_get_value_callback, slot_copy));
-
- content_provider->m_slot_get_value.reset(slot_copy);
- return content_provider;
-}
-
Glib::RefPtr<ContentProvider> ContentProvider::create(
- const Glib::RefPtr<const ContentFormats>& formats, const SlotGetBytes& slot)
+ const std::vector<Glib::RefPtr<ContentProvider>>& providers)
{
- // Create a copy of the slot object. A pointer to this will be passed
- // through the callback's data parameter. It will also be stored
- // in m_slot_get_bytes. It will be deleted when *this is deleted.
- auto slot_copy = new SlotGetBytes(slot);
-
- auto content_provider = Glib::wrap(gdk_content_provider_new_with_formats(
- const_cast<GdkContentFormats*>(Glib::unwrap(formats)),
- &ContentProvider_get_bytes_callback, slot_copy));
-
- content_provider->m_slot_get_bytes.reset(slot_copy);
- return content_provider;
+ // gdk_content_provider_new_union() does not take a reference on the
+ // supplied elements, but it unrefs them when the created
+ // content provider union is deleted. [transfer elements]
+ for (auto provider : providers)
+ provider->reference();
+
+ return Glib::wrap(gdk_content_provider_new_union(
+ Glib::ArrayHandler<Glib::RefPtr<ContentProvider>>::vector_to_array(providers).data(),
+ providers.size()));
}
-} //namespace Gdk
+} // namespace Gdk
diff --git a/gdk/src/contentprovider.hg b/gdk/src/contentprovider.hg
index ab02a8f0..fbe5809b 100644
--- a/gdk/src/contentprovider.hg
+++ b/gdk/src/contentprovider.hg
@@ -58,54 +58,14 @@ protected:
_CTOR_DEFAULT()
public:
- /** Callback type for providing data in a Glib::ValueBase.
- * For instance:
- * @code
- * void on_get_value(Glib::ValueBase& value);
- * @endcode
- *
- * @param[in,out] value Where to store the provided value. @a value has been
- * initialized to the GType the value should be provided in.
- * This given GType does not need to be listed in the formats returned by
- * ref_formats(). However, if the given GType is not supported,
- * the operation can fail.
- */
- using SlotGetValue = sigc::slot<void(Glib::ValueBase&)>;
-
- /** Callback type for providing data in a Glib::Bytes.
- * For instance:
- * @code
- * Glib::RefPtr<Glib::Bytes> on_get_bytes(const Glib::ustring& mime_type);
- * @endcode
- *
- * @param mime_type The mime type.
- * @return A Glib::Bytes with the data for @a mime_type.
- */
- using SlotGetBytes = sigc::slot<Glib::RefPtr<Glib::Bytes>(const Glib::ustring&)>;
-
// _WRAP_METHOD is used for the create() methods because the gdk_content_provider_new_*()
// functions do more than call g_object_new().
- _WRAP_METHOD(static Glib::RefPtr<ContentProvider> create(const Glib::ustring& mime_type,
- const Glib::RefPtr<const Glib::Bytes>& bytes), gdk_content_provider_new_for_bytes)
_WRAP_METHOD(static Glib::RefPtr<ContentProvider> create(const Glib::ValueBase& value),
gdk_content_provider_new_for_value)
-
- /** Create a content provider that provides data that is provided via a callback.
- *
- * @param type The type that the callback provides.
- * @param slot Callback to populate a Glib::Value.
- * @return A new Gdk::ContentProvider.
- */
- static Glib::RefPtr<ContentProvider> create(GType type, const SlotGetValue& slot);
-
- /** Create a content provider that provides data that is provided via a callback.
- *
- * @param formats Formats to advertise.
- * @param slot Callback to return a Glib::Bytes.
- * @return A new Gdk::ContentProvider.
- */
- static Glib::RefPtr<ContentProvider> create(const Glib::RefPtr<const ContentFormats>& formats, const
SlotGetBytes& slot);
- _IGNORE(gdk_content_provider_new_with_callback, gdk_content_provider_new_with_formats)
+ _WRAP_METHOD_DOCS_ONLY(gdk_content_provider_new_union)
+ static Glib::RefPtr<ContentProvider> create(const std::vector<Glib::RefPtr<ContentProvider>>& providers);
+ _WRAP_METHOD(static Glib::RefPtr<ContentProvider> create(const Glib::ustring& mime_type,
+ const Glib::RefPtr<const Glib::Bytes>& bytes), gdk_content_provider_new_for_bytes)
// ref_formats() and ref_storable_formats() are const because they return
// newly created ContentFormats instances.
@@ -132,12 +92,6 @@ public:
// there is no constructor that calls g_object_new() to create a gtkmm__GdkContentProvider
// instance. A GdkContentProvider instance never calls an overriding vfunc in
// Gdk::ContentProvider.
-
-private:
- // Pointers to copies of the slots. The slots shall be deleted
- // when the ContentProvider is deleted.
- std::unique_ptr<SlotGetValue> m_slot_get_value;
- std::unique_ptr<SlotGetBytes> m_slot_get_bytes;
};
} // namespace Gdk
diff --git a/gdk/src/device.ccg b/gdk/src/device.ccg
index 66d8f065..c14b7b23 100644
--- a/gdk/src/device.ccg
+++ b/gdk/src/device.ccg
@@ -52,12 +52,6 @@ Glib::RefPtr<const Surface> Device::get_surface_at_position() const
return const_cast<Device*>(this)->get_surface_at_position();
}
-std::vector<std::string> Device::list_axes() const
-{
- auto glist = gdk_device_list_axes(const_cast<GdkDevice*>(gobj()));
- return Glib::ListHandler<std::string, AtomStringTraits>::list_to_vector(glist, Glib::OWNERSHIP_SHALLOW);
-}
-
// Custom wrap_new() because we want to create a DeviceWithPad, if the underlying
// C class implements the GdkDevicePad interface.
Glib::ObjectBase* Device_Class::wrap_new(GObject* object)
diff --git a/gdk/src/device.hg b/gdk/src/device.hg
index eafe2bbb..c0d6b6f0 100644
--- a/gdk/src/device.hg
+++ b/gdk/src/device.hg
@@ -88,14 +88,10 @@ public:
_WRAP_METHOD(int get_n_axes() const, gdk_device_get_n_axes)
- /** Returns the labels for the axes that the device currently has.
- * @newin{3,4}
- */
- std::vector<std::string> list_axes() const;
- _IGNORE(gdk_device_list_axes)
+#m4 _CONVERSION(`char**',`std::vector<std::string>',`Glib::ArrayHandler<std::string>::array_to_vector($3,
Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector<std::string> get_axis_names() const, gdk_device_get_axis_names)
- //TODO: Use a string instead of a GdkAtom:
- _WRAP_METHOD(bool get_axis_value(double& axes, GdkAtom axis_label, double& value) const,
gdk_device_get_axis_value )
+ _WRAP_METHOD(bool get_axis_value(double& axes, const std::string& axis_label, double& value) const,
gdk_device_get_axis_value )
_WRAP_METHOD(bool get_axis(double& axes, AxisUse use, double& value) const, gdk_device_get_axis)
diff --git a/gdk/src/enums.hg b/gdk/src/enums.hg
index 2cb3bc58..3e563fc7 100644
--- a/gdk/src/enums.hg
+++ b/gdk/src/enums.hg
@@ -25,6 +25,7 @@ _WRAP_ENUM(AxisFlags, GdkAxisFlags)
_WRAP_ENUM(AxisUse, GdkAxisUse)
_WRAP_ENUM(CrossingMode, GdkCrossingMode)
_WRAP_ENUM(DragAction, GdkDragAction)
+_WRAP_ENUM(Gravity, GdkGravity)
_WRAP_ENUM(NotifyType, GdkNotifyType)
_WRAP_ENUM(ScrollDirection, GdkScrollDirection)
_WRAP_ENUM(TouchpadGesturePhase, GdkTouchpadGesturePhase)
diff --git a/gdk/src/event.ccg b/gdk/src/event.ccg
index 157b0e71..f26a7630 100644
--- a/gdk/src/event.ccg
+++ b/gdk/src/event.ccg
@@ -16,9 +16,24 @@
*/
#include <gdkmm/device.h>
+#include <gdkmm/devicetool.h>
#include <gdkmm/display.h>
-#include <gdkmm/seat.h>
+#include <gdkmm/drop.h>
#include <gdkmm/surface.h>
using Type = Gdk::Event::Type;
+namespace Gdk
+{
+
+std::vector<double> Event::get_axes() const
+{
+ double* axes = nullptr;
+ guint n_axes = 0;
+ if (!gdk_event_get_axes(const_cast<GdkEvent*>(gobj()), &axes, &n_axes))
+ return {};
+
+ return std::vector<double>(axes, axes + n_axes);
+}
+
+} // name space Gdk
diff --git a/gdk/src/event.hg b/gdk/src/event.hg
index 4c36a8a3..a93b60d2 100644
--- a/gdk/src/event.hg
+++ b/gdk/src/event.hg
@@ -16,12 +16,12 @@
*/
_DEFS(gdkmm,gdk)
-_CC_INCLUDE(gdk/gdk.h)
-_PINCLUDE(glibmm/private/object_p.h)
-#include <glibmm/object.h>
#include <glibmm/refptr.h>
#include <glibmm/value.h>
+#include <gdkmm/enums.h>
+#include <gdkmm/timecoord.h>
+#include <gdkmm/types.h>
/* Shadow DELETE macro (from winnt.h).
* It interferes with Gdk::Event::Type::DELETE.
@@ -34,87 +34,105 @@ enum { DELETE = GTKMM_MACRO_DEFINITION_DELETE };
#define GTKMM_MACRO_SHADOW_DELETE 1
#endif
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-using GdkEvent = union _GdkEvent;
-using GdkEventClass = struct _GdkEventClass;
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
namespace Gdk
{
class Device;
+class DeviceTool;
class Display;
-class Seat;
+class Drop;
class Surface;
+/** Representing an event sequence.
+ * Used to differentiate between multiple touches on multitouch touchscreens.
+ * It's a hidden struct. You can test %EventSequence pointers for equality,
+ * but you can't do much more with them.
+ */
+struct EventSequence;
+
/** Functions for handling events from the window system.
*
- * In GTK+ applications the events are handled automatically in
- * gtk_main_do_event() and passed on to the appropriate widgets,
- * so %Gdk::Event and its subclasses are rarely needed.
+ * In GTK applications the events are handled automatically by toplevel
+ * widgets and passed on to the event controllers of appropriate widgets,
+ * so these functions are rarely needed.
*/
-class Event : public Glib::Object
+class Event final
{
- _CLASS_GOBJECT(Event, GdkEvent, GDK_EVENT, Glib::Object, GObject)
- _STRUCT_NOT_HIDDEN dnl// _GdkEvent is not a struct, it's a union
- _IGNORE(gdk_event_new)
+ // GdkEvent is actually registered as a boxed type, but it has custom
+ // reference-counting instead of copy/free functions, so we use it via RefPtr.
+ _CLASS_OPAQUE_REFCOUNTED(Event, GdkEvent, NONE, gdk_event_ref, gdk_event_unref)
+ _IGNORE(gdk_event_ref, gdk_event_unref)
public:
_WRAP_ENUM(Type, GdkEventType)
-protected:
- _WRAP_CTOR(Event(Type event_type), gdk_event_new)
-
-public:
- /** Creates a new event of the given type. All fields are set to 0.
- */
- _WRAP_CREATE(Type event_type)
- _WRAP_METHOD(Glib::RefPtr<Event> copy() const, gdk_event_copy)
-
_WRAP_METHOD(Type get_event_type() const, gdk_event_get_event_type)
- _WRAP_METHOD(Glib::RefPtr<Gdk::Surface> get_surface(), gdk_event_get_surface, refreturn)
- _WRAP_METHOD(Glib::RefPtr<const Gdk::Surface> get_surface() const, gdk_event_get_surface, refreturn,
constversion)
+ _WRAP_METHOD(Glib::RefPtr<Surface> get_surface(), gdk_event_get_surface, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Surface> get_surface() const, gdk_event_get_surface, refreturn,
constversion)
- /**
- * Returns @c true if the event was sent explicitly (e.g. using @c XSendEvent)
- */
- _WRAP_METHOD(bool is_sent() const, gdk_event_is_sent)
-
- _WRAP_METHOD(static void set_show_events(bool show_events = true), gdk_set_show_events)
- _WRAP_METHOD(static bool get_show_events(), gdk_get_show_events)
-
- _WRAP_METHOD(void set_device(const Glib::RefPtr<Device>& device), gdk_event_set_device, newin "3,94")
_WRAP_METHOD(Glib::RefPtr<Device> get_device(), gdk_event_get_device, refreturn, newin "3,94")
_WRAP_METHOD(Glib::RefPtr<const Device> get_device() const, gdk_event_get_device, refreturn, constversion,
newin "3,94")
- _WRAP_METHOD(void set_source_device(const Glib::RefPtr<Device>& device), gdk_event_set_source_device,
newin "3,94")
_WRAP_METHOD(Glib::RefPtr<Device> get_source_device(), gdk_event_get_source_device, refreturn, newin
"3,94")
_WRAP_METHOD(Glib::RefPtr<const Device> get_source_device() const, gdk_event_get_source_device, refreturn,
constversion, newin "3,94")
- _WRAP_METHOD(void set_display(const Glib::RefPtr<Display>& display), gdk_event_set_display)
+ _WRAP_METHOD(Glib::RefPtr<DeviceTool> get_device_tool(), gdk_event_get_device_tool, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const DeviceTool> get_device_tool() const, gdk_event_get_device_tool, refreturn,
constversion)
+
+ _WRAP_METHOD(guint32 get_time() const, gdk_event_get_time)
+
_WRAP_METHOD(Glib::RefPtr<Display> get_display(), gdk_event_get_display, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Display> get_display() const, gdk_event_get_display, refreturn,
constversion)
- _WRAP_METHOD(Glib::RefPtr<Seat> get_seat(), gdk_event_get_seat, refreturn, newin "3,90")
- _WRAP_METHOD(Glib::RefPtr<const Seat> get_seat() const, gdk_event_get_seat, refreturn, constversion, newin
"3,90")
-
- _WRAP_PROPERTY("event-type", Type)
-
- // Belong to subclasses:
- _IGNORE(gdk_event_get_time, gdk_event_get_state, gdk_event_get_keyval,
- gdk_event_get_device_tool, gdk_event_set_device_tool,
- gdk_event_get_keycode, gdk_event_get_scancode, gdk_event_get_key_group,
- gdk_event_get_key_is_modifier, gdk_event_get_button,
- gdk_event_get_click_count, gdk_event_triggers_context_menu,
- gdk_event_get_coords, gdk_event_get_scroll_deltas,
- gdk_event_get_scroll_direction, gdk_event_is_scroll_stop_event, gdk_event_get_axis,
- gdk_event_get_event_sequence, gdk_event_get_touch_emulating_pointer,
- gdk_event_get_pointer_emulated, gdk_event_get_drop, gdk_event_get_crossing_mode,
- gdk_event_get_crossing_detail, gdk_event_get_focus_in,
- gdk_event_get_grab_surface, gdk_event_get_touchpad_gesture_phase,
- gdk_event_get_touchpad_gesture_n_fingers, gdk_event_get_touchpad_deltas,
- gdk_event_get_touchpad_angle_delta, gdk_event_get_touchpad_scale,
- gdk_event_get_pad_group_mode, gdk_event_get_pad_button, gdk_event_get_pad_axis_value)
+ _WRAP_METHOD(const EventSequence* get_event_sequence() const, gdk_event_get_event_sequence)
+ _WRAP_METHOD(ModifierType get_modifier_state() const, gdk_event_get_modifier_state)
+ _WRAP_METHOD(bool get_position(double& x, double& y) const, gdk_event_get_position)
+
+ /** Extracts all axis values from an event.
+ *
+ * @return A vector of values for all axes. An empty vector in case of failure.
+ */
+ std::vector<double> get_axes() const;
+ _IGNORE(gdk_event_get_axes)
+
+ _WRAP_METHOD(bool get_axis(Gdk::AxisUse axis_use, double& value) const, gdk_event_get_axis)
+ _WRAP_METHOD(bool get_pointer_emulated() const, gdk_event_get_pointer_emulated)
+ _WRAP_METHOD(guint get_button() const, gdk_button_event_get_button)
+ _WRAP_METHOD(ScrollDirection get_direction() const, gdk_scroll_event_get_direction)
+ _WRAP_METHOD(void get_deltas(double& delta_x, double& delta_y) const, gdk_scroll_event_get_deltas)
+ _WRAP_METHOD(bool is_scroll_stop() const, gdk_scroll_event_is_stop)
+ _WRAP_METHOD(guint get_keyval() const, gdk_key_event_get_keyval)
+ _WRAP_METHOD(guint get_keycode() const, gdk_key_event_get_keycode)
+ _WRAP_METHOD(guint get_scancode() const, gdk_key_event_get_scancode)
+ _WRAP_METHOD(guint get_group() const, gdk_key_event_get_group)
+ _WRAP_METHOD(bool is_modifier() const, gdk_key_event_is_modifier)
+ _WRAP_METHOD(bool get_focus_in() const, gdk_focus_event_get_in)
+ _WRAP_METHOD(bool get_touch_emulating_pointer() const, gdk_touch_event_get_emulating_pointer)
+ _WRAP_METHOD(CrossingMode get_crossing_mode() const, gdk_crossing_event_get_mode)
+ _WRAP_METHOD(NotifyType get_crossing_detail() const, gdk_crossing_event_get_detail)
+ _WRAP_METHOD(void get_configure_size(int& width, int& height) const, gdk_configure_event_get_size)
+ _WRAP_METHOD(TouchpadGesturePhase get_touchpad_gesture_phase() const, gdk_touchpad_event_get_gesture_phase)
+ _WRAP_METHOD(guint get_touchpad_n_fingers() const, gdk_touchpad_event_get_n_fingers)
+ _WRAP_METHOD(void get_touchpad_deltas(double& dx, double& dy) const, gdk_touchpad_event_get_deltas)
+ _WRAP_METHOD(double get_touchpad_pinch_angle_delta() const, gdk_touchpad_pinch_event_get_angle_delta)
+ _WRAP_METHOD(double get_touchpad_pinch_scale() const, gdk_touchpad_pinch_event_get_scale)
+ _WRAP_METHOD(guint get_pad_button_button() const, gdk_pad_button_event_get_button)
+ _WRAP_METHOD(void get_pad_axis_value(guint& index, double& value) const, gdk_pad_axis_event_get_value)
+ _WRAP_METHOD(void get_pad_group_mode(guint& group, guint& mode) const, gdk_pad_event_get_group_mode)
+
+ _WRAP_METHOD(Glib::RefPtr<Drop> get_drag_drop(), gdk_drag_event_get_drop, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Drop> get_drag_drop() const, gdk_drag_event_get_drop, refreturn,
constversion)
+
+ _WRAP_METHOD(Glib::RefPtr<Surface> get_grab_broken_grab_surface(), gdk_grab_broken_event_get_grab_surface,
refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Surface> get_grab_broken_grab_surface() const,
gdk_grab_broken_event_get_grab_surface, refreturn, constversion)
+
+#m4 _CONVERSION(`GList*',`std::vector<TimeCoord>',`Glib::ListHandler<TimeCoord,
TimeCoordPtrTraits>::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector<TimeCoord> get_motion_history() const, gdk_event_get_motion_history)
+
+ _WRAP_METHOD(bool triggers_context_menu() const, gdk_event_triggers_context_menu)
+ _WRAP_METHOD(bool get_distance(const Glib::RefPtr<const Event>& event2, double& distance) const,
gdk_events_get_distance)
+ _WRAP_METHOD(bool get_angle(const Glib::RefPtr<const Event>& event2, double& angle) const,
gdk_events_get_angle)
+ _WRAP_METHOD(bool get_center(const Glib::RefPtr<const Event>& event2, double& x, double& y) const,
gdk_events_get_center)
};
} // namespace Gdk
diff --git a/gdk/src/filelist.am b/gdk/src/filelist.am
index 5d05bf13..8b1fa032 100644
--- a/gdk/src/filelist.am
+++ b/gdk/src/filelist.am
@@ -31,7 +31,6 @@ gdkmm_files_any_hg = \
drop.hg \
enums.hg \
event.hg \
- events.hg \
frameclock.hg \
frametimings.hg \
glcontext.hg \
@@ -43,6 +42,7 @@ gdkmm_files_any_hg = \
pixbufanimationiter.hg \
pixbufformat.hg \
pixbufloader.hg \
+ popuplayout.hg \
rectangle.hg \
rgba.hg \
seat.hg \
diff --git a/gdk/src/popuplayout.ccg b/gdk/src/popuplayout.ccg
new file mode 100644
index 00000000..16221a6d
--- /dev/null
+++ b/gdk/src/popuplayout.ccg
@@ -0,0 +1,16 @@
+/* Copyright (C) 2020 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
diff --git a/gdk/src/popuplayout.hg b/gdk/src/popuplayout.hg
new file mode 100644
index 00000000..aa5d6c65
--- /dev/null
+++ b/gdk/src/popuplayout.hg
@@ -0,0 +1,58 @@
+/* Copyright (C) 2020 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+_DEFS(gdkmm,gdk)
+
+#include <glibmm/refptr.h>
+#include <gdkmm/enums.h>
+#include <gdkmm/rectangle.h>
+#include <gdk/gdk.h> // For GdkPopupLayout.
+
+_CC_INCLUDE(gdk/gdk.h)
+
+namespace Gdk
+{
+_WRAP_ENUM(AnchorHints, GdkAnchorHints)
+
+/**
+ * @newin{3,98}
+ */
+class PopupLayout final
+{
+ // GdkPopupLayout is actually registered as a boxed type, but it has custom
+ // reference-counting instead of copy/free functions, so we use it via RefPtr.
+ _CLASS_OPAQUE_REFCOUNTED(PopupLayout, GdkPopupLayout, NONE, gdk_popup_layout_ref, gdk_popup_layout_unref)
+ _IGNORE(gdk_popup_layout_ref, gdk_popup_layout_unref)
+public:
+
+ _WRAP_METHOD(static Glib::RefPtr<PopupLayout> create(const Rectangle& anchor_rect,
+ Gravity rect_anchor, Gravity surface_anchor), gdk_popup_layout_new)
+ _WRAP_METHOD(Glib::RefPtr<PopupLayout> copy() const, gdk_popup_layout_copy)
+ _WRAP_METHOD(bool equal(const Glib::RefPtr<const PopupLayout>& other) const, gdk_popup_layout_equal)
+
+ _WRAP_METHOD(void set_anchor_rect(const Rectangle& anchor_rect), gdk_popup_layout_set_anchor_rect)
+ _WRAP_METHOD(Rectangle get_anchor_rect() const, gdk_popup_layout_get_anchor_rect)
+ _WRAP_METHOD(void set_rect_anchor(Gravity anchor), gdk_popup_layout_set_rect_anchor)
+ _WRAP_METHOD(Gravity get_rect_anchor() const, gdk_popup_layout_get_rect_anchor)
+ _WRAP_METHOD(void set_surface_anchor(Gravity anchor), gdk_popup_layout_set_surface_anchor)
+ _WRAP_METHOD(Gravity get_surface_anchor() const, gdk_popup_layout_get_surface_anchor)
+ _WRAP_METHOD(void set_anchor_hints(AnchorHints anchor_hints), gdk_popup_layout_set_anchor_hints)
+ _WRAP_METHOD(AnchorHints get_anchor_hints() const, gdk_popup_layout_get_anchor_hints)
+ _WRAP_METHOD(void set_offset(int dx, int dy), gdk_popup_layout_set_offset)
+ _WRAP_METHOD(void get_offset(int& dx, int& dy), gdk_popup_layout_get_offset)
+};
+
+} // namespace Gdk
diff --git a/gdk/src/surface.ccg b/gdk/src/surface.ccg
index 5c8c9ae6..4f96da16 100644
--- a/gdk/src/surface.ccg
+++ b/gdk/src/surface.ccg
@@ -23,7 +23,6 @@
#include <gdkmm/types.h>
#include <gdkmm/cairocontext.h>
#include <gdkmm/glcontext.h>
-#include <gdkmm/drawcontext.h>
#include <gdkmm/frameclock.h>
#include <gdkmm/monitor.h>
diff --git a/gdk/src/surface.hg b/gdk/src/surface.hg
index 413ea2c1..fc427c54 100644
--- a/gdk/src/surface.hg
+++ b/gdk/src/surface.hg
@@ -21,11 +21,10 @@ _CONFIGINCLUDE(gdkmmconfig.h)
#include <gdkmm/drag.h>
#include <gdkmm/types.h>
#include <cairomm/region.h>
-#include <cairomm/pattern.h>
#include <gdkmm/device.h>
+#include <gdkmm/enums.h>
#include <gdkmm/event.h>
-#include <gdkmm/rectangle.h>
-#include <gdkmm/rgba.h>
+#include <gdkmm/popuplayout.h>
#include <cairomm/context.h>
#include <gdk/gdk.h>
@@ -38,8 +37,6 @@ namespace Gdk
_WRAP_ENUM(WMDecoration, GdkWMDecoration)
_WRAP_ENUM(WMFunction, GdkWMFunction)
_WRAP_ENUM(SurfaceEdge, GdkSurfaceEdge)
-_WRAP_ENUM(Gravity, GdkGravity)
-_WRAP_ENUM(AnchorHints, GdkAnchorHints)
_WRAP_ENUM(FullscreenMode, GdkFullscreenMode,
s#^CURRENT_MONITOR$#ON_CURRENT_MONITOR#,
s#^ALL_MONITORS$#ON_ALL_MONITORS#)
@@ -48,7 +45,6 @@ class ContentProvider;
class Cursor;
class CairoContext;
class GLContext;
-class DrawContext;
class FrameClock;
class Monitor;
@@ -75,9 +71,7 @@ public:
// function, because some of them have identical prototypes.
_WRAP_METHOD(static Glib::RefPtr<Surface> create_toplevel(const Glib::RefPtr<Display>& display,
int width, int height), gdk_surface_new_toplevel)
- _WRAP_METHOD(static Glib::RefPtr<Surface> create_temp(const Glib::RefPtr<Display>& display,
- const Rectangle& position), gdk_surface_new_temp)
- _WRAP_METHOD(static Glib::RefPtr<Surface> create_popup(const Glib::RefPtr<Display>& display,
+ _WRAP_METHOD(static Glib::RefPtr<Surface> create_popup(
const Glib::RefPtr<Surface>& parent, bool autohide), gdk_surface_new_popup)
_WRAP_METHOD(Type get_surface_type() const, gdk_surface_get_surface_type)
@@ -92,9 +86,11 @@ public:
_WRAP_METHOD(void hide(), gdk_surface_hide)
_WRAP_METHOD(void show_unraised(), gdk_surface_show_unraised)
_WRAP_METHOD(void resize(int width, int height), gdk_surface_resize)
- _WRAP_METHOD(void move_to_rect(const Rectangle& rect, Gravity rect_anchor,
- Gravity surface_anchor, AnchorHints anchor_hints, int rect_anchor_dx, int rect_anchor_dy),
- gdk_surface_move_to_rect)
+
+ _WRAP_METHOD(bool present_popup(int width, int height, const Glib::RefPtr<const PopupLayout>& layout),
+ gdk_surface_present_popup)
+ _WRAP_METHOD(Gravity get_popup_surface_anchor() const, gdk_surface_get_popup_surface_anchor)
+ _WRAP_METHOD(Gravity get_popup_rect_anchor() const, gdk_surface_get_popup_rect_anchor)
_WRAP_METHOD(void raise(), gdk_surface_raise)
_WRAP_METHOD(void lower(), gdk_surface_lower)
@@ -174,7 +170,6 @@ public:
_WRAP_METHOD(void unstick(), gdk_surface_unstick)
_WRAP_METHOD(void maximize(), gdk_surface_maximize)
_WRAP_METHOD(void unmaximize(), gdk_surface_unmaximize)
- _WRAP_METHOD(void register_dnd(), gdk_surface_register_dnd)
_WRAP_METHOD(void begin_resize_drag(SurfaceEdge edge, int button, int root_x, int root_y, guint32
timestamp), gdk_surface_begin_resize_drag)
@@ -243,9 +238,7 @@ public:
_WRAP_METHOD(Glib::RefPtr<Gdk::CairoContext> create_cairo_context(), gdk_surface_create_cairo_context)
// no_default_handler because the wrapped C signals have no default handlers.
-#m4 _CONVERSION(`gpointer',`const Gdk::Rectangle&',`Glib::wrap((GdkRectangle*)$3)')
- _WRAP_SIGNAL(void moved_to_rect(const Gdk::Rectangle& flipped_rect, const Gdk::Rectangle& final_rect,
- bool flipped_x, bool flipped_y), "moved-to-rect", no_default_handler)
+ _WRAP_SIGNAL(void popup_layout_changed(), "popup-layout-changed", no_default_handler)
_WRAP_SIGNAL(void size_changed(int width, int height), "size-changed", no_default_handler)
#m4 _CONVERSION(`CairoRegion*',`const ::Cairo::RefPtr<const ::Cairo::Region>&',`Gdk::Cairo::wrap($3)')
_WRAP_SIGNAL(bool render(const ::Cairo::RefPtr<const ::Cairo::Region>& expose_region),
diff --git a/gdk/src/types.ccg b/gdk/src/types.ccg
index f831f334..a75ccd65 100644
--- a/gdk/src/types.ccg
+++ b/gdk/src/types.ccg
@@ -59,37 +59,6 @@ bool Point::equal(const Gdk::Point& rhs) const
return (gobject_.x == rhs.gobject_.x) && (gobject_.y == rhs.gobject_.y);
}
-// static
-GdkAtom AtomStringTraits::to_c_type(const std::string& atom_name)
-{
- return g_intern_string(atom_name.c_str());
-}
-
-// static
-std::string AtomStringTraits::to_cpp_type(GdkAtom atom)
-{
- // GdkAtom is an interned string (typedef const char* GdkAtom).
- if (atom)
- return std::string(atom);
- else
- return std::string();
-}
-
-// static
-GdkAtom AtomUstringTraits::to_c_type(const Glib::ustring& atom_name)
-{
- return g_intern_string(atom_name.c_str());
-}
-
-// static
-Glib::ustring AtomUstringTraits::to_cpp_type(GdkAtom atom)
-{
- if (atom)
- return Glib::ustring(atom);
- else
- return Glib::ustring();
-}
-
} // namespace Gdk
diff --git a/gdk/src/types.hg b/gdk/src/types.hg
index db48a842..244bd469 100644
--- a/gdk/src/types.hg
+++ b/gdk/src/types.hg
@@ -95,43 +95,6 @@ struct PointTraits
static CType to_c_type (const CppType& cpp_obj) { return *(cpp_obj.gobj ()); }
static CppType to_cpp_type (CType c_obj) { return CppType (c_obj.x, c_obj.y); }
};
-
-struct AtomStringTraits
-{
- typedef std::string CppType;
- typedef GdkAtom CType;
- typedef GdkAtom CTypeNonConst;
-
- static GdkAtom to_c_type(GdkAtom atom) { return atom; }
- static void release_c_type(GdkAtom) {}
-
- // These aren't worth to be inlined since doing so
- // would expose way too much of the implementation.
- static GdkAtom to_c_type (const std::string& atom_name);
- static std::string to_cpp_type(GdkAtom atom);
-};
-
-// I'm typedef'ing this because when we call to_c_type or to_c_type,
-// we don't want it to look like we're calling a template trait, but
-// a utility function. -Bryan
-typedef AtomStringTraits AtomString;
-
-struct AtomUstringTraits
-{
- typedef Glib::ustring CppType;
- typedef GdkAtom CType;
- typedef GdkAtom CTypeNonConst;
-
- static GdkAtom to_c_type(GdkAtom atom) { return atom; }
- static void release_c_type(GdkAtom) {}
-
- // These aren't worth to be inlined since doing so
- // would expose way too much of the implementation.
- static GdkAtom to_c_type (const Glib::ustring& atom_name);
- static Glib::ustring to_cpp_type(GdkAtom atom);
-};
-
-typedef AtomUstringTraits AtomUstring;
#endif //DOXYGEN_SHOULD_SKIP_THIS
} // namespace Gdk
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index 24d4f363..2777899a 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -139,6 +139,7 @@ extern const int gtkmm_micro_version;
#include <gtkmm/dialog.h>
#include <gtkmm/dragsource.h>
#include <gtkmm/drawingarea.h>
+#include <gtkmm/dropcontrollermotion.h>
#include <gtkmm/droptarget.h>
#include <gtkmm/editable.h>
#include <gtkmm/emojichooser.h>
@@ -146,6 +147,7 @@ extern const int gtkmm_micro_version;
#include <gtkmm/expander.h>
#include <gtkmm/enums.h>
#include <gtkmm/eventcontroller.h>
+#include <gtkmm/eventcontrollerfocus.h>
#include <gtkmm/eventcontrollerkey.h>
#include <gtkmm/eventcontrollermotion.h>
#include <gtkmm/eventcontrollerscroll.h>
diff --git a/gtk/gtkmm/filelist.am b/gtk/gtkmm/filelist.am
index 23bd02ed..7c0d8185 100644
--- a/gtk/gtkmm/filelist.am
+++ b/gtk/gtkmm/filelist.am
@@ -10,7 +10,6 @@ gtkmm_files_extra_any_cc = \
listviewtext.cc \
object.cc \
radiobuttongroup.cc \
- selectiondata_private.cc \
treemodelcolumn.cc \
treeview_private.cc
@@ -24,7 +23,6 @@ gtkmm_files_extra_any_h = \
listviewtext.h \
object.h \
radiobuttongroup.h \
- selectiondata_private.h \
treemodelcolumn.h \
treeview_private.h \
version.h \
diff --git a/gtk/src/combobox.ccg b/gtk/src/combobox.ccg
index 4cc31b9c..f81ebd1c 100644
--- a/gtk/src/combobox.ccg
+++ b/gtk/src/combobox.ccg
@@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <gdkmm/device.h>
#include <gtkmm/liststore.h>
#include <gtkmm/treeview_private.h> //For SignalProxy_RowSeparator.
#include <gtk/gtk.h>
diff --git a/gtk/src/combobox.hg b/gtk/src/combobox.hg
index 1728c967..48444405 100644
--- a/gtk/src/combobox.hg
+++ b/gtk/src/combobox.hg
@@ -27,6 +27,11 @@
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/bin_p.h)
+namespace Gdk
+{
+class Device;
+}
+
namespace Gtk
{
diff --git a/gtk/src/dropcontrollermotion.ccg b/gtk/src/dropcontrollermotion.ccg
new file mode 100644
index 00000000..5c729666
--- /dev/null
+++ b/gtk/src/dropcontrollermotion.ccg
@@ -0,0 +1,18 @@
+/* Copyright (C) 2020 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gtk/gtk.h>
+
diff --git a/gtk/src/dropcontrollermotion.hg b/gtk/src/dropcontrollermotion.hg
new file mode 100644
index 00000000..ecdb4d38
--- /dev/null
+++ b/gtk/src/dropcontrollermotion.hg
@@ -0,0 +1,66 @@
+/* Copyright (C) 2020 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gtkmm/eventcontroller.h>
+#include <gdkmm/drop.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/eventcontroller_p.h)
+
+namespace Gtk
+{
+/** Event controller for motion events during a drop.
+ *
+ * %Gtk::DropControllerMotion is an event controller meant for tracking
+ * the pointer hovering over a widget during a drag and drop operation.
+ *
+ * It is modeled after Gtk::EventControllerMotion so if you have used
+ * that, this should feel really familiar.
+ *
+ * The drop controller is not able to accept drops, use Gtk::DropTarget
+ * for that purpose.
+ *
+ * @newin{3,98}
+ *
+ * @see Gdk::Drop, Gtk::DropTarget
+ * @ingroup Gestures
+ */
+class DropControllerMotion : public EventController
+{
+ _CLASS_GOBJECT(DropControllerMotion, GtkDropControllerMotion, GTK_DROP_CONTROLLER_MOTION, EventController,
GtkEventController)
+
+protected:
+ _CTOR_DEFAULT
+
+public:
+ _WRAP_CREATE()
+
+ _WRAP_METHOD(bool contains_pointer() const, gtk_drop_controller_motion_contains_pointer)
+ _WRAP_METHOD(bool is_pointer() const, gtk_drop_controller_motion_is_pointer)
+ _WRAP_METHOD(Glib::RefPtr<Gdk::Drop> get_drop(), gtk_drop_controller_motion_get_drop, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Gdk::Drop> get_drop() const, gtk_drop_controller_motion_get_drop,
refreturn, constversion)
+
+ // no_default_handler because GtkDropControllerMotionClass is private.
+ _WRAP_SIGNAL(void enter(double x, double y), "enter", no_default_handler)
+ _WRAP_SIGNAL(void leave(), "leave", no_default_handler)
+ _WRAP_SIGNAL(void motion(double x, double y), "motion", no_default_handler)
+
+ _WRAP_PROPERTY("contains-pointer", bool)
+ _WRAP_PROPERTY("drop", Glib::RefPtr<Gdk::Drop>)
+ _WRAP_PROPERTY("is-pointer", bool)
+};
+
+} // namespace Gtk
diff --git a/gtk/src/droptarget.hg b/gtk/src/droptarget.hg
index 6f06077a..c33e8e3f 100644
--- a/gtk/src/droptarget.hg
+++ b/gtk/src/droptarget.hg
@@ -18,7 +18,6 @@
#include <gdkmm/drop.h>
#include <gdkmm/enums.h>
#include <gtkmm/eventcontroller.h>
-#include <gtkmm/selectiondata.h>
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/eventcontroller_p.h)
@@ -88,13 +87,6 @@ public:
_WRAP_METHOD(Glib::ustring find_mimetype() const, gtk_drop_target_find_mimetype)
- _WRAP_METHOD(void read_selection_async(const std::string& target, const Gio::SlotAsyncReady&
slot{callback},
- const Glib::RefPtr<Gio::Cancellable>& cancellable{.?}),
- gtk_drop_target_read_selection, slot_name slot, slot_callback Gio::SignalProxy_async_callback)
-#m4 _CONVERSION(`GtkSelectionData*',`SelectionData', `Gtk::SelectionData(($3), false)')
- _WRAP_METHOD(SelectionData read_selection_finish(const Glib::RefPtr<Gio::AsyncResult>& result),
- gtk_drop_target_read_selection_finish, errthrow)
-
_WRAP_METHOD(void deny_drop(const Glib::RefPtr<Gdk::Drop>& drop), gtk_drop_target_deny_drop)
_WRAP_PROPERTY("formats", Glib::RefPtr<Gdk::ContentFormats>)
diff --git a/gtk/src/enums.hg b/gtk/src/enums.hg
index a9930456..fe33e6f3 100644
--- a/gtk/src/enums.hg
+++ b/gtk/src/enums.hg
@@ -51,7 +51,6 @@ _WRAP_ENUM(ScrollType, GtkScrollType)
_WRAP_ENUM(SelectionMode, GtkSelectionMode)
_WRAP_ENUM(ShadowType, GtkShadowType)
_WRAP_ENUM(StackTransitionType, GtkStackTransitionType)
-_WRAP_ENUM(WindowType,GtkWindowType)
_WRAP_ENUM(WrapMode, GtkWrapMode)
_WRAP_ENUM(SortType, GtkSortType)
_WRAP_ENUM(PageOrientation, GtkPageOrientation)
diff --git a/gtk/src/eventcontrollerfocus.ccg b/gtk/src/eventcontrollerfocus.ccg
new file mode 100644
index 00000000..5c729666
--- /dev/null
+++ b/gtk/src/eventcontrollerfocus.ccg
@@ -0,0 +1,18 @@
+/* Copyright (C) 2020 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gtk/gtk.h>
+
diff --git a/gtk/src/eventcontrollerfocus.hg b/gtk/src/eventcontrollerfocus.hg
new file mode 100644
index 00000000..94752533
--- /dev/null
+++ b/gtk/src/eventcontrollerfocus.hg
@@ -0,0 +1,58 @@
+/* Copyright (C) 2020 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gtkmm/eventcontroller.h>
+#include <gdkmm/enums.h>
+#include <gdkmm/types.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/eventcontroller_p.h)
+
+namespace Gtk
+{
+class Widget;
+
+/** Event controller for focus.
+ *
+ * %Gtk::EventControllerFocus is an event controller meant for situations
+ * where you need to know where the focus is.
+ *
+ * @newin{3,98}
+ *
+ * @ingroup Gestures
+ */
+class EventControllerFocs : public EventController
+{
+ _CLASS_GOBJECT(EventControllerFocs, GtkEventControllerFocus, GTK_EVENT_CONTROLLER_FOCUS, EventController,
GtkEventController)
+
+protected:
+ _CTOR_DEFAULT
+
+public:
+ _WRAP_CREATE()
+
+ _WRAP_METHOD(bool contains_focus() const, gtk_event_controller_focus_contains_focus)
+ _WRAP_METHOD(bool is_focus() const, gtk_event_controller_focus_is_focus)
+
+ // no_default_handler because GtkEventControllerFocusClass is private.
+ _WRAP_SIGNAL(void enter(), "enter", no_default_handler)
+ _WRAP_SIGNAL(void leave(), "leave", no_default_handler)
+
+ _WRAP_PROPERTY("is-focus", bool)
+ _WRAP_PROPERTY("contains-focus", bool)
+};
+
+} // namespace Gtk
diff --git a/gtk/src/eventcontrollerkey.hg b/gtk/src/eventcontrollerkey.hg
index f10dcc63..246f8d7e 100644
--- a/gtk/src/eventcontrollerkey.hg
+++ b/gtk/src/eventcontrollerkey.hg
@@ -25,10 +25,10 @@ namespace Gtk
{
class Widget;
-/** Event controller for key press and key release events.
+/** Event controller for key events.
*
- * %Gtk::EventControllerKey is an event controller meant to handle
- * key press and key release events from keyboards.
+ * %Gtk::EventControllerKey is an event controller meant for situations
+ * where you need access to key events.
*
* @newin{3,94}
*
@@ -51,23 +51,12 @@ public:
_WRAP_METHOD(bool forward(Widget& widget), gtk_event_controller_key_forward)
_WRAP_METHOD(guint get_group() const, gtk_event_controller_key_get_group)
- _WRAP_METHOD(Widget* get_focus_origin(), gtk_event_controller_key_get_focus_origin)
- _WRAP_METHOD(const Widget* get_focus_origin() const, gtk_event_controller_key_get_focus_origin,
constversion)
- _WRAP_METHOD(Widget* get_focus_target(), gtk_event_controller_key_get_focus_target)
- _WRAP_METHOD(const Widget* get_focus_target() const, gtk_event_controller_key_get_focus_target,
constversion)
- _WRAP_METHOD(bool contains_focus() const, gtk_event_controller_key_contains_focus)
- _WRAP_METHOD(bool is_focus() const, gtk_event_controller_key_is_focus)
// no_default_handler because GtkEventControllerKeyClass is private.
_WRAP_SIGNAL(bool key_pressed(guint keyval, guint keycode, Gdk::ModifierType state), "key-pressed",
no_default_handler)
_WRAP_SIGNAL(void key_released(guint keyval, guint keycode, Gdk::ModifierType state), "key-released",
no_default_handler)
_WRAP_SIGNAL(bool modifiers(Gdk::ModifierType state), "modifiers", no_default_handler)
_WRAP_SIGNAL(void im_update(), "im-update", no_default_handler)
- _WRAP_SIGNAL(void focus_in(Gdk::CrossingMode mode, Gdk::NotifyType detail), "focus-in", no_default_handler)
- _WRAP_SIGNAL(void focus_out(Gdk::CrossingMode mode, Gdk::NotifyType detail), "focus-out",
no_default_handler)
-
- _WRAP_PROPERTY("is-focus", bool)
- _WRAP_PROPERTY("contains-focus", bool)
};
} // namespace Gtk
diff --git a/gtk/src/eventcontrollermotion.hg b/gtk/src/eventcontrollermotion.hg
index c5a8d949..23f2def2 100644
--- a/gtk/src/eventcontrollermotion.hg
+++ b/gtk/src/eventcontrollermotion.hg
@@ -43,18 +43,13 @@ protected:
public:
_WRAP_CREATE()
- _WRAP_METHOD(Widget* get_pointer_origin(), gtk_event_controller_motion_get_pointer_origin)
- _WRAP_METHOD(const Widget* get_pointer_origin() const, gtk_event_controller_motion_get_pointer_origin,
constversion)
- _WRAP_METHOD(Widget* get_pointer_target(), gtk_event_controller_motion_get_pointer_target)
- _WRAP_METHOD(const Widget* get_pointer_target() const, gtk_event_controller_motion_get_pointer_target,
constversion)
_WRAP_METHOD(bool contains_pointer() const, gtk_event_controller_motion_contains_pointer)
_WRAP_METHOD(bool is_pointer() const, gtk_event_controller_motion_is_pointer)
// no_default_handler because GtkEventControllerMotionClass is private.
- _WRAP_SIGNAL(void enter(double x, double y, Gdk::CrossingMode crossing_mode, Gdk::NotifyType notify_type),
+ _WRAP_SIGNAL(void enter(double x, double y, Gdk::CrossingMode mode),
"enter", no_default_handler)
- _WRAP_SIGNAL(void leave(Gdk::CrossingMode crossing_mode, Gdk::NotifyType notify_type),
- "leave", no_default_handler)
+ _WRAP_SIGNAL(void leave(Gdk::CrossingMode mode), "leave", no_default_handler)
_WRAP_SIGNAL(void motion(double x, double y), "motion", no_default_handler)
_WRAP_PROPERTY("is-pointer", bool)
diff --git a/gtk/src/filechooser.ccg b/gtk/src/filechooser.ccg
index 6bcf36d9..50e75ebd 100644
--- a/gtk/src/filechooser.ccg
+++ b/gtk/src/filechooser.ccg
@@ -16,11 +16,9 @@
*/
#include <glibmm/vectorutils.h>
-
#include <gtk/gtk.h>
using Action = Gtk::FileChooser::Action;
-using Confirmation = Gtk::FileChooser::Confirmation;
namespace Gtk
{
diff --git a/gtk/src/filechooser.hg b/gtk/src/filechooser.hg
index 3ce57888..ca278786 100644
--- a/gtk/src/filechooser.hg
+++ b/gtk/src/filechooser.hg
@@ -62,53 +62,21 @@ class FileChooser : public Glib::Interface
_CLASS_INTERFACE(FileChooser, GtkFileChooser, GTK_FILE_CHOOSER, GtkFileChooserClass)
public:
_WRAP_ENUM(Action, GtkFileChooserAction)
- _WRAP_ENUM(Confirmation, GtkFileChooserConfirmation)
_WRAP_METHOD(void set_action(Action action), gtk_file_chooser_set_action)
_WRAP_METHOD(Action get_action() const, gtk_file_chooser_get_action)
- _WRAP_METHOD(void set_local_only(bool local_only = true), gtk_file_chooser_set_local_only)
- _WRAP_METHOD(bool get_local_only() const, gtk_file_chooser_get_local_only)
_WRAP_METHOD(void set_select_multiple(bool select_multiple = true), gtk_file_chooser_set_select_multiple)
_WRAP_METHOD(bool get_select_multiple() const, gtk_file_chooser_get_select_multiple)
- _WRAP_METHOD(void set_show_hidden(bool show_hidden = true), gtk_file_chooser_set_show_hidden)
- _WRAP_METHOD(bool get_show_hidden() const, gtk_file_chooser_get_show_hidden)
-
- _WRAP_METHOD(void set_do_overwrite_confirmation(bool do_overwrite_confirmation = true),
gtk_file_chooser_set_do_overwrite_confirmation)
- _WRAP_METHOD(bool get_do_overwrite_confirmation() const, gtk_file_chooser_get_do_overwrite_confirmation)
-
_WRAP_METHOD(void set_create_folders(bool create_folders = true), gtk_file_chooser_set_create_folders)
_WRAP_METHOD(bool get_create_folders() const, gtk_file_chooser_get_create_folders)
_WRAP_METHOD(void set_current_name(const Glib::ustring& name), gtk_file_chooser_set_current_name)
_WRAP_METHOD(Glib::ustring get_current_name() const, gtk_file_chooser_get_current_name)
- _WRAP_METHOD(std::string get_filename() const, gtk_file_chooser_get_filename)
- _WRAP_METHOD(bool set_filename(const std::string& filename), gtk_file_chooser_set_filename)
- _WRAP_METHOD(bool select_filename(const std::string& filename), gtk_file_chooser_select_filename)
- _WRAP_METHOD(void unselect_filename(const std::string& filename), gtk_file_chooser_unselect_filename)
_WRAP_METHOD(void select_all(), gtk_file_chooser_select_all)
_WRAP_METHOD(void unselect_all(), gtk_file_chooser_unselect_all)
-#m4 _CONVERSION(`GSList*',`std::vector<std::string>',`Glib::SListHandler<std::string>::slist_to_vector($3,
Glib::OWNERSHIP_DEEP)')
- _WRAP_METHOD(std::vector<std::string> get_filenames() const, gtk_file_chooser_get_filenames)
-
- _WRAP_METHOD(bool set_current_folder(const std::string& filename), gtk_file_chooser_set_current_folder)
- _WRAP_METHOD(std::string get_current_folder() const, gtk_file_chooser_get_current_folder)
-
-
-/* URI manipulation
- */
- _WRAP_METHOD(Glib::ustring get_uri() const, gtk_file_chooser_get_uri)
- _WRAP_METHOD(bool set_uri(const Glib::ustring& uri), gtk_file_chooser_set_uri)
- _WRAP_METHOD(bool select_uri(const Glib::ustring& uri), gtk_file_chooser_select_uri)
- _WRAP_METHOD(void unselect_uri(const Glib::ustring& uri), gtk_file_chooser_unselect_uri)
-#m4
_CONVERSION(`GSList*',`std::vector<Glib::ustring>',`Glib::SListHandler<Glib::ustring>::slist_to_vector($3,
Glib::OWNERSHIP_DEEP)')
- _WRAP_METHOD(std::vector<Glib::ustring> get_uris() const, gtk_file_chooser_get_uris)
-
- _WRAP_METHOD(bool set_current_folder_uri(const Glib::ustring& uri),
gtk_file_chooser_set_current_folder_uri)
- _WRAP_METHOD(Glib::ustring get_current_folder_uri() const, gtk_file_chooser_get_current_folder_uri)
-
_WRAP_METHOD(bool set_file(const Glib::RefPtr<const Gio::File>& file), gtk_file_chooser_set_file, errthrow)
_WRAP_METHOD(bool select_file(const Glib::RefPtr<const Gio::File>& file), gtk_file_chooser_select_file,
errthrow)
@@ -117,42 +85,15 @@ public:
#m4 _CONVERSION(`GSList*',`std::vector< Glib::RefPtr<Gio::File> >',`Glib::SListHandler<
Glib::RefPtr<Gio::File> >::slist_to_vector($3, Glib::OWNERSHIP_DEEP)')
_WRAP_METHOD(std::vector< Glib::RefPtr<Gio::File> > get_files(), gtk_file_chooser_get_files)
- _WRAP_METHOD(bool set_current_folder_file(const Glib::RefPtr<const Gio::File>& file),
gtk_file_chooser_set_current_folder_file, errthrow)
+ _WRAP_METHOD(bool set_current_folder(const Glib::RefPtr<const Gio::File>& file),
gtk_file_chooser_set_current_folder, errthrow)
//No refreturn is needed here, because the C function provides a reference:
- _WRAP_METHOD(Glib::RefPtr<Gio::File> get_current_folder_file(), gtk_file_chooser_get_current_folder_file)
+ _WRAP_METHOD(Glib::RefPtr<Gio::File> get_current_folder(), gtk_file_chooser_get_current_folder)
//No refreturn is needed here, because the C function provides a reference:
_WRAP_METHOD(Glib::RefPtr<Gio::File> get_file(), gtk_file_chooser_get_file)
_WRAP_METHOD(Glib::RefPtr<const Gio::File> get_file() const, gtk_file_chooser_get_file, constversion)
-/* Preview widget
- */
- _WRAP_METHOD(void set_preview_widget(Gtk::Widget& preview_widget), gtk_file_chooser_set_preview_widget)
-
- _WRAP_METHOD(Gtk::Widget* get_preview_widget(), gtk_file_chooser_get_preview_widget)
- _WRAP_METHOD(const Gtk::Widget* get_preview_widget() const, gtk_file_chooser_get_preview_widget,
constversion)
-
- _WRAP_METHOD(void set_preview_widget_active(bool active = true),
gtk_file_chooser_set_preview_widget_active)
- _WRAP_METHOD(bool get_preview_widget_active() const, gtk_file_chooser_get_preview_widget_active)
-
- _WRAP_METHOD(void set_use_preview_label(bool use_label = true), gtk_file_chooser_set_use_preview_label)
- _WRAP_METHOD(bool get_use_preview_label() const, gtk_file_chooser_get_use_preview_label)
-
-#m4 _CONVERSION(`return-char*',`std::string',`Glib::convert_return_gchar_ptr_to_stdstring($3)')
- _WRAP_METHOD(std::string get_preview_filename() const, gtk_file_chooser_get_preview_filename)
- _WRAP_METHOD(Glib::ustring get_preview_uri() const, gtk_file_chooser_get_preview_uri)
-
- //No refreturn is needed here, because the C function provides a reference:
- _WRAP_METHOD(Glib::RefPtr<Gio::File> get_preview_file(), gtk_file_chooser_get_preview_file)
- _WRAP_METHOD(Glib::RefPtr<const Gio::File> get_preview_file() const, gtk_file_chooser_get_preview_file,
constversion)
-
-/* Extra widget
- */
- _WRAP_METHOD(void set_extra_widget(Gtk::Widget& extra_widget), gtk_file_chooser_set_extra_widget)
- _WRAP_METHOD(Gtk::Widget* get_extra_widget(), gtk_file_chooser_get_extra_widget)
- _WRAP_METHOD(const Gtk::Widget* get_extra_widget() const, gtk_file_chooser_get_extra_widget, constversion)
-
/* List of user selectable filters
*/
_WRAP_METHOD(void add_filter(const Glib::RefPtr<FileFilter>& filter), gtk_file_chooser_add_filter)
@@ -171,14 +112,13 @@ public:
/* Per-application shortcut folders */
- _WRAP_METHOD(bool add_shortcut_folder(const std::string& folder), gtk_file_chooser_add_shortcut_folder,
errthrow)
- _WRAP_METHOD(bool remove_shortcut_folder(const std::string& folder),
gtk_file_chooser_remove_shortcut_folder, errthrow)
-
- _WRAP_METHOD(std::vector<std::string> list_shortcut_folders() const,
gtk_file_chooser_list_shortcut_folders)
+ _WRAP_METHOD(bool add_shortcut_folder(const Glib::RefPtr<Gio::File>& folder),
gtk_file_chooser_add_shortcut_folder, errthrow)
+ _WRAP_METHOD(bool remove_shortcut_folder(const Glib::RefPtr<Gio::File>& folder),
gtk_file_chooser_remove_shortcut_folder, errthrow)
- _WRAP_METHOD(bool add_shortcut_folder_uri(const Glib::ustring& uri),
gtk_file_chooser_add_shortcut_folder_uri, errthrow)
- _WRAP_METHOD(bool remove_shortcut_folder_uri(const Glib::ustring& uri),
gtk_file_chooser_remove_shortcut_folder_uri, errthrow)
- _WRAP_METHOD(std::vector<Glib::ustring> list_shortcut_folder_uris() const,
gtk_file_chooser_list_shortcut_folder_uris)
+#m4
_CONVERSION(`GSList*',`std::vector<Glib::RefPtr<Gio::File>>',`Glib::SListHandler<Glib::RefPtr<Gio::File>>::slist_to_vector($3,
Glib::OWNERSHIP_DEEP)')
+#m4 _CONVERSION(`GSList*',`std::vector<Glib::RefPtr<const
Gio::File>>',`Glib::SListHandler<Glib::RefPtr<const Gio::File>>::slist_to_vector($3, Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector<Glib::RefPtr<Gio::File>> list_shortcut_folders(),
gtk_file_chooser_list_shortcut_folders)
+ _WRAP_METHOD(std::vector<Glib::RefPtr<const Gio::File>> list_shortcut_folders() const,
gtk_file_chooser_list_shortcut_folders)
#m4 _CONVERSION(`const std::vector<Glib::ustring>&',`const
char**',`Glib::ArrayHandler<Glib::ustring>::vector_to_array($3).data ()')
_WRAP_METHOD(void add_choice(const Glib::ustring& id, const Glib::ustring& label, const
std::vector<Glib::ustring>& options, const std::vector<Glib::ustring>& option_labels),
gtk_file_chooser_add_choice)
@@ -204,20 +144,11 @@ public:
_WRAP_SIGNAL(void current_folder_changed(), "current_folder_changed", no_default_handler)
_WRAP_SIGNAL(void selection_changed(), "selection_changed", no_default_handler)
- _WRAP_SIGNAL(void update_preview(), "update_preview", no_default_handler)
_WRAP_SIGNAL(void file_activated(), "file_activated", no_default_handler)
- _WRAP_SIGNAL(Confirmation confirm_overwrite(), "confirm-overwrite", no_default_handler)
_WRAP_PROPERTY("action", Action)
_WRAP_PROPERTY("filter", Glib::RefPtr<FileFilter>)
- _WRAP_PROPERTY("local-only", bool)
- _WRAP_PROPERTY("preview-widget", Widget*)
- _WRAP_PROPERTY("preview-widget-active", bool)
- _WRAP_PROPERTY("use-preview-label", bool)
- _WRAP_PROPERTY("extra-widget", Widget*)
_WRAP_PROPERTY("select-multiple", bool)
- _WRAP_PROPERTY("show-hidden", bool)
- _WRAP_PROPERTY("do-overwrite-confirmation", bool)
_WRAP_PROPERTY("create-folders", bool)
};
diff --git a/gtk/src/filefilter.hg b/gtk/src/filefilter.hg
index aa3a88bd..0509c6c6 100644
--- a/gtk/src/filefilter.hg
+++ b/gtk/src/filefilter.hg
@@ -107,6 +107,8 @@ public:
// These are meant for implementors of FileChooser, so we don’t wrap them.
_IGNORE(gtk_file_filter_filter)
_IGNORE(gtk_file_filter_get_needed)
+
+ _WRAP_PROPERTY("name", Glib::ustring)
};
} // namespace Gtk
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index efbd1fd6..27019ee5 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -69,6 +69,7 @@ gtkmm_files_any_hg = \
dialog.hg \
dragsource.hg \
drawingarea.hg \
+ dropcontrollermotion.hg \
droptarget.hg \
editable.hg \
emojichooser.hg \
@@ -77,6 +78,7 @@ gtkmm_files_any_hg = \
entrybuffer.hg \
enums.hg \
eventcontroller.hg \
+ eventcontrollerfocus.hg \
eventcontrollerkey.hg \
eventcontrollermotion.hg \
eventcontrollerscroll.hg \
@@ -166,7 +168,6 @@ gtkmm_files_any_hg = \
scrolledwindow.hg \
searchbar.hg \
searchentry.hg \
- selectiondata.hg \
selectionmodel.hg \
separator.hg \
settings.hg \
diff --git a/gtk/src/gesture.ccg b/gtk/src/gesture.ccg
index 6283a6cc..8c946fe9 100644
--- a/gtk/src/gesture.ccg
+++ b/gtk/src/gesture.ccg
@@ -14,6 +14,7 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <gdkmm/device.h>
#include <gtk/gtk.h>
namespace Gtk
diff --git a/gtk/src/gesture.hg b/gtk/src/gesture.hg
index 627ff836..2085170c 100644
--- a/gtk/src/gesture.hg
+++ b/gtk/src/gesture.hg
@@ -16,11 +16,16 @@
#include <vector>
#include <gtkmm/eventcontroller.h>
-#include <gdkmm/events.h>
+#include <gdkmm/event.h>
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/eventcontroller_p.h)
+namespace Gdk
+{
+class Device;
+}
+
namespace Gtk
{
_WRAP_ENUM(EventSequenceState, GtkEventSequenceState)
@@ -144,8 +149,10 @@ public:
_WRAP_METHOD(Gdk::EventSequence* get_last_updated_sequence(), gtk_gesture_get_last_updated_sequence)
_WRAP_METHOD(const Gdk::EventSequence* get_last_updated_sequence() const,
gtk_gesture_get_last_updated_sequence, constversion)
_WRAP_METHOD(bool handles_sequence(Gdk::EventSequence* sequence) const, gtk_gesture_handles_sequence)
- _WRAP_METHOD(Glib::RefPtr<const Gdk::Event> get_last_event(Gdk::EventSequence* sequence) const,
+ _WRAP_METHOD(Glib::RefPtr<Gdk::Event> get_last_event(Gdk::EventSequence* sequence),
gtk_gesture_get_last_event, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Gdk::Event> get_last_event(Gdk::EventSequence* sequence) const,
+ gtk_gesture_get_last_event, refreturn, constversion)
_WRAP_METHOD(bool get_point(Gdk::EventSequence* sequence, double& x, double& y) const,
gtk_gesture_get_point)
_WRAP_METHOD(bool get_bounding_box(Gdk::Rectangle& rect) const, gtk_gesture_get_bounding_box)
_WRAP_METHOD(bool get_bounding_box_center(double& x, double& y) const, gtk_gesture_get_bounding_box_center)
diff --git a/gtk/src/icontheme.ccg b/gtk/src/icontheme.ccg
index 590caaa4..dbbb0003 100644
--- a/gtk/src/icontheme.ccg
+++ b/gtk/src/icontheme.ccg
@@ -16,32 +16,4 @@
*/
#include <glibmm/vectorutils.h>
-
#include <gtk/gtk.h> //For gtk_icon_theme_error_get_type().
-
-
-namespace Gtk
-{
-
-void IconTheme::set_search_path(const std::vector<Glib::ustring>& path)
-{
- gtk_icon_theme_set_search_path(gobj(), const_cast<const
char**>(Glib::ArrayHandler<Glib::ustring>::vector_to_array(path).data ()), path.size());
-}
-
-std::vector<Glib::ustring> IconTheme::get_search_path() const
-{
- int temp_int = 0;
- gchar** temp_path = nullptr;
- gtk_icon_theme_get_search_path(const_cast<GtkIconTheme*>(gobj()), &temp_path, &temp_int);
- return Glib::ArrayHandler<Glib::ustring>::array_to_vector(temp_path, temp_int, Glib::OWNERSHIP_DEEP);
-}
-
-std::vector<int> IconTheme::get_icon_sizes(const Glib::ustring& icon_name) const
-{
- int* pArrayInts = gtk_icon_theme_get_icon_sizes(const_cast<GtkIconTheme*>(gobj()), icon_name.c_str());
-
- //pArrayInts is null-terminated.
- return Glib::ArrayHandler<int>::array_to_vector(pArrayInts, Glib::OWNERSHIP_SHALLOW);
-}
-
-} // namespace Gtk
diff --git a/gtk/src/icontheme.hg b/gtk/src/icontheme.hg
index 726629d2..515ccfca 100644
--- a/gtk/src/icontheme.hg
+++ b/gtk/src/icontheme.hg
@@ -67,19 +67,23 @@ public:
_WRAP_CREATE()
_WRAP_METHOD(static Glib::RefPtr<IconTheme> get_for_display(const Glib::RefPtr<Gdk::Display>& display),
gtk_icon_theme_get_for_display, refreturn)
- _WRAP_METHOD(void set_display(const Glib::RefPtr<Gdk::Display>& display), gtk_icon_theme_set_display)
- void set_search_path(const std::vector<Glib::ustring>& path);
- std::vector<Glib::ustring> get_search_path() const;
- _WRAP_METHOD(void append_search_path(const Glib::ustring& path), gtk_icon_theme_append_search_path)
- _WRAP_METHOD(void prepend_search_path(const Glib::ustring& path), gtk_icon_theme_prepend_search_path)
+#m4 _CONVERSION(`const std::vector<std::string>&',`const
char*-const*',`Glib::ArrayHandler<std::string>::vector_to_array($3).data()')
+ _WRAP_METHOD(void set_search_path(const std::vector<std::string>& path), gtk_icon_theme_set_search_path)
+#m4 _CONVERSION(`char**',`std::vector<std::string>',`Glib::ArrayHandler<std::string>::array_to_vector($3,
Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector<std::string> get_search_path() const, gtk_icon_theme_get_search_path)
+ _WRAP_METHOD(void add_search_path(const std::string& path), gtk_icon_theme_add_search_path)
+
+ _WRAP_METHOD(void set_resource_path(const std::vector<std::string>& path),
gtk_icon_theme_set_resource_path)
+ _WRAP_METHOD(std::vector<std::string> get_resource_path() const, gtk_icon_theme_get_resource_path)
_WRAP_METHOD(void add_resource_path(const std::string& path), gtk_icon_theme_add_resource_path)
- _WRAP_METHOD(void set_custom_theme(const Glib::ustring& theme_name), gtk_icon_theme_set_custom_theme)
+ _WRAP_METHOD(void set_theme_name(const Glib::ustring& theme_name), gtk_icon_theme_set_theme_name)
+ _WRAP_METHOD(Glib::ustring get_theme_name() const, gtk_icon_theme_get_theme_name)
_WRAP_METHOD(bool has_icon(const Glib::ustring& icon_name) const, gtk_icon_theme_has_icon)
- _WRAP_METHOD_DOCS_ONLY(gtk_icon_theme_get_icon_sizes)
- std::vector<int> get_icon_sizes(const Glib::ustring& icon_name) const;
+#m4 _CONVERSION(`int*',`std::vector<int>',`Glib::ArrayHandler<int>::array_to_vector($3,
Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(std::vector<int> get_icon_sizes(const Glib::ustring& icon_name) const,
gtk_icon_theme_get_icon_sizes)
#m4 _CONVERSION(`const std::vector<Glib::ustring>&',`const char*[]',`const_cast<const
gchar**>(Glib::ArrayHandler<Glib::ustring>::vector_to_array($3).data())')
_WRAP_METHOD(Glib::RefPtr<IconPaintable> lookup_icon(const Glib::ustring& icon_name,
@@ -96,15 +100,21 @@ public:
int size, int scale = 1, TextDirection direction = TextDirection::NONE,
IconLookupFlags flags = (IconLookupFlags)0) const, gtk_icon_theme_lookup_by_gicon, constversion)
-#m4 _CONVERSION(`GList*',`std::vector<Glib::ustring>',`Glib::ListHandler<Glib::ustring>::list_to_vector($3,
Glib::OWNERSHIP_DEEP)')
- /** Lists the icons in the current icon theme.
+#m4
_CONVERSION(`char**',`std::vector<Glib::ustring>',`Glib::ArrayHandler<Glib::ustring>::array_to_vector($3,
Glib::OWNERSHIP_DEEP)')
+ /** Lists the names of icons in the current icon theme.
*
* @return A vector holding the names of all the icons in the theme.
*/
- _WRAP_METHOD(std::vector<Glib::ustring> list_icons() const, gtk_icon_theme_list_icons)
+ _WRAP_METHOD(std::vector<Glib::ustring> get_icon_names() const, gtk_icon_theme_get_icon_names)
// no_default_handler because GtkIconThemeClass is private.
_WRAP_SIGNAL(void changed(), "changed", no_default_handler)
+
+ _WRAP_PROPERTY("display", Glib::RefPtr<Gdk::Display>)
+ _WRAP_PROPERTY("icon-names", std::vector<Glib::ustring>)
+ _WRAP_PROPERTY("search-path", std::vector<std::string>)
+ _WRAP_PROPERTY("resource-path", std::vector<std::string>)
+ _WRAP_PROPERTY("theme-name", Glib::ustring)
};
} // namespace Gtk
diff --git a/gtk/src/infobar.hg b/gtk/src/infobar.hg
index 56ed3834..582b1b2f 100644
--- a/gtk/src/infobar.hg
+++ b/gtk/src/infobar.hg
@@ -54,13 +54,6 @@ public:
_CTOR_DEFAULT
_IGNORE(gtk_info_bar_new, gtk_info_bar_new_with_buttons)
-//TODO: What types are these widgets really?
- _WRAP_METHOD(Widget* get_action_area(), gtk_info_bar_get_action_area)
- _WRAP_METHOD(const Widget* get_action_area() const, gtk_info_bar_get_action_area)
-
- _WRAP_METHOD(Widget* get_content_area(), gtk_info_bar_get_content_area)
- _WRAP_METHOD(const Widget* get_content_area() const, gtk_info_bar_get_content_area)
-
_WRAP_METHOD(void add_action_widget(Widget& child, int response_id), gtk_info_bar_add_action_widget)
_WRAP_METHOD(Button* add_button(const Glib::ustring& button_text, int response_id),
gtk_info_bar_add_button)
diff --git a/gtk/src/textview.hg b/gtk/src/textview.hg
index 03dc2d4e..4052dd92 100644
--- a/gtk/src/textview.hg
+++ b/gtk/src/textview.hg
@@ -149,7 +149,7 @@ public:
_WRAP_METHOD(bool starts_display_line(const TextBuffer::iterator& iter),
gtk_text_view_starts_display_line)
_WRAP_METHOD(bool move_visually(TextBuffer::iterator& iter, int count), gtk_text_view_move_visually)
- _WRAP_METHOD(bool im_context_filter_keypress(const Glib::RefPtr<Gdk::EventKey>& gdk_event),
gtk_text_view_im_context_filter_keypress)
+ _WRAP_METHOD(bool im_context_filter_keypress(const Glib::RefPtr<Gdk::Event>& event),
gtk_text_view_im_context_filter_keypress)
_WRAP_METHOD(void reset_im_context(), gtk_text_view_reset_im_context)
_WRAP_METHOD(Widget* get_gutter(TextWindowType win), gtk_text_view_get_gutter)
diff --git a/gtk/src/treedragdest.ccg b/gtk/src/treedragdest.ccg
index 1977862e..6fd8cc25 100644
--- a/gtk/src/treedragdest.ccg
+++ b/gtk/src/treedragdest.ccg
@@ -16,6 +16,5 @@
*/
#include <gtkmm/treepath.h>
-#include <gtkmm/selectiondata_private.h>
#include <gtk/gtk.h>
diff --git a/gtk/src/treedragdest.hg b/gtk/src/treedragdest.hg
index ee111117..23b61706 100644
--- a/gtk/src/treedragdest.hg
+++ b/gtk/src/treedragdest.hg
@@ -16,8 +16,9 @@
*/
#include <glibmm/interface.h>
+#include <glibmm/value.h>
#include <gtkmm/treemodel.h>
-#include <gtkmm/selectiondata.h>
+
_DEFS(gtkmm,gtk)
_PINCLUDE(glibmm/private/interface_p.h)
@@ -25,11 +26,9 @@ _PINCLUDE(glibmm/private/interface_p.h)
extern "C"
{
typedef struct _GtkTreeDragDestIface GtkTreeDragDestIface;
-typedef struct _GtkSelectionData GtkSelectionData;
}
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
namespace Gtk
{
@@ -42,17 +41,14 @@ class TreeDragDest : public Glib::Interface
public:
- _WRAP_METHOD(bool drag_data_received(const TreeModel::Path& dest, const SelectionData& selection_data),
gtk_tree_drag_dest_drag_data_received)
-
- _WRAP_METHOD(bool row_drop_possible(const TreeModel::Path& dest_path, const SelectionData& selection_data)
const, gtk_tree_drag_dest_row_drop_possible)
+ _WRAP_METHOD(bool drag_data_received(const TreeModel::Path& dest, const Glib::ValueBase& value),
gtk_tree_drag_dest_drag_data_received)
+ _WRAP_METHOD(bool row_drop_possible(const TreeModel::Path& dest_path, const Glib::ValueBase& value) const,
gtk_tree_drag_dest_row_drop_possible)
protected:
- _WRAP_VFUNC(bool drag_data_received(const TreeModel::Path& dest, const SelectionData& selection_data),
+ _WRAP_VFUNC(bool drag_data_received(const TreeModel::Path& dest, const Glib::ValueBase& value),
drag_data_received)
-
- _WRAP_VFUNC(bool row_drop_possible(const TreeModel::Path& dest, const SelectionData& selection_data) const,
+ _WRAP_VFUNC(bool row_drop_possible(const TreeModel::Path& dest, const Glib::ValueBase& value) const,
row_drop_possible)
};
} // namespace Gtk
-
diff --git a/gtk/src/treedragsource.ccg b/gtk/src/treedragsource.ccg
index 51710212..87b26b93 100644
--- a/gtk/src/treedragsource.ccg
+++ b/gtk/src/treedragsource.ccg
@@ -16,67 +16,4 @@
*/
#include <gtkmm/treepath.h>
-#include <gtkmm/selectiondata_private.h> //For SelectionData_WithoutOwnership
#include <gtk/gtk.h>
-
-
-namespace Gtk
-{
-
-//This vfunc wrapper is manually written, so that we can use a temporary instance for the SelectionData&
output parameter:
-
-gboolean TreeDragSource_Class::drag_data_get_vfunc_callback(GtkTreeDragSource* self, GtkTreePath* path,
GtkSelectionData* selection_data)
-{
- const auto obj = dynamic_cast<CppObjectType*>(
- Glib::ObjectBase::_get_current_wrapper((GObject*)self));
-
- // Non-gtkmmproc-generated custom classes implicitly call the default
- // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
- // generated classes can use this optimisation, which avoids the unnecessary
- // parameter conversions if there is no possibility of the virtual function
- // being overridden:
- if(obj && obj->is_derived_())
- {
- try // Trap C++ exceptions which would normally be lost because this is a C callback.
- {
- // Call the virtual member method, which derived classes might override.
- SelectionData_WithoutOwnership temp_instance(selection_data);
- return static_cast<int>(obj->drag_data_get_vfunc(Gtk::TreePath(path, true), temp_instance));
- }
- catch(...)
- {
- Glib::exception_handlers_invoke();
- }
- }
- else
- {
- const auto base = static_cast<BaseClassType*>(
- g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying
C interface).
-g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
-) );
-
- // Call the original underlying C function:
- if(base && base->drag_data_get)
- return (*base->drag_data_get)(self, path, selection_data);
- }
-
- typedef gboolean RType;
- return RType();
-}
-
-bool Gtk::TreeDragSource::drag_data_get_vfunc(const TreeModel::Path& path, SelectionData& selection_data)
const
-{
- const auto base = static_cast<BaseClassType*>(
- g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C
interface).
-g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
-) );
-
- if(base && base->drag_data_get)
- return
(*base->drag_data_get)(const_cast<GtkTreeDragSource*>(gobj()),const_cast<GtkTreePath*>((path).gobj()),
selection_data.gobj());
-
- typedef bool RType;
- return RType();
-}
-
-} //namespace Gtk
-
diff --git a/gtk/src/treedragsource.hg b/gtk/src/treedragsource.hg
index b6dca9f4..ed9e39f0 100644
--- a/gtk/src/treedragsource.hg
+++ b/gtk/src/treedragsource.hg
@@ -17,7 +17,8 @@
#include <glibmm/interface.h>
#include <gtkmm/treemodel.h>
-#include <gtkmm/selectiondata.h>
+#include <gdkmm/contentprovider.h>
+
_DEFS(gtkmm,gtk)
_PINCLUDE(glibmm/private/interface_p.h)
@@ -25,11 +26,9 @@ _PINCLUDE(glibmm/private/interface_p.h)
extern "C"
{
typedef struct _GtkTreeDragSourceIface GtkTreeDragSourceIface;
-typedef struct _GtkSelectionData GtkSelectionData;
}
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
namespace Gtk
{
@@ -43,28 +42,18 @@ class TreeDragSource : public Glib::Interface
public:
_WRAP_METHOD(bool row_draggable(const TreeModel::Path& path) const, gtk_tree_drag_source_row_draggable)
- _WRAP_METHOD(bool drag_data_get(const TreeModel::Path& path, SelectionData& selection_data),
gtk_tree_drag_source_drag_data_get)
+ // gtk_tree_drag_source_drag_data_get() returns a newly created GdkContentProvider.
+ _WRAP_METHOD(Glib::RefPtr<Gdk::ContentProvider> drag_data_get(const TreeModel::Path& path) const,
gtk_tree_drag_source_drag_data_get)
_WRAP_METHOD(bool drag_data_delete(const TreeModel::Path& path), gtk_tree_drag_source_drag_data_delete)
protected:
-#m4begin
-dnl// We want to hand-code these C vfunc callbacks,
- _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
- klass->drag_data_get = &drag_data_get_vfunc_callback;
- _SECTION(SECTION_PH_VFUNCS)
- static gboolean drag_data_get_vfunc_callback(GtkTreeDragSource* self, GtkTreePath* path,
GtkSelectionData* selection_data);
- _POP()
-#m4end
-
_WRAP_VFUNC(bool row_draggable(const TreeModel::Path& path) const, row_draggable)
-
- //We hand-code this so that we can use a temporary instance for the SelectionData& output parameter:
- virtual bool drag_data_get_vfunc(const TreeModel::Path& path, SelectionData& selection_data) const;
-
+#m4 _CONVERSION(`Glib::RefPtr<Gdk::ContentProvider>', `GdkContentProvider*', __CONVERT_REFPTR_TO_P)
+ _WRAP_VFUNC(Glib::RefPtr<Gdk::ContentProvider> drag_data_get(const TreeModel::Path& path) const,
+ drag_data_get, refreturn_ctype)
_WRAP_VFUNC(bool drag_data_delete(const TreeModel::Path& path), drag_data_delete)
};
} // namespace Gtk
-
diff --git a/gtk/src/treepath.ccg b/gtk/src/treepath.ccg
index 1748772c..6e49c204 100644
--- a/gtk/src/treepath.ccg
+++ b/gtk/src/treepath.ccg
@@ -120,11 +120,11 @@ TreePath::const_iterator TreePath::end() const
}
//static
-bool TreePath::get_from_selection_data(const SelectionData& selection_data, Glib::RefPtr<const TreeModel>&
model, TreePath& path)
+bool TreePath::get_row_drag_data(const Glib::ValueBase& value, Glib::RefPtr<const TreeModel>& model,
TreePath& path)
{
GtkTreeModel* src_model = nullptr;
GtkTreePath* src_path = nullptr;
- gboolean result = gtk_tree_get_row_drag_data(const_cast<GtkSelectionData*>(selection_data.gobj()),
&src_model, &src_path);
+ gboolean result = gtk_tree_get_row_drag_data(value.gobj(), &src_model, &src_path);
model = Glib::wrap(src_model, true /* take_copy=true */);
@@ -135,10 +135,10 @@ bool TreePath::get_from_selection_data(const SelectionData& selection_data, Glib
}
//static
-bool TreePath::get_from_selection_data(const SelectionData& selection_data, TreePath& path)
+bool TreePath::get_row_drag_data(const Glib::ValueBase& value, TreePath& path)
{
GtkTreePath* src_path = nullptr;
- gboolean result = gtk_tree_get_row_drag_data(const_cast<GtkSelectionData*>(selection_data.gobj()),
nullptr, &src_path);
+ gboolean result = gtk_tree_get_row_drag_data(value.gobj(), nullptr, &src_path);
//gtk_tree_get_row_drag_data gives us ownership of src_path.
path = Glib::wrap(src_path, false /* take_copy=false */);
@@ -146,10 +146,12 @@ bool TreePath::get_from_selection_data(const SelectionData& selection_data, Tree
return result;
}
-
-bool TreePath::set_in_selection_data(SelectionData& selection_data, const Glib::RefPtr<const TreeModel>&
model) const
+Glib::RefPtr<Gdk::ContentProvider> TreePath::create_row_drag_content(
+ const Glib::RefPtr<const TreeModel>& model) const
{
- return gtk_tree_set_row_drag_data(selection_data.gobj(), const_cast<GtkTreeModel*>(model->gobj()),
const_cast<GtkTreePath*>(gobj()));
+ // gtk_tree_create_row_drag_content() creates a new GdkContentProvider.
+ return Glib::wrap(gtk_tree_create_row_drag_content(
+ const_cast<GtkTreeModel*>(model->gobj()), const_cast<GtkTreePath*>(gobj())));
}
} // namespace Gtk
diff --git a/gtk/src/treepath.hg b/gtk/src/treepath.hg
index 0f02a5ff..8782f50b 100644
--- a/gtk/src/treepath.hg
+++ b/gtk/src/treepath.hg
@@ -23,7 +23,7 @@ _CONFIGINCLUDE(gtkmmconfig.h)
_DEFS(gtkmm,gtk)
#include <gtkmm/treemodel.h>
-#include <gtkmm/selectiondata.h>
+#include <gdkmm/contentprovider.h>
#ifdef GLIBMM_HAVE_SUN_REVERSE_ITERATOR
#include <cstddef> /* for std::ptrdiff_t */
#endif
@@ -148,37 +148,26 @@ public:
_IGNORE(gtk_tree_path_get_depth) //replaced by size()
_IGNORE(gtk_tree_path_get_indices_with_depth)
- /**
- * Obtains a Gtk::TreeModel and Gtk::TreeModel::Path from selection data of target type
- * "GTK_TREE_MODEL_ROW". Normally called from a drag_data_received handler.
- * This function can only be used if @a selection_data originates from the same
- * process that's calling this function, because a pointer to the tree model
- * is being passed around. If you aren't in the same process, then you'll
- * get memory corruption. In the Gtk::TreeDragDest drag_data_received signal handler,
- * you can assume that selection data of type "GTK_TREE_MODEL_ROW" is
- * from the current process.
+ /** Obtains a Gtk::TreeModel and Gtk::TreeModel::Path from @a value of target type
+ * GTK_TYPE_TREE_ROW_DATA.
*
- * @param selection_data A SelectionData
+ * @param value A Glib::ValueBase
* @param[out] model A Gtk::TreeModel
* @param[out] path A row in @a model
- * @return <tt>true</tt> if the @a selection_data had target type GTK_TREE_MODEL_ROW
+ * @return <tt>true</tt> if the @a value had target type GTK_TYPE_TREE_ROW_DATA
* and is otherwise valid.
*/
- static bool get_from_selection_data(const SelectionData& selection_data, Glib::RefPtr<const TreeModel>&
model, TreePath& path);
+ static bool get_row_drag_data(const Glib::ValueBase& value, Glib::RefPtr<const TreeModel>& model,
TreePath& path);
/// See description in the other overload.
- static bool get_from_selection_data(const SelectionData& selection_data, TreePath& path);
+ static bool get_row_drag_data(const Glib::ValueBase& value, TreePath& path);
- /**
- * Sets selection data of target type "GTK_TREE_MODEL_ROW". Normally used
- * in a drag_data_get signal handler.
+ /** Creates a content provider for dragging the path from @a model.
*
- * @param[in,out] selection_data Some SelectionData
- * @param model A Gtk::TreeModel
- * @return <tt>true</tt> if the @a selection_data had the proper target type
- * to allow us to set a tree row.
+ * @param model A Gtk::TreeModel.
+ * @return A Gdk::ContentProvider.
*/
- bool set_in_selection_data(SelectionData& selection_data, const Glib::RefPtr<const TreeModel>& model)
const;
+ Glib::RefPtr<Gdk::ContentProvider> create_row_drag_content(const Glib::RefPtr<const TreeModel>& model)
const;
};
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/gtk/src/widget.hg b/gtk/src/widget.hg
index fa23c79a..f6f9cbe9 100644
--- a/gtk/src/widget.hg
+++ b/gtk/src/widget.hg
@@ -30,14 +30,16 @@ _CONFIGINCLUDE(gtkmmconfig.h)
#include <gtkmm/object.h>
#include <gtkmm/buildable.h>
#include <gtkmm/constrainttarget.h>
-#include <gdkmm/events.h>
#include <gdkmm/types.h>
#include <gtkmm/enums.h>
#include <gdkmm/display.h>
#include <gdkmm/clipboard.h>
+#include <gdkmm/cursor.h>
+#include <gdkmm/rectangle.h>
#include <gtkmm/requisition.h>
#include <gtkmm/stylecontext.h>
#include <giomm/actiongroup.h>
+#include <cairomm/region.h>
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/object_p.h)
@@ -166,7 +168,6 @@ public:
_IGNORE(gtk_widget_can_activate_accel)
//Probably not useful. Too C-specific: _WRAP_METHOD(bool can_activate_accel(guint signal_id) const,
gtk_widget_can_activate_accel)
- _WRAP_METHOD(bool event(const Glib::RefPtr<Gdk::Event>& gdk_event), gtk_widget_event)
_WRAP_METHOD(bool activate(), gtk_widget_activate)
// gtk_widget_reparent() has been removed, but we want to keep Gtk::Widget::reparent().
@@ -582,10 +583,16 @@ public:
_WRAP_METHOD(bool should_layout() const, gtk_widget_should_layout)
+ _WRAP_METHOD(Glib::ustring get_css_name() const, gtk_widget_get_css_name)
_WRAP_METHOD(void add_css_class(const Glib::ustring& css_class), gtk_widget_add_css_class)
_WRAP_METHOD(void remove_css_class(const Glib::ustring& css_class), gtk_widget_remove_css_class)
_WRAP_METHOD(bool has_css_class(const Glib::ustring& css_class) const, gtk_widget_has_css_class)
+#m4
_CONVERSION(`char**',`std::vector<Glib::ustring>',`Glib::ArrayHandler<Glib::ustring>::array_to_vector($3,
Glib::OWNERSHIP_DEEP)')
+ _WRAP_METHOD(std::vector<Glib::ustring> get_css_classes() const, gtk_widget_get_css_classes)
+#m4 _CONVERSION(`const std::vector<Glib::ustring>&',`const
char**',`Glib::ArrayHandler<Glib::ustring>::vector_to_array($3).data ()')
+ _WRAP_METHOD(void set_css_classes(const std::vector<Glib::ustring>& classes), gtk_widget_set_css_classes)
+
_WRAP_SIGNAL(void show(),"show")
_WRAP_SIGNAL(void hide(),"hide", custom_c_callback)
@@ -680,6 +687,7 @@ dnl
_WRAP_PROPERTY("overflow", Overflow, newin "3,96")
_WRAP_PROPERTY("scale-factor", int)
_WRAP_PROPERTY("css-name", Glib::ustring)
+ _WRAP_PROPERTY("css-classes", std::vector<Glib::ustring>)
_WRAP_PROPERTY("layout-manager", Glib::RefPtr<LayoutManager>)
protected:
diff --git a/gtk/src/window.ccg b/gtk/src/window.ccg
index a7b089de..f57893f5 100644
--- a/gtk/src/window.ccg
+++ b/gtk/src/window.ccg
@@ -70,8 +70,8 @@ Window& Window::operator=(Window&& src) noexcept
return *this;
}
-Window::Window(WindowType type)
-: _CONSTRUCT("type", static_cast<GtkWindowType>(type))
+Window::Window()
+: _CONSTRUCT()
{
signal_hide().connect(sigc::mem_fun(*this, &Window::on_window_hide));
}
diff --git a/gtk/src/window.hg b/gtk/src/window.hg
index 6d9826f3..4af82997 100644
--- a/gtk/src/window.hg
+++ b/gtk/src/window.hg
@@ -19,6 +19,7 @@
#include <vector>
#include <glibmm/object.h>
+#include <gdkmm/surface.h>
#include <gdkmm/texture.h>
#include <gtkmm/bin.h>
#include <gtkmm/native.h>
@@ -76,10 +77,9 @@ public:
Window(Window&& src) noexcept;
Window& operator=(Window&& src) noexcept;
- explicit Window(WindowType type = WindowType::TOPLEVEL);
+ explicit Window();
_IGNORE(gtk_window_new)
- _WRAP_PROPERTY("type", WindowType)
_WRAP_PROPERTY("title", Glib::ustring)
_WRAP_PROPERTY("startup-id", Glib::ustring)
_WRAP_PROPERTY("resizable", bool)
@@ -283,8 +283,6 @@ dnl
_WRAP_METHOD(bool has_group() const, gtk_window_has_group)
- _WRAP_METHOD(WindowType get_window_type() const, gtk_window_get_window_type)
-
_WRAP_METHOD(Glib::RefPtr<Application> get_application(), gtk_window_get_application, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Application> get_application() const, gtk_window_get_application,
refreturn)
diff --git a/tools/m4/convert_gdk.m4 b/tools/m4/convert_gdk.m4
index c61af901..d8b401ef 100644
--- a/tools/m4/convert_gdk.m4
+++ b/tools/m4/convert_gdk.m4
@@ -117,6 +117,7 @@ _CONVERSION(`const Glib::RefPtr<Cursor>&',`GdkCursor*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<const Cursor>&',`GdkCursor*',__CONVERT_CONST_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Gdk::Cursor>&',`GdkCursor*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<const Gdk::Cursor>&',`GdkCursor*',__CONVERT_CONST_REFPTR_TO_P)
+_CONVERSION(`const Glib::RefPtr<const PopupLayout>&',`GdkPopupLayout*',__CONVERT_CONST_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Gdk::Surface>&',`GdkSurface*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Surface>&',`GdkSurface*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<GLContext>&',`GdkGLContext*',__CONVERT_REFPTR_TO_P)
@@ -163,6 +164,7 @@ _CONVERSION(`Gdk::Rectangle*',`GdkRectangle*',`Glib::unwrap($3)')
_CONVERSION(`const Gdk::Rectangle*',`GdkRectangle*',`Glib::unwrap(const_cast<Gdk::Rectangle*>($3))')
_CONVERSION(`GdkRectangle*',`Gdk::Rectangle*',`&Glib::wrap($3)')
_CONVERSION(`GdkRectangle*',`const Gdk::Rectangle*',`&Glib::wrap($3)')
+_CONVERSION(`const GdkRectangle*',`Rectangle',`Rectangle($3)')
# Special treatment for the Sun Forte compiler
#_CONVERSION(const Glib::RefPtr<const Gdk::Surface>&,GdkSurface*,__CONVERT_CONST_REFPTR_TO_P)
@@ -179,6 +181,7 @@ _CONVERSION(`const Glib::RefPtr<const Gdk::Bitmap>&', `GdkBitmap*',__CONVERT_CON
#_CONVERSION(`const Glib::RefPtr<const Display>&', `GdkDrawable*',__CONVERT_CONST_REFPTR_TO_P_SUN(Drawable))
+_CONVERSION(`GdkPopupLayout*',`Glib::RefPtr<PopupLayout>', `Glib::wrap($3)')
_CONVERSION(`GdkSurface*',`Glib::RefPtr<Surface>', `Glib::wrap($3)')
_CONVERSION(`GdkSurface*',`Glib::RefPtr<const Surface>', `Glib::wrap($3)')
_CONVERSION(`GdkSurface*',`Glib::RefPtr<Gdk::Surface>', `Glib::wrap($3)')
@@ -217,6 +220,7 @@ _CONVERSION(`GdkDevice*',`Glib::RefPtr<Gdk::Device>', `Glib::wrap($3)')
_CONVERSION(`GdkDevice*',`Glib::RefPtr<const Device>', `Glib::wrap($3)')
_CONVERSION(`GdkDevice*',`Glib::RefPtr<const Gdk::Device>', `Glib::wrap($3)')
+_CONVERSION(`GdkDeviceTool*',`Glib::RefPtr<DeviceTool>', `Glib::wrap($3)')
_CONVERSION(`GdkDeviceTool*',`Glib::RefPtr<Gdk::DeviceTool>', `Glib::wrap($3)')
_CONVERSION(`GdkPaintable*',`Glib::RefPtr<Paintable>', `Glib::wrap($3)')
@@ -300,8 +304,10 @@ _CONVERSION(`const Glib::RefPtr<Gdk::EventButton>&',`GdkEventButton*',__CONVERT_
_CONVERSION(`const Glib::RefPtr<Gdk::EventKey>&',`GdkEventKey*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`Gdk::EventSequence*',`GdkEventSequence*',`reinterpret_cast<$2>($3)')
_CONVERSION(`GdkEventSequence*',`Gdk::EventSequence*',`reinterpret_cast<$2>($3)')
+_CONVERSION(`GdkEventSequence*',`const EventSequence*',`reinterpret_cast<$2>($3)')
_CONVERSION(`GdkDrag*',`Glib::RefPtr<Drag>',Glib::wrap($3))
_CONVERSION(`GdkDrag*',`Glib::RefPtr<Gdk::Drag>',Glib::wrap($3))
+_CONVERSION(`GdkDrop*',`Glib::RefPtr<Drop>',Glib::wrap($3))
_CONVERSION(`GdkDrop*',`Glib::RefPtr<Gdk::Drop>',Glib::wrap($3))
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index db1413c1..e8c7d13e 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -93,10 +93,8 @@ _CONV_INCLASS_ENUM(Gtk,TreeView,DropPosition)
_CONV_INCLASS_ENUM(Gtk,TreeView,GridLines)
_CONV_ENUM(Gtk,UpdateType)
_CONV_ENUM(Gtk,Visibility)
-_CONV_ENUM(Gtk,WindowType)
_CONV_ENUM(Gtk,WrapMode)
_CONV_INCLASS_ENUM(Gtk,FileChooser,Action)
-_CONV_INCLASS_ENUM(Gtk,FileChooser,Confirmation)
_CONV_INCLASS_ENUM(Gtk,FileFilter,Flags)
_CONV_ENUM(Gtk,IconLookupFlags)
_CONV_ENUM(Gtk,IconThemeError)
diff --git a/tools/m4/convert_gtkmm.m4 b/tools/m4/convert_gtkmm.m4
index fe344119..9c5353c4 100644
--- a/tools/m4/convert_gtkmm.m4
+++ b/tools/m4/convert_gtkmm.m4
@@ -16,7 +16,6 @@
## License along with this library; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-include(class_gdkevent.m4)
include(class_gtkobject.m4)
include(convert_base.m4)
include(convert_gtk.m4)
diff --git a/tools/m4/filelist.am b/tools/m4/filelist.am
index 4bb3d4ec..66d842ff 100644
--- a/tools/m4/filelist.am
+++ b/tools/m4/filelist.am
@@ -17,8 +17,7 @@
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
files_codegen_m4 = \
- class_gdkevent.m4 \
- class_gtkobject.m4 \
+ class_gtkobject.m4 \
convert.m4 \
convert_gdk.m4 \
convert_gtk.m4 \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]