[gtkmm] Menu::popup and ComboBox::popup(): Add optional device parameter.



commit 0df030d9e0c2ea590520dc1bdfb5984e8ddaf786
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Jun 16 22:21:13 2010 +0200

    Menu::popup and ComboBox::popup(): Add optional device parameter.
    
    * gtk/src/combobox.hg: popup_for_device(): Rename to popup(). The extra
    parameter is enough.
    * gtk/src/menu.[hg|ccg]: popup(): Add an extra optional Device parameter to
    all 3 method overloads, using the new gtk_menu_popup_for_device() function
    when appropriate.

 ChangeLog           |   10 ++++++++++
 gtk/src/combobox.hg |    2 +-
 gtk/src/menu.ccg    |   21 +++++++++++++++------
 gtk/src/menu.hg     |   10 +++++-----
 4 files changed, 31 insertions(+), 12 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4ed2e7f..9aa7654 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2010-06-16  Murray Cumming  <murrayc murrayc com>
 
+	Menu::popup and ComboBox::popup(): Add optional device parameter.
+
+	* gtk/src/combobox.hg: popup_for_device(): Rename to popup(). The extra 
+	parameter is enough.
+	* gtk/src/menu.[hg|ccg]: popup(): Add an extra optional Device parameter to 
+	all 3 method overloads, using the new gtk_menu_popup_for_device() function 
+	when appropriate.
+
+2010-06-16  Murray Cumming  <murrayc murrayc com>
+
 	Added Assistant::commit() and Entry::reset_im_context().
 
 	* gtk/src/assistant.hg: Added commit(), new in gtk+ 2.22.
diff --git a/gtk/src/combobox.hg b/gtk/src/combobox.hg
index 97e5f50..5367023 100644
--- a/gtk/src/combobox.hg
+++ b/gtk/src/combobox.hg
@@ -140,7 +140,7 @@ public:
   _WRAP_METHOD(SensitivityType get_button_sensitivity() const, gtk_combo_box_get_button_sensitivity)
 
   _WRAP_METHOD(void popup(), gtk_combo_box_popup)
-  _WRAP_METHOD(void popup_for_device(const Glib::RefPtr<Gdk::Device>& device), gtk_combo_box_popup_for_device)
+  _WRAP_METHOD(void popup(const Glib::RefPtr<Gdk::Device>& device), gtk_combo_box_popup_for_device)
   _WRAP_METHOD(void popdown(), gtk_combo_box_popdown)
 
   _WRAP_METHOD(Glib::RefPtr<Atk::Object> get_popup_accessible(), gtk_combo_box_get_popup_accessible, ifdef GTKMM_ATKMM_ENABLED)
diff --git a/gtk/src/menu.ccg b/gtk/src/menu.ccg
index 4cc9306..b486385 100644
--- a/gtk/src/menu.ccg
+++ b/gtk/src/menu.ccg
@@ -49,23 +49,32 @@ static void SignalProxy_PopupPosition_gtk_callback(GtkMenu*, int* x, int* y, gbo
 namespace Gtk
 {
 
-void Menu::popup(const SlotPositionCalc& position_calc_slot, guint button, guint32 activate_time)
+void Menu::popup(const SlotPositionCalc& position_calc_slot, guint button, guint32 activate_time, const Glib::RefPtr<Gdk::Device>& device)
 {
   // Tell GTK+ to call the static function with the slot's address as the extra
   // data, so that the static function can then call the sigc::slot:
-  gtk_menu_popup(gobj(), 0, 0, &SignalProxy_PopupPosition_gtk_callback, const_cast<SlotPositionCalc*>(&position_calc_slot), button, activate_time);
+  if(!device)
+    gtk_menu_popup(gobj(), 0, 0, &SignalProxy_PopupPosition_gtk_callback, const_cast<SlotPositionCalc*>(&position_calc_slot), button, activate_time);
+  else
+    gtk_menu_popup_for_device(gobj(), device->gobj(), 0, 0, &SignalProxy_PopupPosition_gtk_callback, const_cast<SlotPositionCalc*>(&position_calc_slot), button, activate_time);
 }
 
-void Menu::popup(MenuShell& parent_menu_shell, MenuItem& parent_menu_item, const SlotPositionCalc& position_calc_slot, guint button, guint32 activate_time)
+void Menu::popup(MenuShell& parent_menu_shell, MenuItem& parent_menu_item, const SlotPositionCalc& position_calc_slot, guint button, guint32 activate_time, const Glib::RefPtr<Gdk::Device>& device)
 {
   // Tell GTK+ to call the static function with the slot's address as the extra
   // data, so that the static function can then call the sigc::slot:
-  gtk_menu_popup(gobj(), parent_menu_shell.Gtk::Widget::gobj(), parent_menu_item.Gtk::Widget::gobj(), &SignalProxy_PopupPosition_gtk_callback, const_cast<SlotPositionCalc*>(&position_calc_slot), button, activate_time);
+  if(!device)
+    gtk_menu_popup(gobj(), parent_menu_shell.Gtk::Widget::gobj(), parent_menu_item.Gtk::Widget::gobj(), &SignalProxy_PopupPosition_gtk_callback, const_cast<SlotPositionCalc*>(&position_calc_slot), button, activate_time);
+  else
+    gtk_menu_popup(gobj(), device->gobj(), parent_menu_shell.Gtk::Widget::gobj(), parent_menu_item.Gtk::Widget::gobj(), &SignalProxy_PopupPosition_gtk_callback, const_cast<SlotPositionCalc*>(&position_calc_slot), button, activate_time);
 }
 
-void Menu::popup(guint button, guint32 activate_time)
+void Menu::popup(guint button, guint32 activate_time, const Glib::RefPtr<Gdk::Device>& device)
 {
-  gtk_menu_popup(gobj(), 0, 0, 0, 0, button, activate_time);
+  if(!device)
+    gtk_menu_popup(gobj(), 0, 0, 0, 0, button, activate_time);
+  else
+    gtk_menu_popup(gobj(), device->gobj(), 0, 0, 0, 0, button, activate_time);
 }
 
 void Menu::reorder_child(const MenuItem& child, int position)
diff --git a/gtk/src/menu.hg b/gtk/src/menu.hg
index 387c468..1bb40f0 100644
--- a/gtk/src/menu.hg
+++ b/gtk/src/menu.hg
@@ -53,9 +53,9 @@ public:
    * void on_popup_menu_position(int& x, int& y, bool& push_in);
    */
   typedef sigc::slot<void, int&, int&, bool&> SlotPositionCalc;
-             
-  void popup(MenuShell& parent_menu_shell, MenuItem& parent_menu_item, const SlotPositionCalc& slot, guint button, guint32 activate_time);
-  _IGNORE(gtk_menu_popup)
+  
+  void popup(MenuShell& parent_menu_shell, MenuItem& parent_menu_item, const SlotPositionCalc& slot, guint button, guint32 activate_time, const Glib::RefPtr<Gdk::Device>& device = Glib::RefPtr<Gdk::Device>());
+  _IGNORE(gtk_menu_popup, gtk_menu_popup_for_device)
 
   /** Displays a menu and makes it available for selection.  Applications can use
    * this function to display context-sensitive menus.
@@ -72,14 +72,14 @@ public:
    * @param button The mouse button which was pressed to initiate the event.
    * @param activate_time The time at which the activation event occurred.
    */
-  void popup(const SlotPositionCalc& position_calc_slot, guint button, guint32 activate_time);
+  void popup(const SlotPositionCalc& position_calc_slot, guint button, guint32 activate_time, const Glib::RefPtr<Gdk::Device>& device = Glib::RefPtr<Gdk::Device>());
 
   /** Displays a menu and makes it available for selection.
    * Applications can use this function to display context-sensitive menus, at the current pointer position.
    * @param button The button which was pressed to initiate the event.
    * @param activate_time The time at which the activation event occurred.
    */
-  void popup(guint button, guint32 activate_time);
+  void popup(guint button, guint32 activate_time, const Glib::RefPtr<Gdk::Device>& device = Glib::RefPtr<Gdk::Device>());
 
   _WRAP_METHOD(void reposition(), gtk_menu_reposition)
 



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