[gtkmm-documentation] Fix make check when gtkmm uses Gdk::Event
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation] Fix make check when gtkmm uses Gdk::Event
- Date: Wed, 31 May 2017 18:46:43 +0000 (UTC)
commit ddd0097413d929c3b4a7e105a20fc341b4040d8a
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Wed May 31 20:44:15 2017 +0200
Fix make check when gtkmm uses Gdk::Event
Gtkmm classes now use Gdk::Event and its subclasses instead of GtkEvent.
Affects mostly signal handlers. Bug 135978
Remove calls to Widget::add/set/get_events(). Those methods have been removed.
examples/book/clipboard/ideal/examplewindow.cc | 2 +-
examples/book/clipboard/ideal/examplewindow.h | 4 +--
.../book/combobox/entry_complex/examplewindow.cc | 4 +--
.../book/combobox/entry_complex/examplewindow.h | 4 +--
examples/book/combobox/entry_text/examplewindow.cc | 4 +--
examples/book/combobox/entry_text/examplewindow.h | 4 +--
examples/book/custom/custom_widget/mywidget.cc | 2 +-
examples/book/custom/custom_widget/mywidget2.cc | 2 +-
examples/book/entry/icon/examplewindow.cc | 2 +-
examples/book/entry/icon/examplewindow.h | 4 +--
examples/book/eventbox/examplewindow.cc | 3 +-
examples/book/eventbox/examplewindow.h | 4 +--
.../keyboard_events/propagation/examplewindow.cc | 12 ++++-----
.../keyboard_events/propagation/examplewindow.h | 10 ++++----
.../book/keyboard_events/simple/examplewindow.cc | 15 +++++------
.../book/keyboard_events/simple/examplewindow.h | 2 +-
examples/book/menus/popup/examplewindow.cc | 16 ++++--------
examples/book/menus/popup/examplewindow.h | 4 +--
examples/book/searchbar/examplewindow.cc | 5 +---
examples/book/searchbar/examplewindow.h | 2 +-
examples/book/treeview/popup/treeview_withpopup.cc | 12 ++-------
examples/book/treeview/popup/treeview_withpopup.h | 4 +--
.../others/cellrenderercustom/cellrendererlist.cc | 4 +-
.../others/cellrenderercustom/cellrendererlist.h | 4 +--
.../others/cellrenderercustom/cellrendererpopup.cc | 16 ++++++------
.../others/cellrenderercustom/cellrendererpopup.h | 16 ++++++------
.../cellrenderercustom/cellrenderertoggle.cc | 14 +++++-----
examples/others/cellrenderercustom/popupentry.cc | 25 +++++++++++--------
examples/others/cellrenderercustom/popupentry.h | 6 ++--
29 files changed, 85 insertions(+), 121 deletions(-)
---
diff --git a/examples/book/clipboard/ideal/examplewindow.cc b/examples/book/clipboard/ideal/examplewindow.cc
index 7dc67cc..59fc0c2 100644
--- a/examples/book/clipboard/ideal/examplewindow.cc
+++ b/examples/book/clipboard/ideal/examplewindow.cc
@@ -117,7 +117,7 @@ void ExampleWindow::on_button_paste()
update_paste_status();
}
-void ExampleWindow::on_clipboard_owner_change(GdkEventOwnerChange*)
+void ExampleWindow::on_clipboard_owner_change(Gdk::EventOwnerChange&)
{
update_paste_status();
}
diff --git a/examples/book/clipboard/ideal/examplewindow.h b/examples/book/clipboard/ideal/examplewindow.h
index d0ea50c..00e2346 100644
--- a/examples/book/clipboard/ideal/examplewindow.h
+++ b/examples/book/clipboard/ideal/examplewindow.h
@@ -1,5 +1,3 @@
-//$Id: examplewindow.h 705 2006-07-19 02:55:32Z jjongsma $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -32,7 +30,7 @@ protected:
void on_button_copy();
void on_button_paste();
- void on_clipboard_owner_change(GdkEventOwnerChange* event);
+ void on_clipboard_owner_change(Gdk::EventOwnerChange& event);
void on_clipboard_get(Gtk::SelectionData& selection_data, guint info);
void on_clipboard_clear();
diff --git a/examples/book/combobox/entry_complex/examplewindow.cc
b/examples/book/combobox/entry_complex/examplewindow.cc
index 2f6c957..4e913c8 100644
--- a/examples/book/combobox/entry_complex/examplewindow.cc
+++ b/examples/book/combobox/entry_complex/examplewindow.cc
@@ -71,8 +71,6 @@ ExampleWindow::ExampleWindow()
auto entry = m_Combo.get_entry();
if (entry)
{
- // The Entry shall receive focus-out events.
- entry->add_events(Gdk::EventMask::FOCUS_CHANGE_MASK);
// Alternatively you can connect to m_Combo.signal_changed().
entry->signal_changed().connect(sigc::mem_fun(*this,
&ExampleWindow::on_entry_changed) );
@@ -113,7 +111,7 @@ void ExampleWindow::on_entry_activate()
}
}
-bool ExampleWindow::on_entry_focus_out_event(GdkEventFocus* /* event */)
+bool ExampleWindow::on_entry_focus_out_event(Gdk::EventFocus& /* event */)
{
auto entry = m_Combo.get_entry();
if (entry)
diff --git a/examples/book/combobox/entry_complex/examplewindow.h
b/examples/book/combobox/entry_complex/examplewindow.h
index dd9c894..691bcdd 100644
--- a/examples/book/combobox/entry_complex/examplewindow.h
+++ b/examples/book/combobox/entry_complex/examplewindow.h
@@ -1,5 +1,3 @@
-//$Id: examplewindow.h 398 2005-04-19 14:42:11Z murrayc $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -33,7 +31,7 @@ protected:
//Signal handlers:
void on_entry_changed();
void on_entry_activate();
- bool on_entry_focus_out_event(GdkEventFocus* event);
+ bool on_entry_focus_out_event(Gdk::EventFocus& event);
//Signal connection:
sigc::connection m_ConnectionFocusOut;
diff --git a/examples/book/combobox/entry_text/examplewindow.cc
b/examples/book/combobox/entry_text/examplewindow.cc
index c5b01e4..28efa90 100644
--- a/examples/book/combobox/entry_text/examplewindow.cc
+++ b/examples/book/combobox/entry_text/examplewindow.cc
@@ -37,8 +37,6 @@ ExampleWindow::ExampleWindow()
&ExampleWindow::on_combo_changed) );
if (entry)
{
- // The Entry shall receive focus-out events.
- entry->add_events(Gdk::EventMask::FOCUS_CHANGE_MASK);
entry->signal_activate().connect(sigc::mem_fun(*this,
&ExampleWindow::on_entry_activate) );
m_ConnectionFocusOut = entry->signal_focus_out_event().
@@ -70,7 +68,7 @@ void ExampleWindow::on_entry_activate()
<< ", Text=" << m_Combo.get_active_text() << std::endl;
}
-bool ExampleWindow::on_entry_focus_out_event(GdkEventFocus* /* event */)
+bool ExampleWindow::on_entry_focus_out_event(Gdk::EventFocus& /* event */)
{
std::cout << "on_entry_focus_out_event(): Row=" << m_Combo.get_active_row_number()
<< ", Text=" << m_Combo.get_active_text() << std::endl;
diff --git a/examples/book/combobox/entry_text/examplewindow.h
b/examples/book/combobox/entry_text/examplewindow.h
index baf7e02..4040775 100644
--- a/examples/book/combobox/entry_text/examplewindow.h
+++ b/examples/book/combobox/entry_text/examplewindow.h
@@ -1,5 +1,3 @@
-//$Id: examplewindow.h 398 2005-04-19 14:42:11Z murrayc $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -32,7 +30,7 @@ protected:
//Signal handlers:
void on_combo_changed();
void on_entry_activate();
- bool on_entry_focus_out_event(GdkEventFocus* event);
+ bool on_entry_focus_out_event(Gdk::EventFocus& event);
//Signal connection:
sigc::connection m_ConnectionFocusOut;
diff --git a/examples/book/custom/custom_widget/mywidget.cc b/examples/book/custom/custom_widget/mywidget.cc
index 26269b6..7bde395 100644
--- a/examples/book/custom/custom_widget/mywidget.cc
+++ b/examples/book/custom/custom_widget/mywidget.cc
@@ -155,7 +155,7 @@ void MyWidget::on_realize()
{
//Create the GdkWindow:
m_refGdkWindow = Gdk::Window::create_child(get_parent_window(),
- get_events () | Gdk::EventMask::EXPOSURE_MASK, get_allocation());
+ get_parent_window()->get_events() | Gdk::EventMask::EXPOSURE_MASK, get_allocation());
set_window(m_refGdkWindow);
//make the widget receive expose events
diff --git a/examples/book/custom/custom_widget/mywidget2.cc b/examples/book/custom/custom_widget/mywidget2.cc
index fc52bab..f70f8a9 100644
--- a/examples/book/custom/custom_widget/mywidget2.cc
+++ b/examples/book/custom/custom_widget/mywidget2.cc
@@ -154,7 +154,7 @@ void MyWidget2::on_realize()
{
//Create the GdkWindow:
m_refGdkWindow = Gdk::Window::create_child(get_parent_window(),
- get_events () | Gdk::EventMask::EXPOSURE_MASK, get_allocation());
+ get_parent_window()->get_events() | Gdk::EventMask::EXPOSURE_MASK, get_allocation());
set_window(m_refGdkWindow);
//make the widget receive expose events
diff --git a/examples/book/entry/icon/examplewindow.cc b/examples/book/entry/icon/examplewindow.cc
index 7c48523..a8a4cba 100644
--- a/examples/book/entry/icon/examplewindow.cc
+++ b/examples/book/entry/icon/examplewindow.cc
@@ -44,7 +44,7 @@ ExampleWindow::~ExampleWindow()
{
}
-void ExampleWindow::on_icon_pressed(Gtk::Entry::IconPosition /* icon_pos */, const GdkEventButton* /* event
*/)
+void ExampleWindow::on_icon_pressed(Gtk::Entry::IconPosition /* icon_pos */, const Gdk::EventButton& /*
event */)
{
std::cout << "Icon pressed." << std::endl;
}
diff --git a/examples/book/entry/icon/examplewindow.h b/examples/book/entry/icon/examplewindow.h
index 64add92..854341c 100644
--- a/examples/book/entry/icon/examplewindow.h
+++ b/examples/book/entry/icon/examplewindow.h
@@ -1,5 +1,3 @@
-//$Id: examplewindow.h 705 2006-07-19 02:55:32Z jjongsma $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -29,7 +27,7 @@ public:
protected:
//Signal handlers:
- void on_icon_pressed(Gtk::Entry::IconPosition icon_pos, const GdkEventButton* event);
+ void on_icon_pressed(Gtk::Entry::IconPosition icon_pos, const Gdk::EventButton& event);
void on_button_close();
//Child widgets:
diff --git a/examples/book/eventbox/examplewindow.cc b/examples/book/eventbox/examplewindow.cc
index 333c446..269887e 100644
--- a/examples/book/eventbox/examplewindow.cc
+++ b/examples/book/eventbox/examplewindow.cc
@@ -32,7 +32,6 @@ ExampleWindow::ExampleWindow()
m_Label.set_ellipsize(Pango::EllipsizeMode::END);
//And bind an action to it:
- m_EventBox.set_events(Gdk::EventMask::BUTTON_PRESS_MASK);
m_EventBox.signal_button_press_event().connect(
sigc::mem_fun(*this, &ExampleWindow::on_eventbox_button_press), false);
@@ -43,7 +42,7 @@ ExampleWindow::~ExampleWindow()
{
}
-bool ExampleWindow::on_eventbox_button_press(GdkEventButton*)
+bool ExampleWindow::on_eventbox_button_press(Gdk::EventButton&)
{
hide();
return true;
diff --git a/examples/book/eventbox/examplewindow.h b/examples/book/eventbox/examplewindow.h
index 2c68f37..1bfba5e 100644
--- a/examples/book/eventbox/examplewindow.h
+++ b/examples/book/eventbox/examplewindow.h
@@ -1,5 +1,3 @@
-//$Id: examplewindow.h 870 2007-07-13 19:08:46Z murrayc $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -29,7 +27,7 @@ public:
protected:
//Signal handlers:
- bool on_eventbox_button_press(GdkEventButton* button_event);
+ bool on_eventbox_button_press(Gdk::EventButton& button_event);
//Child widgets:
Gtk::EventBox m_EventBox;
diff --git a/examples/book/keyboard_events/propagation/examplewindow.cc
b/examples/book/keyboard_events/propagation/examplewindow.cc
index 10b4307..a7bee5a 100644
--- a/examples/book/keyboard_events/propagation/examplewindow.cc
+++ b/examples/book/keyboard_events/propagation/examplewindow.cc
@@ -34,8 +34,6 @@ ExampleWindow::ExampleWindow()
m_container.add(m_checkbutton_can_propagate);
// Events
- add_events(Gdk::EventMask::KEY_RELEASE_MASK);
-
m_entry.signal_key_release_event().connect(
sigc::mem_fun(*this, &ExampleWindow::entryKeyRelease), true);
@@ -52,7 +50,7 @@ ExampleWindow::ExampleWindow()
}
//By changing the return value we allow, or don't allow, the event to propagate to other elements.
-bool ExampleWindow::entryKeyRelease(GdkEventKey* /* event */ )
+bool ExampleWindow::entryKeyRelease(Gdk::EventKey& /* event */ )
{
std::cout << "Entry" << std::endl;
@@ -64,7 +62,7 @@ bool ExampleWindow::entryKeyRelease(GdkEventKey* /* event */ )
return true;
}
-bool ExampleWindow::gridKeyRelease(GdkEventKey* /* event */ )
+bool ExampleWindow::gridKeyRelease(Gdk::EventKey& /* event */ )
{
std::cout << "Grid" << std::endl;
@@ -72,13 +70,13 @@ bool ExampleWindow::gridKeyRelease(GdkEventKey* /* event */ )
return false;
}
-bool ExampleWindow::windowKeyReleaseBefore(GdkEventKey* /* event */ )
+bool ExampleWindow::windowKeyReleaseBefore(Gdk::EventKey& /* event */ )
{
std::cout << "Window before" << std::endl;
return false;
}
-bool ExampleWindow::on_key_release_event(GdkEventKey* key_event)
+bool ExampleWindow::on_key_release_event(Gdk::EventKey& key_event)
{
std::cout << "Window overridden" << std::endl;
@@ -87,7 +85,7 @@ bool ExampleWindow::on_key_release_event(GdkEventKey* key_event)
}
// This will set the entry's text in the label, every time a key is pressed.
-bool ExampleWindow::windowKeyRelease(GdkEventKey* /* event */ )
+bool ExampleWindow::windowKeyRelease(Gdk::EventKey& /* event */ )
{
std::cout << "Window after";
diff --git a/examples/book/keyboard_events/propagation/examplewindow.h
b/examples/book/keyboard_events/propagation/examplewindow.h
index 36b4f43..6158319 100644
--- a/examples/book/keyboard_events/propagation/examplewindow.h
+++ b/examples/book/keyboard_events/propagation/examplewindow.h
@@ -28,12 +28,12 @@ public:
private:
//Override default signal handler:
- bool on_key_release_event(GdkEventKey* event) override;
+ bool on_key_release_event(Gdk::EventKey& event) override;
- bool entryKeyRelease(GdkEventKey* event);
- bool gridKeyRelease(GdkEventKey* event);
- bool windowKeyReleaseBefore(GdkEventKey* event);
- bool windowKeyRelease(GdkEventKey* event);
+ bool entryKeyRelease(Gdk::EventKey& event);
+ bool gridKeyRelease(Gdk::EventKey& event);
+ bool windowKeyReleaseBefore(Gdk::EventKey& event);
+ bool windowKeyRelease(Gdk::EventKey& event);
Gtk::Grid m_container;
diff --git a/examples/book/keyboard_events/simple/examplewindow.cc
b/examples/book/keyboard_events/simple/examplewindow.cc
index ae88481..57beca7 100644
--- a/examples/book/keyboard_events/simple/examplewindow.cc
+++ b/examples/book/keyboard_events/simple/examplewindow.cc
@@ -35,31 +35,30 @@ ExampleWindow::ExampleWindow()
// Events.
// We override the default event signal handler.
- add_events(Gdk::EventMask::KEY_PRESS_MASK);
}
-bool ExampleWindow::on_key_press_event(GdkEventKey* key_event)
+bool ExampleWindow::on_key_press_event(Gdk::EventKey& key_event)
{
- //GDK_MOD1_MASK -> the 'alt' key(mask)
+ //Gdk::ModifierType::MOD1_MASK -> the 'Alt' key(mask)
//GDK_KEY_1 -> the '1' key
//GDK_KEY_2 -> the '2' key
//select the first radio button, when we press alt + 1
- if((key_event->keyval == GDK_KEY_1) &&
- (key_event->state &(GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)) == GDK_MOD1_MASK)
+ if((key_event.get_keyval() == GDK_KEY_1) &&
+ (key_event.get_state() & (Gdk::ModifierType::SHIFT_MASK | Gdk::ModifierType::CONTROL_MASK |
Gdk::ModifierType::MOD1_MASK)) == Gdk::ModifierType::MOD1_MASK)
{
m_first.set_active();
//returning true, cancels the propagation of the event
return true;
}
- else if((key_event->keyval == GDK_KEY_2) &&
- (key_event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)) == GDK_MOD1_MASK)
+ else if((key_event.get_keyval() == GDK_KEY_2) &&
+ (key_event.get_state() & (Gdk::ModifierType::SHIFT_MASK | Gdk::ModifierType::CONTROL_MASK |
Gdk::ModifierType::MOD1_MASK)) == Gdk::ModifierType::MOD1_MASK)
{
//and the second radio button, when we press alt + 2
m_second.set_active();
return true;
}
- else if(key_event->keyval == GDK_KEY_Escape)
+ else if(key_event.get_keyval() == GDK_KEY_Escape)
{
//close the window, when the 'esc' key is pressed
hide();
diff --git a/examples/book/keyboard_events/simple/examplewindow.h
b/examples/book/keyboard_events/simple/examplewindow.h
index 6d335e9..efcc429 100644
--- a/examples/book/keyboard_events/simple/examplewindow.h
+++ b/examples/book/keyboard_events/simple/examplewindow.h
@@ -28,7 +28,7 @@ public:
private:
//Override default signal handler:
- bool on_key_press_event(GdkEventKey* event) override;
+ bool on_key_press_event(Gdk::EventKey& event) override;
Gtk::Grid m_container;
Gtk::RadioButton m_first;
diff --git a/examples/book/menus/popup/examplewindow.cc b/examples/book/menus/popup/examplewindow.cc
index 4fbbda0..0ca6b30 100644
--- a/examples/book/menus/popup/examplewindow.cc
+++ b/examples/book/menus/popup/examplewindow.cc
@@ -110,21 +110,15 @@ void ExampleWindow::on_menu_file_popup_generic()
std::cout << "A popup menu item was selected." << std::endl;
}
-bool ExampleWindow::on_button_press_event(GdkEventButton* button_event)
+bool ExampleWindow::on_button_press_event(Gdk::EventButton& button_event)
{
- if( (button_event->type == GDK_BUTTON_PRESS) && (button_event->button == 3) )
+ if (button_event.shall_trigger_context_menu())
{
- if(!m_pMenuPopup->get_attach_widget())
- {
+ if (m_pMenuPopup && !m_pMenuPopup->get_attach_widget())
m_pMenuPopup->attach_to_widget(*this);
- }
- if(m_pMenuPopup)
- m_pMenuPopup->popup_at_pointer((GdkEvent*)button_event);
-
- // Menu::popup_at_pointer() is new in gtkmm 3.22.
- // If you have an older revision, try this:
- //m_pMenuPopup->popup(button_event->button, button_event->time);
+ if (m_pMenuPopup)
+ m_pMenuPopup->popup_at_pointer();
return true; //It has been handled.
}
diff --git a/examples/book/menus/popup/examplewindow.h b/examples/book/menus/popup/examplewindow.h
index 88c2a03..032a827 100644
--- a/examples/book/menus/popup/examplewindow.h
+++ b/examples/book/menus/popup/examplewindow.h
@@ -1,5 +1,3 @@
-//$Id: examplewindow.h 705 2006-07-19 02:55:32Z jjongsma $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -29,7 +27,7 @@ public:
protected:
//Signal handlers:
- bool on_button_press_event(GdkEventButton* button_event) override;
+ bool on_button_press_event(Gdk::EventButton& button_event) override;
void on_menu_file_popup_generic();
diff --git a/examples/book/searchbar/examplewindow.cc b/examples/book/searchbar/examplewindow.cc
index c49ecc6..3ee9bc3 100644
--- a/examples/book/searchbar/examplewindow.cc
+++ b/examples/book/searchbar/examplewindow.cc
@@ -34,9 +34,6 @@ ExampleWindow::ExampleWindow()
// Connect search entry
m_search_bar.connect_entry(m_entry);
- // Events
- add_events(Gdk::EventMask::KEY_PRESS_MASK);
-
// Connect signals
signal_key_press_event().connect(sigc::mem_fun(*this, &ExampleWindow::on_window_key_press), true);
m_search_bar.property_search_mode_enabled().signal_changed().connect(sigc::mem_fun(*this,
&ExampleWindow::on_search_bar_reveal_changed));
@@ -88,7 +85,7 @@ ExampleWindow::~ExampleWindow()
{
}
-bool ExampleWindow::on_window_key_press(GdkEventKey* key_event)
+bool ExampleWindow::on_window_key_press(Gdk::EventKey& key_event)
{
return m_search_bar.handle_event(key_event);
}
diff --git a/examples/book/searchbar/examplewindow.h b/examples/book/searchbar/examplewindow.h
index a0932bc..b193935 100644
--- a/examples/book/searchbar/examplewindow.h
+++ b/examples/book/searchbar/examplewindow.h
@@ -27,7 +27,7 @@ public:
private:
// Slots
- bool on_window_key_press(GdkEventKey* key_event);
+ bool on_window_key_press(Gdk::EventKey& key_event);
void on_search_mode_changed();
void on_show_close_button_changed();
void on_search_bar_reveal_changed();
diff --git a/examples/book/treeview/popup/treeview_withpopup.cc
b/examples/book/treeview/popup/treeview_withpopup.cc
index 7d06952..664d8ca 100644
--- a/examples/book/treeview/popup/treeview_withpopup.cc
+++ b/examples/book/treeview/popup/treeview_withpopup.cc
@@ -63,7 +63,7 @@ TreeView_WithPopup::~TreeView_WithPopup()
{
}
-bool TreeView_WithPopup::on_button_press_event(GdkEventButton* button_event)
+bool TreeView_WithPopup::on_button_press_event(Gdk::EventButton& button_event)
{
bool return_value = false;
@@ -72,14 +72,8 @@ bool TreeView_WithPopup::on_button_press_event(GdkEventButton* button_event)
return_value = TreeView::on_button_press_event(button_event);
//Then do our custom stuff:
- if( (button_event->type == GDK_BUTTON_PRESS) && (button_event->button == 3) )
- {
- m_Menu_Popup.popup_at_pointer((GdkEvent*)button_event);
-
- // Menu::popup_at_pointer() is new in gtkmm 3.22.
- // If you have an older revision, try this:
- //m_Menu_Popup.popup(button_event->button, button_event->time);
- }
+ if (button_event.shall_trigger_context_menu())
+ m_Menu_Popup.popup_at_pointer(button_event);
return return_value;
}
diff --git a/examples/book/treeview/popup/treeview_withpopup.h
b/examples/book/treeview/popup/treeview_withpopup.h
index 5da8c9e..ec3d042 100644
--- a/examples/book/treeview/popup/treeview_withpopup.h
+++ b/examples/book/treeview/popup/treeview_withpopup.h
@@ -1,5 +1,3 @@
-//$Id: treeview_withpopup.h 705 2006-07-19 02:55:32Z jjongsma $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -30,7 +28,7 @@ public:
protected:
// Override Signal handler:
// Alternatively, use signal_button_press_event().connect_notify()
- bool on_button_press_event(GdkEventButton* button_event) override;
+ bool on_button_press_event(Gdk::EventButton& button_event) override;
//Signal handler for popup menu items:
void on_menu_file_popup_generic();
diff --git a/examples/others/cellrenderercustom/cellrendererlist.cc
b/examples/others/cellrenderercustom/cellrendererlist.cc
index 2530e74..80b0c53 100644
--- a/examples/others/cellrenderercustom/cellrendererlist.cc
+++ b/examples/others/cellrenderercustom/cellrendererlist.cc
@@ -88,9 +88,9 @@ void CellRendererList::on_show_popup(const Glib::ustring& path, int x1, int y1,
CellRendererPopup::on_show_popup(path, x1, y1, x2, y2);
}
-bool CellRendererList::on_tree_view_button_release_event(GdkEventButton* event)
+bool CellRendererList::on_tree_view_button_release_event(Gdk::EventButton& event)
{
- if(event->button == 1)
+ if (event.get_button() == 1)
{
hide_popup();
return true;
diff --git a/examples/others/cellrenderercustom/cellrendererlist.h
b/examples/others/cellrenderercustom/cellrendererlist.h
index c019bff..495a0a2 100644
--- a/examples/others/cellrenderercustom/cellrendererlist.h
+++ b/examples/others/cellrenderercustom/cellrendererlist.h
@@ -1,5 +1,3 @@
-//$Id: cellrendererlist.h 156 2004-03-12 10:11:35Z murrayc $ -*- c++ -*-
-
/* gtkmm example Copyright (C) 2002 gtkmm development team
*
* This program is free software; you can redistribute it and/or modify
@@ -40,7 +38,7 @@ private:
Glib::RefPtr<Gtk::ListStore> list_store_;
Gtk::TreeView tree_view_;
- bool on_tree_view_button_release_event(GdkEventButton* event);
+ bool on_tree_view_button_release_event(Gdk::EventButton& event);
void on_tree_selection_changed();
};
diff --git a/examples/others/cellrenderercustom/cellrendererpopup.cc
b/examples/others/cellrenderercustom/cellrendererpopup.cc
index f75cd5a..1802dd3 100644
--- a/examples/others/cellrenderercustom/cellrendererpopup.cc
+++ b/examples/others/cellrenderercustom/cellrendererpopup.cc
@@ -125,7 +125,7 @@ void CellRendererPopup::get_preferred_width_for_height_vfunc(Gtk::Widget& widget
natural_width += button_width_;
}
-Gtk::CellEditable* CellRendererPopup::start_editing_vfunc(GdkEvent*,
+Gtk::CellEditable* CellRendererPopup::start_editing_vfunc(Gdk::Event&,
Gtk::Widget&,
const Glib::ustring& path,
const Gdk::Rectangle&,
@@ -223,16 +223,16 @@ void CellRendererPopup::on_hide_popup()
editing_canceled_ = false;
}
-bool CellRendererPopup::on_button_press_event(GdkEventButton* event)
+bool CellRendererPopup::on_button_press_event(Gdk::EventButton& event)
{
- if(event->button != 1)
+ if (event.get_button() != 1)
return false;
// If the event happened outside the popup, cancel editing.
- //gdk_event_get_root_coords ((GdkEvent *) event, &x, &y);
- const double x = event->x_root;
- const double y = event->y_root;
+ //gdk_event_get_root_coords(event.Event::gobj(), &x, &y);
+ const double x = event.get_root_x();
+ const double y = event.get_root_y();
int xoffset = 0, yoffset = 0;
popup_window_.get_window()->get_root_origin(xoffset, yoffset);
@@ -256,9 +256,9 @@ bool CellRendererPopup::on_button_press_event(GdkEventButton* event)
return false;
}
-bool CellRendererPopup::on_key_press_event(GdkEventKey* event)
+bool CellRendererPopup::on_key_press_event(Gdk::EventKey& event)
{
- switch(event->keyval)
+ switch (event.get_keyval())
{
case GDK_KEY_Escape:
editing_canceled_ = true; break;
diff --git a/examples/others/cellrenderercustom/cellrendererpopup.h
b/examples/others/cellrenderercustom/cellrendererpopup.h
index 7c9a036..cbb9d41 100644
--- a/examples/others/cellrenderercustom/cellrendererpopup.h
+++ b/examples/others/cellrenderercustom/cellrendererpopup.h
@@ -47,12 +47,12 @@ protected:
void get_preferred_width_for_height_vfunc(Gtk::Widget& widget, int height,
int& minimum_width, int& natural_width) const override;
- Gtk::CellEditable* start_editing_vfunc(GdkEvent* event,
- Gtk::Widget& widget,
- const Glib::ustring& path,
- const Gdk::Rectangle& background_area,
- const Gdk::Rectangle& cell_area,
- Gtk::CellRendererState flags) override;
+ Gtk::CellEditable* start_editing_vfunc(Gdk::Event& event,
+ Gtk::Widget& widget,
+ const Glib::ustring& path,
+ const Gdk::Rectangle& background_area,
+ const Gdk::Rectangle& cell_area,
+ Gtk::CellRendererState flags) override;
virtual void on_show_popup(const Glib::ustring& path, int x1, int y1, int x2, int y2);
void on_hide_popup();
@@ -70,8 +70,8 @@ private:
bool shown_;
bool editing_canceled_;
- bool on_button_press_event(GdkEventButton* event);
- bool on_key_press_event(GdkEventKey* event);
+ bool on_button_press_event(Gdk::EventButton& event);
+ bool on_key_press_event(Gdk::EventKey& event);
void on_style_updated();
void on_popup_editing_done();
diff --git a/examples/others/cellrenderercustom/cellrenderertoggle.cc
b/examples/others/cellrenderercustom/cellrenderertoggle.cc
index 7f44215..f8090be 100644
--- a/examples/others/cellrenderercustom/cellrenderertoggle.cc
+++ b/examples/others/cellrenderercustom/cellrenderertoggle.cc
@@ -58,12 +58,12 @@ protected:
const Gdk::Rectangle& cell_area,
Gtk::CellRendererState flags) override;
- bool activate_vfunc(GdkEvent* event,
- Gtk::Widget& widget,
- const Glib::ustring& path,
- const Gdk::Rectangle& background_area,
- const Gdk::Rectangle& cell_area,
- Gtk::CellRendererState flags) override;
+ bool activate_vfunc(Gdk::Event& event,
+ Gtk::Widget& widget,
+ const Glib::ustring& path,
+ const Gdk::Rectangle& background_area,
+ const Gdk::Rectangle& cell_area,
+ Gtk::CellRendererState flags) override;
private:
Glib::Property<bool> property_activatable_;
@@ -224,7 +224,7 @@ void MyCellRendererToggle::snapshot_vfunc(Gtk::Snapshot& snapshot,
}
}
-bool MyCellRendererToggle::activate_vfunc(GdkEvent*,
+bool MyCellRendererToggle::activate_vfunc(Gdk::Event&,
Gtk::Widget&,
const Glib::ustring& path,
const Gdk::Rectangle&,
diff --git a/examples/others/cellrenderercustom/popupentry.cc
b/examples/others/cellrenderercustom/popupentry.cc
index 74a906b..2a0dec6 100644
--- a/examples/others/cellrenderercustom/popupentry.cc
+++ b/examples/others/cellrenderercustom/popupentry.cc
@@ -46,7 +46,6 @@ PopupEntry::PopupEntry(const Glib::ustring& path)
button_->set_image_from_icon_name("pan-down-symbolic", Gtk::BuiltinIconSize::BUTTON, true);
set_can_focus();
- add_events(Gdk::EventMask::KEY_PRESS_MASK | Gdk::EventMask::KEY_RELEASE_MASK);
}
PopupEntry::~PopupEntry()
@@ -102,9 +101,9 @@ PopupEntry::type_signal_arrow_clicked& PopupEntry::signal_arrow_clicked()
return signal_arrow_clicked_;
}
-bool PopupEntry::on_key_press_event(GdkEventKey* key_event)
+bool PopupEntry::on_key_press_event(Gdk::EventKey& key_event)
{
- if(key_event->keyval == GDK_KEY_Escape)
+ if (key_event.get_keyval() == GDK_KEY_Escape)
{
editing_canceled_ = true;
@@ -118,18 +117,22 @@ bool PopupEntry::on_key_press_event(GdkEventKey* key_event)
// Hackish :/ Synthesize a key press event for the entry.
- GdkEvent synth_event;
- synth_event.key = *key_event;
+ Gdk::EventKey synth_event(key_event);
- synth_event.key.window = Glib::unwrap(entry_->get_window()); // TODO: Use a C++ Gdk::Event.
- synth_event.key.send_event = true;
+ GdkEventKey* const synth_event_gobj = synth_event.gobj();
+ if (synth_event_gobj->window)
+ g_object_unref(synth_event_gobj->window);
+ synth_event_gobj->window = Glib::unwrap(entry_->get_window());
+ if (synth_event_gobj->window)
+ g_object_ref(synth_event_gobj->window);
+ synth_event_gobj->send_event = true;
- entry_->event(&synth_event);
+ entry_->event(synth_event);
return Gtk::EventBox::on_key_press_event(key_event);
}
-void PopupEntry::start_editing_vfunc(GdkEvent*)
+void PopupEntry::start_editing_vfunc(Gdk::Event&)
{
entry_->select_region(0, -1);
@@ -152,9 +155,9 @@ void PopupEntry::on_entry_activate()
//remove_widget(); // TODO: this line causes the widget to be removed twice -- dunno why
}
-bool PopupEntry::on_entry_key_press_event(GdkEventKey* key_event)
+bool PopupEntry::on_entry_key_press_event(Gdk::EventKey& key_event)
{
- if(key_event->keyval == GDK_KEY_Escape)
+ if (key_event.get_keyval() == GDK_KEY_Escape)
{
editing_canceled_ = true;
diff --git a/examples/others/cellrenderercustom/popupentry.h b/examples/others/cellrenderercustom/popupentry.h
index 288ba39..633f68f 100644
--- a/examples/others/cellrenderercustom/popupentry.h
+++ b/examples/others/cellrenderercustom/popupentry.h
@@ -42,14 +42,14 @@ public:
type_signal_arrow_clicked& signal_arrow_clicked();
protected:
- bool on_key_press_event(GdkEventKey* key_event) override;
- void start_editing_vfunc(GdkEvent* event) override;
+ bool on_key_press_event(Gdk::EventKey& key_event) override;
+ void start_editing_vfunc(Gdk::Event& event) override;
private:
typedef PopupEntry Self;
void on_entry_activate();
- bool on_entry_key_press_event(GdkEventKey* event);
+ bool on_entry_key_press_event(Gdk::EventKey& event);
void on_button_clicked();
Glib::ustring path_;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]