Rapicorn - Experimental UI Toolkit - Source Code  13.07.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
selob.hh
Go to the documentation of this file.
00001  // Licensed GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html
00002 #ifndef __RAPICORN_SELOB_HH__
00003 #define __RAPICORN_SELOB_HH__
00004 
00005 #include <ui/selector.hh>
00006 #include <ui/widget.hh>
00007 #include <ui/models.hh>
00008 
00009 namespace Rapicorn {
00010 namespace Selector {
00011 
00012 class SelobAllocator;
00013 
00014 class SelobWidget : public Selob {
00015   WidgetImpl       &widget_;
00016   SelobWidget      *parent_;
00017   int64           n_children_;
00018   SelobAllocator &allocator_;
00019   friend class SelobAllocator;
00020   explicit             SelobWidget       (SelobAllocator &allocator, WidgetImpl &widget);
00021   void                 cache_parent    ();
00022   void                 cache_n_children();
00023 public:
00024   virtual             ~SelobWidget       ();
00025   virtual String       get_id          ();
00026   virtual String       get_type        ();
00027   virtual ConstTypes&  get_type_list   ();
00028   virtual bool         has_property    (const String &name);
00029   virtual String       get_property    (const String &name);
00030   virtual Selob*       get_parent      ();
00031   virtual Selob*       get_sibling     (int64 dir);
00032   virtual bool         has_children    ();
00033   virtual int64        n_children      ();
00034   virtual Selob*       get_child       (int64 index);
00035   virtual bool         is_nth_child    (int64 nth1based);
00036   virtual Selob*       pseudo_selector (const String &ident, const String &arg, String &error);
00037 };
00038 
00039 class SelobListModel : public Selob {
00040   ListModelIface      &lmodel_;
00041   StringVector         type_list_;
00042   String               row_constraint_, col_constraint_, value_constraint_, type_constraint_;
00043   uint                 f_row_constraint : 1, f_col_constraint : 1, f_value_constraint : 1, f_type_constraint : 1;
00044   explicit             SelobListModel  (SelobAllocator &allocator, ListModelIface &lmodel);
00045 public:
00046   virtual             ~SelobListModel  ();
00047   virtual String       get_id          ();
00048   virtual String       get_type        ();
00049   virtual ConstTypes&  get_type_list   ();
00050   virtual bool         has_property    (const String &name)     { return false; }
00051   virtual String       get_property    (const String &name)     { return ""; }
00052   virtual Selob*       get_parent      ()                       { return NULL; }
00053   virtual Selob*       get_sibling     (int64 dir)              { return NULL; }
00054   virtual bool         has_children    ()                       { return false; }
00055   virtual int64        n_children      ()                       { return 0; }
00056   virtual Selob*       get_child       (int64 index)            { return NULL; }
00057   virtual bool         is_nth_child    (int64 nth1based)        { return false; }
00058   virtual Selob*       pseudo_selector (const String &ident, const String &arg, String &error);
00059 };
00060 
00061 class SelobAllocator {
00062   vector<SelobWidget*> selobs_;
00063 public:
00064   explicit               SelobAllocator  ();
00065   virtual               ~SelobAllocator  ();
00066   SelobWidget*             widget_selob      (WidgetImpl &widget);
00067   WidgetImpl*              selob_widget      (Selob    &selob);
00068   static SelobAllocator* selob_allocator (Selob    &selob);
00069 };
00070 
00071 } // Selector
00072 } // Rapicorn
00073 
00074 #endif /* __RAPICORN_SELOB_HH__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines