[gtkmm-documentation] Gdk::DragContext has been split into Gdk::Drag and Gdk::Drop



commit 52612987ca92fb8b8a94bba45fbab3fd87793c68
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Tue Jul 3 15:07:52 2018 +0200

    Gdk::DragContext has been split into Gdk::Drag and Gdk::Drop

 examples/book/drag_and_drop/dndwindow.cc  | 10 ++++-----
 examples/book/drag_and_drop/dndwindow.h   |  8 +++----
 examples/book/entry/icon/examplewindow.cc |  3 +--
 examples/book/entry/icon/examplewindow.h  |  3 +--
 examples/others/dnd/dndwindow.cc          | 36 +++++++++++++++----------------
 examples/others/dnd/dndwindow.h           | 22 +++++++++----------
 6 files changed, 40 insertions(+), 42 deletions(-)
---
diff --git a/examples/book/drag_and_drop/dndwindow.cc b/examples/book/drag_and_drop/dndwindow.cc
index 099e2c3..ee3d4c8 100644
--- a/examples/book/drag_and_drop/dndwindow.cc
+++ b/examples/book/drag_and_drop/dndwindow.cc
@@ -58,8 +58,8 @@ DnDWindow::~DnDWindow()
 }
 
 void DnDWindow::on_button_drag_data_get(
-        const Glib::RefPtr<Gdk::DragContext>&,
-        Gtk::SelectionData& selection_data, guint)
+        const Glib::RefPtr<Gdk::Drag>&,
+        Gtk::SelectionData& selection_data)
 {
   selection_data.set(selection_data.get_target(), 8 /* 8 bits format */,
           (const guchar*)"I'm Data!",
@@ -67,8 +67,8 @@ void DnDWindow::on_button_drag_data_get(
 }
 
 void DnDWindow::on_label_drop_drag_data_received(
-        const Glib::RefPtr<Gdk::DragContext>& context,
-        const Gtk::SelectionData& selection_data, guint time)
+        const Glib::RefPtr<Gdk::Drop>& drop,
+        const Gtk::SelectionData& selection_data)
 {
   const int length = selection_data.get_length();
   if((length >= 0) && (selection_data.get_format() == 8))
@@ -77,5 +77,5 @@ void DnDWindow::on_label_drop_drag_data_received(
         << "\" in label " << std::endl;
   }
 
-  context->drag_finish(false, time);
+  drop->failed();
 }
diff --git a/examples/book/drag_and_drop/dndwindow.h b/examples/book/drag_and_drop/dndwindow.h
index 1cccc8a..e66d22d 100644
--- a/examples/book/drag_and_drop/dndwindow.h
+++ b/examples/book/drag_and_drop/dndwindow.h
@@ -32,11 +32,11 @@ public:
 protected:
   //Signal handlers:
   void on_button_drag_data_get(
-          const Glib::RefPtr<Gdk::DragContext>& context,
-          Gtk::SelectionData& selection_data, guint time);
+          const Glib::RefPtr<Gdk::Drag>& drag,
+          Gtk::SelectionData& selection_data);
   void on_label_drop_drag_data_received(
-          const Glib::RefPtr<Gdk::DragContext>& context,
-          const Gtk::SelectionData& selection_data, guint time);
+          const Glib::RefPtr<Gdk::Drop>& drop,
+          const Gtk::SelectionData& selection_data);
 
   //Member widgets:
   Gtk::Box m_HBox;
diff --git a/examples/book/entry/icon/examplewindow.cc b/examples/book/entry/icon/examplewindow.cc
index 1e65b2f..826e95b 100644
--- a/examples/book/entry/icon/examplewindow.cc
+++ b/examples/book/entry/icon/examplewindow.cc
@@ -44,8 +44,7 @@ ExampleWindow::~ExampleWindow()
 {
 }
 
-void ExampleWindow::on_icon_pressed(Gtk::Entry::IconPosition /* icon_pos */,
-  const Glib::RefPtr<const Gdk::EventButton>& /* event */)
+void ExampleWindow::on_icon_pressed(Gtk::Entry::IconPosition /* icon_pos */)
 {
   std::cout << "Icon pressed." << std::endl;
 }
diff --git a/examples/book/entry/icon/examplewindow.h b/examples/book/entry/icon/examplewindow.h
index 2121ff2..d873961 100644
--- a/examples/book/entry/icon/examplewindow.h
+++ b/examples/book/entry/icon/examplewindow.h
@@ -27,8 +27,7 @@ public:
 
 protected:
   //Signal handlers:
-  void on_icon_pressed(Gtk::Entry::IconPosition icon_pos,
-    const Glib::RefPtr<const Gdk::EventButton>& event);
+  void on_icon_pressed(Gtk::Entry::IconPosition icon_pos);
   void on_button_close();
 
   //Child widgets:
diff --git a/examples/others/dnd/dndwindow.cc b/examples/others/dnd/dndwindow.cc
index 5fe0bfe..dd5c9ed 100644
--- a/examples/others/dnd/dndwindow.cc
+++ b/examples/others/dnd/dndwindow.cc
@@ -100,7 +100,7 @@ DnDWindow::~DnDWindow()
 }
 
 
-void DnDWindow::on_label_drop_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context, const 
Gtk::SelectionData& selection_data, guint time)
+void DnDWindow::on_label_drop_drag_data_received(const Glib::RefPtr<Gdk::Drop>& drop, const 
Gtk::SelectionData& selection_data)
 {
   const int length = selection_data.get_length();
   const guchar* data = selection_data.get_data();
@@ -110,10 +110,10 @@ void DnDWindow::on_label_drop_drag_data_received(const Glib::RefPtr<Gdk::DragCon
     g_print ("Received \"%s\" in label\n", (gchar *)data);
   }
 
-  context->drag_finish(false, time);
+  drop->failed();
 }
 
-bool DnDWindow::on_label_popup_drag_motion(const Glib::RefPtr<Gdk::DragContext>&, int, int, guint)
+bool DnDWindow::on_label_popup_drag_motion(const Glib::RefPtr<Gdk::Drop>&, int, int)
 {
   if(!m_popup_timer)
     m_popup_timer = Glib::signal_timeout().connect( sigc::mem_fun(*this, &DnDWindow::on_popup_timeout), 500);
@@ -121,7 +121,7 @@ bool DnDWindow::on_label_popup_drag_motion(const Glib::RefPtr<Gdk::DragContext>&
   return true;
 }
 
-void DnDWindow::on_label_popup_drag_leave(const Glib::RefPtr<Gdk::DragContext>&, guint)
+void DnDWindow::on_label_popup_drag_leave(const Glib::RefPtr<Gdk::Drop>&)
 {
  if(m_in_popup)
  {
@@ -134,7 +134,7 @@ void DnDWindow::on_label_popup_drag_leave(const Glib::RefPtr<Gdk::DragContext>&,
  }
 }
 
-void DnDWindow::on_image_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context, const 
Gtk::SelectionData& selection_data, guint time)
+void DnDWindow::on_image_drag_data_received(const Glib::RefPtr<Gdk::Drop>& drop, const Gtk::SelectionData& 
selection_data)
 {
   const int length = selection_data.get_length();
   const guchar* data = selection_data.get_data();
@@ -144,10 +144,10 @@ void DnDWindow::on_image_drag_data_received(const Glib::RefPtr<Gdk::DragContext>
     g_print ("Received \"%s\" in trashcan\n", (gchar*)data);
   }
 
-  context->drag_finish(false, time);
+  drop->failed();
 }
 
-bool DnDWindow::on_image_drag_motion(const Glib::RefPtr<Gdk::DragContext>& context, int, int, guint time)
+bool DnDWindow::on_image_drag_motion(const Glib::RefPtr<Gdk::Drop>& drop, int, int)
 {
   if(!m_have_drag)
   {
@@ -155,45 +155,45 @@ bool DnDWindow::on_image_drag_motion(const Glib::RefPtr<Gdk::DragContext>& conte
     m_Image.set(m_trashcan_open);
   }
 
-  auto source_widget = Gtk::Widget::drag_get_source_widget(context);
+  auto source_widget = Gtk::Widget::drag_get_source_widget(drop->get_drag());
   g_print ("motion, source %s\n", source_widget ?
            G_OBJECT_TYPE_NAME (source_widget) :
            "NULL");
 
-  for(const auto& name : context->get_formats()->get_mime_types())
+  for(const auto& name : drop->get_formats()->get_mime_types())
   {
     g_print ("%s\n", name.c_str());
   }
 
-  context->drag_status(context->get_suggested_action(), time);
+  drop->status(drop->get_drag()->get_suggested_action());
   return true;
 }
 
-void DnDWindow::on_image_drag_leave(const Glib::RefPtr<Gdk::DragContext>&, guint)
+void DnDWindow::on_image_drag_leave(const Glib::RefPtr<Gdk::Drop>&)
 {
   g_print("leave\n");
   m_have_drag = false;
   m_Image.set(m_trashcan_closed);
 }
 
-bool DnDWindow::on_image_drag_drop(const Glib::RefPtr<Gdk::DragContext>& context, int, int, guint time)
+bool DnDWindow::on_image_drag_drop(const Glib::RefPtr<Gdk::Drop>& drop, int, int)
 {
   g_print("drop\n");
   m_have_drag = false;
 
   m_Image.set(m_trashcan_closed);
 
-  const auto targets = context->get_formats()->get_mime_types();
+  const auto targets = drop->get_formats()->get_mime_types();
   if(!targets.empty())
   {
-    m_Image.drag_get_data(context, targets[0], time);
+    m_Image.drag_get_data(drop, targets[0]);
   }
 
   return true;
 }
 
 
-void DnDWindow::on_button_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, Gtk::SelectionData& 
selection_data, guint)
+void DnDWindow::on_button_drag_data_get(const Glib::RefPtr<Gdk::Drag>&, Gtk::SelectionData& selection_data)
 {
   if(selection_data.get_target() == "application/x-rootwin-drop")
     g_print ("I was dropped on the rootwin\n");
@@ -202,7 +202,7 @@ void DnDWindow::on_button_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, G
                        8 /* 8-bits format */, (const guchar*)"I'm Data!", 9 /* The length of I'm Data in 
bytes */);
 }
 
-void DnDWindow::on_button_drag_data_delete(const Glib::RefPtr<Gdk::DragContext>&)
+void DnDWindow::on_button_drag_data_delete(const Glib::RefPtr<Gdk::Drag>&)
 {
   g_print ("Delete the data!\n");
 }
@@ -258,7 +258,7 @@ void DnDWindow::create_popup()
   m_PopupWindow.add(*pGrid);
 }
 
-bool DnDWindow::on_popup_button_drag_motion(const Glib::RefPtr<Gdk::DragContext>&, int, int, guint)
+bool DnDWindow::on_popup_button_drag_motion(const Glib::RefPtr<Gdk::Drop>&, int, int)
 {
   if(!m_in_popup)
   {
@@ -273,7 +273,7 @@ bool DnDWindow::on_popup_button_drag_motion(const Glib::RefPtr<Gdk::DragContext>
   return true;
 }
 
-void DnDWindow::on_popup_button_drag_leave(const Glib::RefPtr<Gdk::DragContext>&, guint)
+void DnDWindow::on_popup_button_drag_leave(const Glib::RefPtr<Gdk::Drop>&)
 {
  if(m_in_popup)
  {
diff --git a/examples/others/dnd/dndwindow.h b/examples/others/dnd/dndwindow.h
index 4d98a5f..d43dea5 100644
--- a/examples/others/dnd/dndwindow.h
+++ b/examples/others/dnd/dndwindow.h
@@ -31,23 +31,23 @@ protected:
   void create_popup();
 
   //Signal handlers:
-  void on_label_drop_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context, const 
Gtk::SelectionData& selection_data, guint time);
-  bool on_label_popup_drag_motion(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, guint time);
-  void on_label_popup_drag_leave(const Glib::RefPtr<Gdk::DragContext>& context, guint time);
+  void on_label_drop_drag_data_received(const Glib::RefPtr<Gdk::Drop>& drop, const Gtk::SelectionData& 
selection_data);
+  bool on_label_popup_drag_motion(const Glib::RefPtr<Gdk::Drop>& drop, int x, int y);
+  void on_label_popup_drag_leave(const Glib::RefPtr<Gdk::Drop>& drop);
 
-  void on_image_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context, const Gtk::SelectionData& 
selection_data, guint time);
-  bool on_image_drag_motion(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, guint time);
-  void on_image_drag_leave(const Glib::RefPtr<Gdk::DragContext>& context, guint time);
-  bool on_image_drag_drop(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, guint time);
+  void on_image_drag_data_received(const Glib::RefPtr<Gdk::Drop>& drop, const Gtk::SelectionData& 
selection_data);
+  bool on_image_drag_motion(const Glib::RefPtr<Gdk::Drop>& drop, int x, int y);
+  void on_image_drag_leave(const Glib::RefPtr<Gdk::Drop>& drop);
+  bool on_image_drag_drop(const Glib::RefPtr<Gdk::Drop>& drop, int x, int y);
 
-  void on_button_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& context, Gtk::SelectionData& 
selection_data, guint time);
-  void on_button_drag_data_delete(const Glib::RefPtr<Gdk::DragContext>& context);
+  void on_button_drag_data_get(const Glib::RefPtr<Gdk::Drag>& drag, Gtk::SelectionData& selection_data);
+  void on_button_drag_data_delete(const Glib::RefPtr<Gdk::Drag>& drag);
 
   bool on_popdown_timeout();
   bool on_popup_timeout();
 
-  bool on_popup_button_drag_motion(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, guint time);
-  void on_popup_button_drag_leave(const Glib::RefPtr<Gdk::DragContext>& context, guint time);
+  bool on_popup_button_drag_motion(const Glib::RefPtr<Gdk::Drop>& drop, int x, int y);
+  void on_popup_button_drag_leave(const Glib::RefPtr<Gdk::Drop>& drop);
 
 
   //Member widgets:


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