[glom/maemo5] An attempt. Probably wrong.



commit a7c81f09e40433ee3237b365ecaa73c626c6965f
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Oct 8 14:01:39 2009 +0200

    An attempt. Probably wrong.

 glom/utility_widgets/comboentryglom.cc |   31 ++++++++++++++++++-------------
 glom/utility_widgets/comboentryglom.h  |   25 +++++++++++++++++++++----
 glom/utility_widgets/comboglom.cc      |   10 ----------
 glom/utility_widgets/comboglom.h       |    6 ++++--
 4 files changed, 43 insertions(+), 29 deletions(-)
---
diff --git a/glom/utility_widgets/comboentryglom.cc b/glom/utility_widgets/comboentryglom.cc
index 9c915f1..458551a 100644
--- a/glom/utility_widgets/comboentryglom.cc
+++ b/glom/utility_widgets/comboentryglom.cc
@@ -34,16 +34,6 @@
 namespace Glom
 {
 
-ComboEntryGlom::ComboEntryGlom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& /* builder */)
-: Gtk::ComboBoxEntry(cobject)
-{
-#ifndef GLOM_ENABLE_CLIENT_ONLY
-  setup_menu();
-#endif // !GLOM_ENABLE_CLIENT_ONLY
-
-  init();
-}
-
 ComboEntryGlom::ComboEntryGlom()
 : ComboGlomChoicesBase()
 {
@@ -66,9 +56,16 @@ ComboEntryGlom::ComboEntryGlom(const sharedptr<LayoutItem_Field>& field_second)
 
 void ComboEntryGlom::init()
 {
+#ifndef GLOM_ENABLE_MAEMO
   set_model(m_refModel);
 
   set_text_column(m_Columns.m_col_first);
+#else
+  //Maemo:
+  set_model(0, m_refModel);
+
+  set_text_column(0);
+#endif
 
   //We use connect(slot, false) to connect before the default signal handler, because the default signal handler prevents _further_ handling.
 #ifndef GLOM_ENABLE_CLIENT_ONLY
@@ -84,6 +81,7 @@ void ComboEntryGlom::init()
 
   if(m_with_second)
   {
+    #ifndef GLOM_ENABLE_MAEMO
     //We don't use this convenience method, because we want more control over the renderer.
     //and CellLayout gives no way to get the renderer back afterwards.
     //(well, maybe set_cell_data_func(), but that's a bit awkward.)
@@ -96,11 +94,14 @@ void ComboEntryGlom::init()
     pack_start(*cell_second);
 
     //Make the renderer render the column:
-#ifdef GLIBMM_PROPERTIES_ENABLED
+    #ifdef GLIBMM_PROPERTIES_ENABLED
     add_attribute(cell_second->_property_renderable(), m_Columns.m_col_second);
-#else
+    #else
     add_attribute(*cell_second, cell_second->_property_renderable(), m_Columns.m_col_second);
-#endif
+    #endif
+    #else //GLOM_ENABLE_MAEMO
+    //TODO: Add the second cell renderer.
+    #endif //GLOM_ENABLE_MAEMO
   }
 }
 
@@ -263,7 +264,11 @@ App_Glom* ComboEntryGlom::get_application()
   return dynamic_cast<App_Glom*>(pWindow);
 }
 
+#ifndef GLOM_ENABLE_MAEMO
 void ComboEntryGlom::on_changed()
+#else
+void ComboEntryGlom::on_changed(int column)
+#endif 
 {
 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
   //Call base class:
diff --git a/glom/utility_widgets/comboentryglom.h b/glom/utility_widgets/comboentryglom.h
index 7e65975..71c2850 100644
--- a/glom/utility_widgets/comboentryglom.h
+++ b/glom/utility_widgets/comboentryglom.h
@@ -28,20 +28,31 @@
 #include "comboglomchoicesbase.h"
 #include <gtkmm/builder.h>
 
+#ifdef GLOM_ENABLE_MAEMO
+#include <hildonmm/touch-selector-entry.h>
+#endif //GLOM_ENABLE_MAEMO
+
 namespace Glom
 {
 
 class App_Glom;
 
+/** A Gtk::ComboBoxEntry that can show choices of field values.
+ * Use this when the user should be allowed to enter values directly too,
+ * including values that are not in the choices.
+ */
 class ComboEntryGlom
-: public Gtk::ComboBoxEntry,
+: 
+#ifndef GLOM_ENABLE_MAEMO
+  public Gtk::ComboBoxEntry,
+#else
+  public Hildon::TouchSelectorEntry,
+#endif
   public ComboGlomChoicesBase
 {
 public:
-  explicit ComboEntryGlom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
-
   ///You must call set_layout_item() to specify the field type and formatting of the main column.
-  explicit ComboEntryGlom();
+  ComboEntryGlom();
 
   ///You must call set_layout_item() to specify the field type and formatting of the main column.
   explicit ComboEntryGlom(const sharedptr<LayoutItem_Field>& field_second);
@@ -72,9 +83,15 @@ private:
   virtual void on_entry_activate(); //From Gtk::Entry.
   virtual bool on_entry_focus_out_event(GdkEventFocus* event); //From Gtk::Widget
 
+  
+  #ifndef GLOM_ENABLE_MAEMO
   // Note that this is a normal signal handler when glibmm was complied
   // without default signal handlers
   virtual void on_changed(); //From Gtk::ComboBox
+  #else
+  void on_changed(int column);
+  #endif
+  
 
   virtual void check_for_change();
 
diff --git a/glom/utility_widgets/comboglom.cc b/glom/utility_widgets/comboglom.cc
index b03450e..40a2f8c 100644
--- a/glom/utility_widgets/comboglom.cc
+++ b/glom/utility_widgets/comboglom.cc
@@ -34,16 +34,6 @@
 namespace Glom
 {
 
-ComboGlom::ComboGlom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& /* builder */)
-: Gtk::ComboBox(cobject)
-{
-#ifndef GLOM_ENABLE_CLIENT_ONLY
-  setup_menu();
-#endif // !GLOM_ENABLE_CLIENT_ONLY
-
-  init();
-}
-
 ComboGlom::ComboGlom()
 : ComboGlomChoicesBase()
 {
diff --git a/glom/utility_widgets/comboglom.h b/glom/utility_widgets/comboglom.h
index ad09f42..ff5a2b4 100644
--- a/glom/utility_widgets/comboglom.h
+++ b/glom/utility_widgets/comboglom.h
@@ -33,15 +33,17 @@ namespace Glom
 
 class App_Glom;
 
+/** A Gtk::ComboBox that can show choices of field values.
+ * Use this when the user should only be allowed to enter values that are in the choices.
+ */
 class ComboGlom
 : public Gtk::ComboBox,
   public ComboGlomChoicesBase
 {
 public:
-  explicit ComboGlom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
 
   ///You must call set_layout_item() to specify the field type and formatting of the main column.
-  explicit ComboGlom();
+  ComboGlom();
 
   ///You must call set_layout_item() to specify the field type and formatting of the main column.
   explicit ComboGlom(const sharedptr<LayoutItem_Field>& field_second);



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