[gtkmm] Gtk::TreeView: Move template specializations to the .ccg file
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Gtk::TreeView: Move template specializations to the .ccg file
- Date: Fri, 20 Oct 2017 15:09:19 +0000 (UTC)
commit 4593252e8a90bf464e1d6a15ebf1ae18fd3ce7ea
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Fri Oct 20 17:07:32 2017 +0200
Gtk::TreeView: Move template specializations to the .ccg file
Move the specializations of _connect_auto_store_editable_signal_handler<>()
to the .ccg file.
gtk/src/treeview.ccg | 82 +++++++++++++++++++++++++++++++++++++++++++++++++-
gtk/src/treeview.hg | 81 +++++++++++++------------------------------------
2 files changed, 103 insertions(+), 60 deletions(-)
---
diff --git a/gtk/src/treeview.ccg b/gtk/src/treeview.ccg
index 5c98f11..02d7e19 100644
--- a/gtk/src/treeview.ccg
+++ b/gtk/src/treeview.ccg
@@ -474,7 +474,87 @@ void TreeView::unset_row_separator_func()
namespace TreeView_Private
{
-// Complete specializations of _convert_from_ustring_to_numeric_type()
+// Specializations of _connect_auto_store_editable_signal_handler()
+
+//bool specialization:
+template<>
+void _connect_auto_store_editable_signal_handler<bool>(Gtk::TreeView* this_p,
+ Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<bool>& model_column)
+{
+ Gtk::CellRendererToggle* pCellToggle = dynamic_cast<Gtk::CellRendererToggle*>(pCellRenderer);
+ if(pCellToggle)
+ {
+ //Set the appropriate property,
+ pCellToggle->property_activatable() = true;
+
+ //Connect to the appropriate signal, sending the model_column too
+
+ sigc::slot<void(const Glib::ustring&, int)> slot_temp =
+ sigc::bind<-1>(
+ sigc::mem_fun(*this_p, &Gtk::TreeView::_auto_store_on_cellrenderer_toggle_edited_with_model),
+ this_p->get_model()
+ );
+
+ pCellToggle->signal_toggled().connect(
+ sigc::bind<-1>(
+ slot_temp,
+ model_column.index()
+ )
+ );
+
+ //We use bind<-1> instead of bind because some compilers need the extra hint.
+ }
+}
+
+//int specialization:
+template<>
+void _connect_auto_store_editable_signal_handler<int>(Gtk::TreeView* this_p,
+ Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<int>& model_column)
+{
+ _connect_auto_store_numeric_editable_signal_handler<int>(this_p, pCellRenderer, model_column);
+}
+
+//unsigned int specialization:
+template<>
+void _connect_auto_store_editable_signal_handler<unsigned int>(Gtk::TreeView* this_p,
+ Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<unsigned int>& model_column)
+{
+ _connect_auto_store_numeric_editable_signal_handler<unsigned int>(this_p, pCellRenderer, model_column);
+}
+
+//long specialization:
+template<>
+void _connect_auto_store_editable_signal_handler<long>(Gtk::TreeView* this_p,
+ Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<long>& model_column)
+{
+ _connect_auto_store_numeric_editable_signal_handler<long>(this_p, pCellRenderer, model_column);
+}
+
+//unsigned long specialization:
+template<>
+void _connect_auto_store_editable_signal_handler<unsigned long>(Gtk::TreeView* this_p,
+ Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<unsigned long>& model_column)
+{
+ _connect_auto_store_numeric_editable_signal_handler<unsigned long>(this_p, pCellRenderer, model_column);
+}
+
+//float specialization:
+template<>
+void _connect_auto_store_editable_signal_handler<float>(Gtk::TreeView* this_p,
+ Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<float>& model_column)
+{
+ _connect_auto_store_numeric_editable_signal_handler<float>(this_p, pCellRenderer, model_column);
+}
+
+//double specialization:
+template<>
+void _connect_auto_store_editable_signal_handler<double>(Gtk::TreeView* this_p,
+ Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<double>& model_column)
+{
+ _connect_auto_store_numeric_editable_signal_handler<double>(this_p, pCellRenderer, model_column);
+}
+
+// Specializations of _convert_from_ustring_to_numeric_type()
// Floating point specializations
template<>
diff --git a/gtk/src/treeview.hg b/gtk/src/treeview.hg
index bbcb99e..5c62bc5 100644
--- a/gtk/src/treeview.hg
+++ b/gtk/src/treeview.hg
@@ -55,7 +55,7 @@ namespace TreeView_Private
* functions of TreeView since we connect them to signals and we want the
* connections to vanish when the TreeView dies, of course.)
*/
- template <class ColumnType> inline
+ template <class ColumnType>
void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer,
const Gtk::TreeModelColumn<ColumnType>& model_column);
template <class ColumnType> inline
@@ -947,7 +947,6 @@ namespace TreeView_Private
{
//Template specializations, for different model column types:
-//TODO: Move these specializations into the .ccg file - I tried, but the int specialization was not used by
the compiler. murrayc.
// append_column_editable<>() and insert_column_editable<>() call template function
// _connect_auto_store_editable_signal_handler<ColumnType>().
@@ -978,75 +977,39 @@ namespace TreeView_Private
// append_column_numeric<>() and append_column_numeric_editable<>().
//bool specialization:
-template<> inline
-void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer,
const Gtk::TreeModelColumn<bool>& model_column)
-{
- Gtk::CellRendererToggle* pCellToggle = dynamic_cast<Gtk::CellRendererToggle*>(pCellRenderer);
- if(pCellToggle)
- {
- //Set the appropriate property,
- pCellToggle->property_activatable() = true;
-
- //Connect to the appropriate signal, sending the model_column too
-
- sigc::slot<void(const Glib::ustring&, int)> slot_temp =
- sigc::bind<-1>(
- sigc::mem_fun(*this_p, &Gtk::TreeView::_auto_store_on_cellrenderer_toggle_edited_with_model),
- this_p->get_model()
- );
-
- pCellToggle->signal_toggled().connect(
- sigc::bind<-1>(
- slot_temp,
- model_column.index()
- )
- );
-
- //We use bind<-1> instead of bind because some compilers need the extra hint.
- }
-}
+template<>
+void _connect_auto_store_editable_signal_handler<bool>(Gtk::TreeView* this_p,
+ Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<bool>& model_column);
//int specialization:
-template<> inline
-void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer,
const Gtk::TreeModelColumn<int>& model_column)
-{
- _connect_auto_store_numeric_editable_signal_handler<int>(this_p, pCellRenderer, model_column);
-}
+template<>
+void _connect_auto_store_editable_signal_handler<int>(Gtk::TreeView* this_p,
+ Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<int>& model_column);
//unsigned int specialization:
-template<> inline
-void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer,
const Gtk::TreeModelColumn<unsigned int>& model_column)
-{
- _connect_auto_store_numeric_editable_signal_handler<unsigned int>(this_p, pCellRenderer, model_column);
-}
+template<>
+void _connect_auto_store_editable_signal_handler<unsigned int>(Gtk::TreeView* this_p,
+ Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<unsigned int>& model_column);
//long specialization:
-template<> inline
-void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer,
const Gtk::TreeModelColumn<long>& model_column)
-{
- _connect_auto_store_numeric_editable_signal_handler<long>(this_p, pCellRenderer, model_column);
-}
+template<>
+void _connect_auto_store_editable_signal_handler<long>(Gtk::TreeView* this_p,
+ Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<long>& model_column);
//unsigned long specialization:
-template<> inline
-void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer,
const Gtk::TreeModelColumn<unsigned long>& model_column)
-{
- _connect_auto_store_numeric_editable_signal_handler<unsigned long>(this_p, pCellRenderer, model_column);
-}
+template<>
+void _connect_auto_store_editable_signal_handler<unsigned long>(Gtk::TreeView* this_p,
+ Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<unsigned long>& model_column);
//float specialization:
-template<> inline
-void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer,
const Gtk::TreeModelColumn<float>& model_column)
-{
- _connect_auto_store_numeric_editable_signal_handler<float>(this_p, pCellRenderer, model_column);
-}
+template<>
+void _connect_auto_store_editable_signal_handler<float>(Gtk::TreeView* this_p,
+ Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<float>& model_column);
//double specialization:
-template<> inline
-void _connect_auto_store_editable_signal_handler(Gtk::TreeView* this_p, Gtk::CellRenderer* pCellRenderer,
const Gtk::TreeModelColumn<double>& model_column)
-{
- _connect_auto_store_numeric_editable_signal_handler<double>(this_p, pCellRenderer, model_column);
-}
+template<>
+void _connect_auto_store_editable_signal_handler<double>(Gtk::TreeView* this_p,
+ Gtk::CellRenderer* pCellRenderer, const Gtk::TreeModelColumn<double>& model_column);
} // namespace TreeView_Private
#endif //DOXYGEN_SHOULD_SKIP_THIS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]