[gtkmm] TreeView, TreeViewColumn: Deprecate SlotCellData, add SlotTreeCellData



commit 9d8f30b3c8451c33fa2a2271c410af56b74165ee
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Tue Sep 15 18:11:20 2015 +0200

    TreeView, TreeViewColumn: Deprecate SlotCellData, add SlotTreeCellData
    
    * gtk/src/treeview.[hg|ccg]:
    * gtk/src/treeviewcolumns.[hg|ccg]:
    * gtk/gtkmm/treeview_private.cc: Deprecate typedef SlotCellData.
    Add SlotTreeCellData. Doxygen generates erroneous links when the typedef in
    TreeViewColumn has the same name as a typedef in the base class CellLayout.
    Bug #657844.

 gtk/gtkmm/treeview_private.cc |    8 ++------
 gtk/src/treeview.ccg          |    4 ++--
 gtk/src/treeview.hg           |   12 +++++++++---
 gtk/src/treeviewcolumn.ccg    |    4 ++--
 gtk/src/treeviewcolumn.hg     |   14 +++++++++++++-
 5 files changed, 28 insertions(+), 14 deletions(-)
---
diff --git a/gtk/gtkmm/treeview_private.cc b/gtk/gtkmm/treeview_private.cc
index f9aac13..ab793cb 100644
--- a/gtk/gtkmm/treeview_private.cc
+++ b/gtk/gtkmm/treeview_private.cc
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 /* Copyright(C) 2001-2002 The gtkmm Development Team
  *
  * This library is free software; you can redistribute it and/or
@@ -33,7 +31,7 @@ void SignalProxy_CellData_gtk_callback(GtkTreeViewColumn*, GtkCellRenderer* cell
   if(!model)
     g_warning("SignalProxy_CellData_gtk_callback(): model is NULL, which is unusual.\n");
 
-  TreeViewColumn::SlotCellData* the_slot = static_cast<TreeViewColumn::SlotCellData*>(data);
+  TreeViewColumn::SlotTreeCellData* the_slot = static_cast<TreeViewColumn::SlotTreeCellData*>(data);
 
   try
   {
@@ -55,7 +53,7 @@ void SignalProxy_CellData_gtk_callback(GtkTreeViewColumn*, GtkCellRenderer* cell
 
 void SignalProxy_CellData_gtk_callback_destroy(void* data)
 {
-  delete static_cast<TreeViewColumn::SlotCellData*>(data);
+  delete static_cast<TreeViewColumn::SlotTreeCellData*>(data);
 }
 
 
@@ -80,8 +78,6 @@ void SignalProxy_RowSeparator_gtk_callback_destroy(void* data)
   delete static_cast<TreeView::SlotRowSeparator*>(data);
 }
 
-
 } // namespace TreeView_Private
 
 } // namespace Gtk
-
diff --git a/gtk/src/treeview.ccg b/gtk/src/treeview.ccg
index 86fd53a..0d41d45 100644
--- a/gtk/src/treeview.ccg
+++ b/gtk/src/treeview.ccg
@@ -117,11 +117,11 @@ static void SignalProxy_SearchPosition_gtk_callback_destroy(void* data)
 namespace Gtk
 {
 
-int TreeView::insert_column_with_data_func(int position, const Glib::ustring& title, CellRenderer& cell, 
const SlotCellData& slot)
+int TreeView::insert_column_with_data_func(int position, const Glib::ustring& title, CellRenderer& cell, 
const SlotTreeCellData& slot)
 {
   //Create a copy of the slot. A pointer to this will be passed through the callback's data parameter.
   //It will be deleted when TreeView_Private::SignalProxy_CellData_gtk_callback_destroy() is called.
-  auto slot_copy = new SlotCellData(slot);
+  auto slot_copy = new SlotTreeCellData(slot);
 
   return gtk_tree_view_insert_column_with_data_func(
       gobj(), position, title.c_str(), cell.gobj(),
diff --git a/gtk/src/treeview.hg b/gtk/src/treeview.hg
index 1c671f5..764c14f 100644
--- a/gtk/src/treeview.hg
+++ b/gtk/src/treeview.hg
@@ -263,11 +263,17 @@ public:
   template <class ColumnType> inline
   int insert_column_editable(const Glib::ustring& title, const TreeModelColumn<ColumnType>& model_column, 
int position);
 
+_DEPRECATE_IFDEF_START
+  /** @deprecated Use SlotTreeCellData instead.
+   */
   typedef TreeViewColumn::SlotCellData SlotCellData;
+_DEPRECATE_IFDEF_END
+
+  typedef TreeViewColumn::SlotTreeCellData SlotTreeCellData;
 
   /**
    * Inserts a new column into the TreeView with the given cell
-   * renderer and a SlotCellData to set cell renderer attributes
+   * renderer and a SlotTreeCellData to set cell renderer attributes
    * (normally using data from the model).
    *
    * @param position Position to insert, -1 for append
@@ -276,7 +282,7 @@ public:
    * @param slot function to set attributes of cell renderer
    * @return number of columns in the TreeView after the insert
    */
-  int insert_column_with_data_func(int position, const Glib::ustring& title, CellRenderer& cell, const 
SlotCellData& slot);
+  int insert_column_with_data_func(int position, const Glib::ustring& title, CellRenderer& cell, const 
SlotTreeCellData& slot);
 
   _WRAP_METHOD(guint get_n_columns() const, gtk_tree_view_get_n_columns)
 
@@ -890,7 +896,7 @@ int TreeView::append_column_numeric(const Glib::ustring& title, const TreeModelC
 
   //Connect a cell_data callback, to show the number's text representation in the specified format:
   //We use sigc::bind<-1> twice here, instead of sigc::bind() once, because some compilers need the extra 
hint.
-  Gtk::TreeViewColumn::SlotCellData slot = sigc::bind<-1>(
+  Gtk::TreeViewColumn::SlotTreeCellData slot = sigc::bind<-1>(
     sigc::bind<-1>( sigc::ptr_fun(fptr), format),
     model_column.index()
   );
diff --git a/gtk/src/treeviewcolumn.ccg b/gtk/src/treeviewcolumn.ccg
index c923de6..788be62 100644
--- a/gtk/src/treeviewcolumn.ccg
+++ b/gtk/src/treeviewcolumn.ccg
@@ -62,11 +62,11 @@ void TreeViewColumn::set_renderer(Gtk::CellRenderer& renderer, const TreeModelCo
 }
 
 
-void TreeViewColumn::set_cell_data_func(CellRenderer& cell_renderer, const SlotCellData& slot)
+void TreeViewColumn::set_cell_data_func(CellRenderer& cell_renderer, const SlotTreeCellData& slot)
 {
   //Create a copy of the slot. A pointer to this will be passed through the callback's data parameter.
   //It will be deleted when TreeView_Private::SignalProxy_CellData_gtk_callback_destroy() is called.
-  auto slot_copy = new SlotCellData(slot);
+  auto slot_copy = new SlotTreeCellData(slot);
 
   gtk_tree_view_column_set_cell_data_func(
       gobj(), cell_renderer.gobj(),
diff --git a/gtk/src/treeviewcolumn.hg b/gtk/src/treeviewcolumn.hg
index 3f4e2b6..6c1fec4 100644
--- a/gtk/src/treeviewcolumn.hg
+++ b/gtk/src/treeviewcolumn.hg
@@ -114,13 +114,25 @@ public:
 
  // _WRAP_METHOD(void set_attributes(CellRenderer& cell_renderer, ...), )
 
+_DEPRECATE_IFDEF_START
   /** For instance,
    * void on_cell_data(Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter);
    *
    * This function is used instead of the standard attributes mapping for setting the column value, and 
should set the
    * value of the column's cell renderer as appropriate.
+   *
+   * @deprecated Use SlotTreeCellData instead.
    */
   typedef sigc::slot<void, CellRenderer*, const Gtk::TreeModel::iterator&> SlotCellData;
+_DEPRECATE_IFDEF_END
+
+  /** For instance,
+   * void on_cell_data(Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter);
+   *
+   * This function is used instead of the standard attributes mapping for setting the column value, and 
should set the
+   * value of the column's cell renderer as appropriate.
+   */
+  typedef sigc::slot<void, CellRenderer*, const Gtk::TreeModel::iterator&> SlotTreeCellData;
 
   /** Sets the slot callback to use for the column.
    * This callback function is used instead of the standard attributes mapping for setting the column value, 
and should set the
@@ -131,7 +143,7 @@ public:
    * @param cell_renderer A Gtk::CellRenderer
    * @param slot The callback slot to use. Create this with sigc::mem_fun(), or sigc::ptr_fun().
    */
-  void set_cell_data_func(CellRenderer& cell_renderer, const SlotCellData& slot);
+  void set_cell_data_func(CellRenderer& cell_renderer, const SlotTreeCellData& slot);
 
   /** Removes a previously set callback slot. See set_cell_data_func().
    */


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