Rapicorn - Experimental UI Toolkit - Source Code 10.08.1
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/item.hh>
00006 
00007 namespace Rapicorn {
00008 
00009 class ListModelRelayImpl : public virtual ListModelRelayIface, public virtual ListModelIface {
00010   int                           m_size, m_columns;
00011   vector<AnySeqImpl>            m_rows;
00012   explicit                      ListModelRelayImpl (int n_columns);
00013   virtual                      ~ListModelRelayImpl ();
00014 protected:
00015   static ListModelRelayIface&   create_list_model_relay (int n_columns);
00016 public:
00017   // model API
00018   virtual int                   size            ()              { return m_size; }
00019   virtual int                   columns         ();
00020   virtual AnySeqImpl            row             (int n);
00021   // relay API
00022   virtual void                  resize          (int size);
00023   virtual void                  inserted        (int first, int last);
00024   virtual void                  changed         (int first, int last);
00025   virtual void                  removed         (int first, int last);
00026   virtual void                  fill            (int first, const AnySeqSeqImpl &ss);
00027   virtual ListModelIface*       model           ()              { return this; }
00028   void                          refill          (int first, int last);
00029 };
00030 
00031 class MemoryListStore : public virtual ListModelIface {
00032   uint                  m_columns;
00033   vector<AnySeqImpl>    m_rows;
00034 public:
00035   explicit              MemoryListStore (int n_columns);
00036   virtual int           size            ()              { return m_rows.size(); }
00037   virtual int           columns         ()              { return m_columns; }
00038   virtual AnySeqImpl    row             (int n);
00039   void                  insert          (int  n, const AnySeqImpl &aseq);
00040   void                  update          (uint n, const AnySeqImpl &aseq);
00041   void                  remove          (uint first, uint last = 0);
00042 };
00043 
00044 } // Rapicorn
00045 
00046 #endif  /* __RAPICORN_MODELS_HH__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines