Rapicorn - Experimental UI Toolkit - Source Code  13.07.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
models.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_MODELS_HH__
00003 #define __RAPICORN_MODELS_HH__
00004 
00005 #include <ui/widget.hh>
00006 
00007 namespace Rapicorn {
00008 
00009 class ListModelRelayImpl : public virtual ListModelRelayIface {
00010   struct RelayModel : public virtual ListModelIface {
00011     vector<Any>                 rows_;
00012     virtual int                 count           ()              { return rows_.size(); }
00013     virtual Any                 row             (int n);
00014     virtual void                delete_this     ()              { /* do nothing for embedded object */ }
00015   };
00016   RelayModel                    model_;
00017   void                          emit_updated            (UpdateKind kind, uint start, uint length);
00018   explicit                      ListModelRelayImpl      ();
00019 protected:
00020   virtual                      ~ListModelRelayImpl      ();
00021   static ListModelRelayImpl&    create_list_model_relay ();
00022 public:
00023   virtual void                  update          (const UpdateRequest &urequest);
00024   virtual void                  fill            (int first, const AnySeq &aseq);
00025   virtual ListModelIface*       model           ()              { return &model_; }
00026   void                          refill          (int start, int length);
00027 };
00028 
00029 class MemoryListStore : public virtual ListModelIface {
00030   vector<Any>           rows_;
00031   uint                  columns_;
00032   void                  emit_updated    (UpdateKind kind, uint start, uint length);
00033 public:
00034   explicit              MemoryListStore (int n_columns);
00035   virtual int           count           ()              { return rows_.size(); }
00036   virtual Any           row             (int n);
00037   void                  insert          (int  n, const Any &aseq);
00038   void                  update_row      (uint n, const Any &aseq);
00039   void                  remove          (uint start, uint length);
00040 };
00041 
00042 
00043 } // Rapicorn
00044 
00045 #endif  /* __RAPICORN_MODELS_HH__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines