Scopira  20080306
view.h
1 
2 /*
3  * Copyright (c) 2004 National Research Council
4  *
5  * All rights reserved.
6  *
7  * This material is confidential and proprietary information of
8  * National Research Council Canada ("Confidential Information").
9  * This Confidential Information may only be used and reproduced
10  * in accordance with the terms of the license agreement.
11  *
12  */
13 
14 #ifndef __INCLUDED_SCOPIRA_CORE_VIEW_H__
15 #define __INCLUDED_SCOPIRA_CORE_VIEW_H__
16 
17 #include <string>
18 
19 #include <scopira/tool/object.h>
20 #include <scopira/tool/export.h>
21 
22 namespace scopira
23 {
24  namespace core
25  {
26  class view_action_reactor_i;
27  class view_container_reactor_i;
28 
29  class view_i;
30 
31  class model_i; //fwd
32 
41  }
42 }
43 
44 // internal handler interface
46 {
47  public:
48  SCOPIRA_EXPORT virtual ~view_action_reactor_i() { }
49  SCOPIRA_EXPORT virtual void react_view_action(scopira::core::view_i *source, int actionID) = 0;
50  SCOPIRA_EXPORT virtual void react_view_set_title(scopira::core::view_i *source, const std::string &newtitle) = 0;
51 };
52 
60 {
61  public:
62  SCOPIRA_EXPORT virtual ~view_container_reactor_i() { }
71  SCOPIRA_EXPORT virtual void react_view_insert(scopira::core::model_i *m, scopira::core::view_i *v) = 0;
72 };
73 
81 {
82  private:
83  view_action_reactor_i *dm_action_handler;
84  std::string dm_pretitle; //used if we get title change requests before we actually have a listener
85 
86  public:
94  SCOPIRA_EXPORT virtual void bind_model(scopira::core::model_i *sus);
96  SCOPIRA_EXPORT virtual void react_model_update(scopira::core::model_i *sus, scopira::core::view_i *src);
97 
99  SCOPIRA_EXPORT void set_view_action_reactor(view_action_reactor_i *vh);
100 
101  protected:
102  SCOPIRA_EXPORT view_i(void);
103 
105  SCOPIRA_EXPORT void react_view_action(int actionID);
106 
108  SCOPIRA_EXPORT void set_view_title(const std::string &newtitle);
109 };
110 
112 {
113  v->bind_model(m);
114  v->react_model_update(m, 0);
115 }
116 
117 #endif
118 
void bind_model_view(scopira::core::model_i *m, scopira::core::view_i *v)
Definition: view.h:111
Definition: archiveflow.h:20
virtual void bind_model(scopira::core::model_i *sus)
Definition: object.h:71
Definition: model.h:216
virtual void react_model_update(scopira::core::model_i *sus, scopira::core::view_i *src)
called when the model_i has "changed" by the given inspector (might be null)
Definition: view.h:80