[gtkmm-documentation] Port to gtkmm-3.0
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation] Port to gtkmm-3.0
- Date: Tue, 31 Aug 2010 20:48:42 +0000 (UTC)
commit 3f7e15c1bf816704aa85604f15a16131fd5935c8
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Jul 27 23:42:23 2010 +0200
Port to gtkmm-3.0
* configure.ac: Depend on gtkmm-3.0
* examples/book/dialogs/aboutdialog/examplewindow.cc:
* examples/book/notebook/examplewindow.[h|cc]:
* examples/book/range_widgets/examplewindow.cc:
* examples/book/toolpalette/canvas.cc:
* examples/book/treeview/popup/treeview_withpopup.cc:
* examples/others/cellrenderercustom/cellrendererpopup.cc:
* examples/others/cellrenderercustom/popupentry.cc:
* examples/others/dnd/dndwindow.cc:
* examples/others/stock/stock.cc:
* examples/others/treemodelcustom/exampletreemodel.[h|cc]:
Replace use of MenuList and NotebookPage.
This is the master branch. See also the gtkmm-2-22 branch.
ChangeLog | 19 +++++
configure.ac | 2 +-
examples/book/dialogs/aboutdialog/examplewindow.cc | 1 -
examples/book/notebook/examplewindow.cc | 2 +-
examples/book/notebook/examplewindow.h | 2 +-
examples/book/range_widgets/examplewindow.cc | 80 +++++++++++---------
examples/book/toolpalette/canvas.cc | 3 +-
examples/book/treeview/popup/treeview_withpopup.cc | 25 ++++---
.../others/cellrenderercustom/cellrendererpopup.cc | 2 -
examples/others/cellrenderercustom/popupentry.cc | 2 -
examples/others/dnd/dndwindow.cc | 20 ++---
examples/others/stock/stock.cc | 35 ++++++---
.../others/treemodelcustom/exampletreemodel.cc | 8 --
examples/others/treemodelcustom/exampletreemodel.h | 2 -
14 files changed, 114 insertions(+), 89 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 247fdd9..c3d6d0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2010-07-27 Murray Cumming <murrayc murrayc com>
+
+ Port to gtkmm-3.0
+
+ * configure.ac: Depend on gtkmm-3.0
+ * examples/book/dialogs/aboutdialog/examplewindow.cc:
+ * examples/book/notebook/examplewindow.[h|cc]:
+ * examples/book/range_widgets/examplewindow.cc:
+ * examples/book/toolpalette/canvas.cc:
+ * examples/book/treeview/popup/treeview_withpopup.cc:
+ * examples/others/cellrenderercustom/cellrendererpopup.cc:
+ * examples/others/cellrenderercustom/popupentry.cc:
+ * examples/others/dnd/dndwindow.cc:
+ * examples/others/stock/stock.cc:
+ * examples/others/treemodelcustom/exampletreemodel.[h|cc]:
+ Replace use of MenuList and NotebookPage.
+
+This is the master branch. See also the gtkmm-2-22 branch.
+
2010-07-21 Murray Cumming <murrayc murrayc com>
Buttons chapter: Remove text about non-existant XPMLabelBox class.
diff --git a/configure.ac b/configure.ac
index 5bbf529..c9dc85b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,7 +19,7 @@ AC_PROG_CXX
AC_PATH_PROG([PERL], [perl], [perl])
PKG_CHECK_MODULES([GIOMM], [giomm-2.4 >= 2.24.0])
-PKG_CHECK_MODULES([GTKMM], [gtkmm-2.4 >= 2.20.0])
+PKG_CHECK_MODULES([GTKMM], [gtkmm-3.0 >= 2.20.5])
MM_PKG_CONFIG_SUBST([GTHREAD_CFLAGS], [--cflags-only-other gthread-2.0])
AC_LANG([C++])
diff --git a/examples/book/dialogs/aboutdialog/examplewindow.cc b/examples/book/dialogs/aboutdialog/examplewindow.cc
index 2f47756..09273fb 100644
--- a/examples/book/dialogs/aboutdialog/examplewindow.cc
+++ b/examples/book/dialogs/aboutdialog/examplewindow.cc
@@ -19,7 +19,6 @@
#include "examplewindow.h"
#include <gtkmm/aboutdialog.h>
#include <iostream>
-#include <gtk/gtkaboutdialog.h>
ExampleWindow::ExampleWindow()
diff --git a/examples/book/notebook/examplewindow.cc b/examples/book/notebook/examplewindow.cc
index 9ca51a2..aa42fcc 100644
--- a/examples/book/notebook/examplewindow.cc
+++ b/examples/book/notebook/examplewindow.cc
@@ -59,7 +59,7 @@ void ExampleWindow::on_button_quit()
hide();
}
-void ExampleWindow::on_notebook_switch_page(GtkNotebookPage* /* page */, guint page_num)
+void ExampleWindow::on_notebook_switch_page(Gtk::Widget* /* page */, guint page_num)
{
std::cout << "Switched to tab with index " << page_num << std::endl;
diff --git a/examples/book/notebook/examplewindow.h b/examples/book/notebook/examplewindow.h
index 0d5359f..282ad90 100644
--- a/examples/book/notebook/examplewindow.h
+++ b/examples/book/notebook/examplewindow.h
@@ -30,7 +30,7 @@ public:
protected:
//Signal handlers:
void on_button_quit();
- void on_notebook_switch_page(GtkNotebookPage* page, guint page_num);
+ void on_notebook_switch_page(Gtk::Widget* page, guint page_num);
//Child widgets:
Gtk::VBox m_VBox;
diff --git a/examples/book/range_widgets/examplewindow.cc b/examples/book/range_widgets/examplewindow.cc
index 66dbdc6..93b51ae 100644
--- a/examples/book/range_widgets/examplewindow.cc
+++ b/examples/book/range_widgets/examplewindow.cc
@@ -88,46 +88,56 @@ ExampleWindow::ExampleWindow()
m_VBox2.pack_start(m_CheckButton);
//Menus:
- {
- using namespace Gtk::Menu_Helpers;
-
- MenuList& list_vpos = m_Menu_Position.items();
- list_vpos.push_back(
- MenuElem("Top", sigc::bind(sigc::mem_fun(*this,
- &ExampleWindow::on_menu_position), Gtk::POS_TOP)));
- list_vpos.push_back(
- MenuElem("Bottom", sigc::bind(sigc::mem_fun(*this,
- &ExampleWindow::on_menu_position), Gtk::POS_BOTTOM)));
- list_vpos.push_back(
- MenuElem("Left", sigc::bind(sigc::mem_fun(*this,
- &ExampleWindow::on_menu_position), Gtk::POS_LEFT)));
- list_vpos.push_back(
- MenuElem("Right", sigc::bind(sigc::mem_fun(*this,
- &ExampleWindow::on_menu_position), Gtk::POS_RIGHT)));
-
- m_VBox2.pack_start(
+ Gtk::MenuItem* item = Gtk::manage(new Gtk::MenuItem("Top"));
+ item->signal_activate().connect(
+ sigc::bind(sigc::mem_fun(*this,
+ &ExampleWindow::on_menu_position), Gtk::POS_TOP));
+ m_Menu_Position.append(*item);
+
+ item = Gtk::manage(new Gtk::MenuItem("Bottom"));
+ item->signal_activate().connect(
+ sigc::bind(sigc::mem_fun(*this,
+ &ExampleWindow::on_menu_position), Gtk::POS_BOTTOM));
+ m_Menu_Position.append(*item);
+
+ item = Gtk::manage(new Gtk::MenuItem("Left"));
+ item->signal_activate().connect(
+ sigc::bind(sigc::mem_fun(*this,
+ &ExampleWindow::on_menu_position), Gtk::POS_LEFT));
+ m_Menu_Position.append(*item);
+
+ item = Gtk::manage(new Gtk::MenuItem("Right"));
+ item->signal_activate().connect(
+ sigc::bind(sigc::mem_fun(*this,
+ &ExampleWindow::on_menu_position), Gtk::POS_RIGHT));
+ m_Menu_Position.append(*item);
+
+ m_VBox2.pack_start(
*Gtk::manage(new LabeledOptionMenu("Scale Value Position:",
m_Menu_Position)));
- MenuList& list_upd = m_Menu_Policy.items();
- list_upd.push_back(
- MenuElem("Continuous", sigc::bind(sigc::mem_fun(*this,
- &ExampleWindow::on_menu_policy),
- Gtk::UPDATE_CONTINUOUS)));
- list_upd.push_back(
- MenuElem("Discontinuous", sigc::bind(sigc::mem_fun(*this,
- &ExampleWindow::on_menu_policy),
- Gtk::UPDATE_DISCONTINUOUS)));
- list_upd.push_back(
- MenuElem("Delayed", sigc::bind(sigc::mem_fun(*this,
- &ExampleWindow::on_menu_policy),
- Gtk::UPDATE_DELAYED)));
-
- m_VBox2.pack_start(
- *Gtk::manage(new LabeledOptionMenu("Scale Update Policy:",
+ item = Gtk::manage(new Gtk::MenuItem("Continuous"));
+ item->signal_activate().connect(
+ sigc::bind(sigc::mem_fun(*this,
+ &ExampleWindow::on_menu_policy), Gtk::UPDATE_CONTINUOUS));
+ m_Menu_Policy.append(*item);
+
+ item = Gtk::manage(new Gtk::MenuItem("Discontinuous"));
+ item->signal_activate().connect(
+ sigc::bind(sigc::mem_fun(*this,
+ &ExampleWindow::on_menu_policy), Gtk::UPDATE_DISCONTINUOUS));
+ m_Menu_Policy.append(*item);
+
+ item = Gtk::manage(new Gtk::MenuItem("Delayed"));
+ item->signal_activate().connect(
+ sigc::bind(sigc::mem_fun(*this,
+ &ExampleWindow::on_menu_policy), Gtk::UPDATE_DELAYED));
+ m_Menu_Policy.append(*item);
+
+ m_VBox2.pack_start(
+ *Gtk::manage(new LabeledOptionMenu("Scale Update Policy:",
m_Menu_Policy)));
- }
//Digits:
m_HBox_Digits.pack_start(
diff --git a/examples/book/toolpalette/canvas.cc b/examples/book/toolpalette/canvas.cc
index 85a30c6..8a69d7a 100644
--- a/examples/book/toolpalette/canvas.cc
+++ b/examples/book/toolpalette/canvas.cc
@@ -68,7 +68,8 @@ bool Canvas::on_expose_event(GdkEventExpose* event)
return false;
Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();
- const Gdk::Region region(event->region, true /* copy */);
+ const Cairo::RefPtr<Cairo::Region> region =
+ Cairo::RefPtr<Cairo::Region>(new Cairo::Region(event->region, true /* take ref */));
Gdk::Cairo::add_region_to_path(cr, region);
cr->clip();
diff --git a/examples/book/treeview/popup/treeview_withpopup.cc b/examples/book/treeview/popup/treeview_withpopup.cc
index 54a854f..79acfed 100644
--- a/examples/book/treeview/popup/treeview_withpopup.cc
+++ b/examples/book/treeview/popup/treeview_withpopup.cc
@@ -43,16 +43,21 @@ TreeView_WithPopup::TreeView_WithPopup()
append_column("Name", m_Columns.m_col_name);
//Fill popup menu:
- {
- Gtk::Menu::MenuList& menulist = m_Menu_Popup.items();
-
- menulist.push_back( Gtk::Menu_Helpers::MenuElem("_Edit",
- sigc::mem_fun(*this, &TreeView_WithPopup::on_menu_file_popup_generic) ) );
- menulist.push_back( Gtk::Menu_Helpers::MenuElem("_Process",
- sigc::mem_fun(*this, &TreeView_WithPopup::on_menu_file_popup_generic) ) );
- menulist.push_back( Gtk::Menu_Helpers::MenuElem("_Remove",
- sigc::mem_fun(*this, &TreeView_WithPopup::on_menu_file_popup_generic) ) );
- }
+ Gtk::MenuItem* item = Gtk::manage(new Gtk::MenuItem("_Edit"));
+ item->signal_activate().connect(
+ sigc::mem_fun(*this, &TreeView_WithPopup::on_menu_file_popup_generic) );
+ m_Menu_Popup.append(*item);
+
+ item = Gtk::manage(new Gtk::MenuItem("_Process"));
+ item->signal_activate().connect(
+ sigc::mem_fun(*this, &TreeView_WithPopup::on_menu_file_popup_generic) );
+ m_Menu_Popup.append(*item);
+
+ item = Gtk::manage(new Gtk::MenuItem("_Remove"));
+ item->signal_activate().connect(
+ sigc::mem_fun(*this, &TreeView_WithPopup::on_menu_file_popup_generic) );
+ m_Menu_Popup.append(*item);
+
m_Menu_Popup.accelerate(*this);
#ifndef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
diff --git a/examples/others/cellrenderercustom/cellrendererpopup.cc b/examples/others/cellrenderercustom/cellrendererpopup.cc
index c5d4a16..46966f0 100644
--- a/examples/others/cellrenderercustom/cellrendererpopup.cc
+++ b/examples/others/cellrenderercustom/cellrendererpopup.cc
@@ -19,8 +19,6 @@
#include <gtkmm.h>
#include "cellrendererpopup.h"
#include "popupentry.h"
-#include <gdk/gdk.h>
-#include <gtk/gtkmain.h>
#include <algorithm>
#include <memory>
diff --git a/examples/others/cellrenderercustom/popupentry.cc b/examples/others/cellrenderercustom/popupentry.cc
index cf02b89..18b3b19 100644
--- a/examples/others/cellrenderercustom/popupentry.cc
+++ b/examples/others/cellrenderercustom/popupentry.cc
@@ -20,7 +20,6 @@
#include "popupentry.h"
#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkentry.h> /* see XXX below */
PopupEntry::PopupEntry(const Glib::ustring& path)
@@ -39,7 +38,6 @@ PopupEntry::PopupEntry(const Glib::ustring& path)
entry_ = new Gtk::Entry();
hbox->pack_start(*Gtk::manage(entry_), Gtk::PACK_EXPAND_WIDGET);
entry_->set_has_frame(false);
- entry_->gobj()->is_cell_renderer = true; // XXX
button_ = new Gtk::Button();
hbox->pack_start(*Gtk::manage(button_), Gtk::PACK_SHRINK);
diff --git a/examples/others/dnd/dndwindow.cc b/examples/others/dnd/dndwindow.cc
index d4abd89..6933b66 100644
--- a/examples/others/dnd/dndwindow.cc
+++ b/examples/others/dnd/dndwindow.cc
@@ -159,10 +159,10 @@ bool DnDWindow::on_image_drag_motion(const Glib::RefPtr<Gdk::DragContext>& conte
"NULL");
typedef std::list<Glib::ustring> type_targets;
- type_targets targets = context->get_targets();
- for(type_targets::iterator iter = targets.begin(); iter != targets.end(); ++iter)
+ const type_targets targets = context->list_targets();
+ for(type_targets::const_iterator iter = targets.begin(); iter != targets.end(); ++iter)
{
- Glib::ustring name = *iter;
+ const Glib::ustring name = *iter;
g_print ("%s\n", name.c_str());
}
@@ -184,19 +184,13 @@ bool DnDWindow::on_image_drag_drop(const Glib::RefPtr<Gdk::DragContext>& context
m_Image.set(m_trashcan_closed, m_trashcan_closed_mask);
-
- if(context->gobj()->targets)
+ std::vector<Glib::ustring> targets = context->list_targets();
+ if(!targets.empty())
{
- std::vector<Glib::ustring> targets = context->get_targets();
- if(targets.size())
- {
- drag_get_data( context, targets[0], time );
- }
-
- return true;
+ drag_get_data( context, targets[0], time );
}
- return false;
+ return true;
}
diff --git a/examples/others/stock/stock.cc b/examples/others/stock/stock.cc
index e257bfe..da38b5b 100644
--- a/examples/others/stock/stock.cc
+++ b/examples/others/stock/stock.cc
@@ -95,23 +95,34 @@ MainWindowClass::MainWindowClass()
togglebutton->set_label("Convert Toggle");
toolbar->append(*togglebutton, sigc::bind( sigc::mem_fun(*this, &MainWindowClass::toolbar_cb), "Convert Toggle"));
-
- menubar->items().push_back(MenuElem("Options"));
- Gtk::MenuItem* pMenuItem = &(menubar->items().back());
+ Gtk::MenuItem* pMenuItem = Gtk::manage(new Gtk::MenuItem("Options"));
+ menubar->append(*pMenuItem);
Gtk::Menu* menu = Gtk::manage(new Gtk::Menu());
pMenuItem->set_submenu(*menu);
- menu->items()
- .push_back(MenuElem("Icons", sigc::bind(sigc::mem_fun(*this, &MainWindowClass::toolbar_item_cb), toolbar, Gtk::TOOLBAR_ICONS)));
- menu->items()
- .push_back(MenuElem("Text", sigc::bind(sigc::mem_fun(*this, &MainWindowClass::toolbar_item_cb), toolbar, Gtk::TOOLBAR_TEXT)));
- menu->items()
- .push_back(MenuElem("Both", sigc::bind(sigc::mem_fun(*this, &MainWindowClass::toolbar_item_cb), toolbar, Gtk::TOOLBAR_BOTH)));
- menu->items()
- .push_back(MenuElem("Both (horiz)", sigc::bind(sigc::mem_fun(*this, &MainWindowClass::toolbar_item_cb), toolbar, Gtk::TOOLBAR_BOTH_HORIZ)));
+ pMenuItem = Gtk::manage(new Gtk::MenuItem("Icons"));
+ pMenuItem->signal_activate().connect(
+ sigc::bind(sigc::mem_fun(*this, &MainWindowClass::toolbar_item_cb), toolbar, Gtk::TOOLBAR_ICONS));
+ menu->append(*pMenuItem);
+ Gtk::MenuItem* pMenuItemIcons = pMenuItem;
+
+ pMenuItem = Gtk::manage(new Gtk::MenuItem("Text"));
+ pMenuItem->signal_activate().connect(
+ sigc::bind(sigc::mem_fun(*this, &MainWindowClass::toolbar_item_cb), toolbar, Gtk::TOOLBAR_TEXT));
+ menu->append(*pMenuItem);
+
+ pMenuItem = Gtk::manage(new Gtk::MenuItem("Both"));
+ pMenuItem->signal_activate().connect(
+ sigc::bind(sigc::mem_fun(*this, &MainWindowClass::toolbar_item_cb), toolbar, Gtk::TOOLBAR_BOTH));
+ menu->append(*pMenuItem);
+
+ pMenuItem = Gtk::manage(new Gtk::MenuItem("Both (horiz)"));
+ pMenuItem->signal_activate().connect(
+ sigc::bind(sigc::mem_fun(*this, &MainWindowClass::toolbar_item_cb), toolbar, Gtk::TOOLBAR_BOTH_HORIZ));
+ menu->append(*pMenuItem);
- menu->items()[0].activate();
+ pMenuItemIcons->activate();
show_all_children();
}
diff --git a/examples/others/treemodelcustom/exampletreemodel.cc b/examples/others/treemodelcustom/exampletreemodel.cc
index bf3565f..0ba5c32 100644
--- a/examples/others/treemodelcustom/exampletreemodel.cc
+++ b/examples/others/treemodelcustom/exampletreemodel.cc
@@ -323,14 +323,6 @@ bool ExampleTreeModel::check_treeiter_validity(const iterator& iter) const
return m_stamp == iter.get_stamp();
}
-bool ExampleTreeModel::iter_is_valid(const iterator& iter) const
-{
- if(!check_treeiter_validity(iter))
- return false;
-
- return Gtk::TreeModel::iter_is_valid(iter);
-}
-
void ExampleTreeModel::remember_glue_item(GlueItem* item) const
{
//Add the GlueItem to the model's GlueList, so that
diff --git a/examples/others/treemodelcustom/exampletreemodel.h b/examples/others/treemodelcustom/exampletreemodel.h
index 7cee4ac..c312d53 100644
--- a/examples/others/treemodelcustom/exampletreemodel.h
+++ b/examples/others/treemodelcustom/exampletreemodel.h
@@ -56,8 +56,6 @@ protected:
virtual Path get_path_vfunc(const iterator& iter) const;
virtual bool get_iter_vfunc(const Path& path, iterator& iter) const;
- virtual bool iter_is_valid(const iterator& iter) const;
-
private:
typedef std::vector< Glib::ustring> typeRow; //X columns, all of type string.
typedef std::vector< typeRow > typeListOfRows; //Y rows.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]