Cafu Engine
SubmodelsList.hpp
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
6 
7 #ifndef CAFU_MODELEDITOR_SUBMODELS_LIST_HPP_INCLUDED
8 #define CAFU_MODELEDITOR_SUBMODELS_LIST_HPP_INCLUDED
9 
10 #include "ObserverPattern.hpp"
11 #include "wx/listctrl.h"
12 #include "wx/panel.h"
13 
14 
15 namespace ModelEditor
16 {
17  class ChildFrameT;
18  class ModelDocumentT;
19 
20 
21  /// A control for displaying a list of the submodels that are rendered with the model.
22  class SubmodelsListT : public wxListView, public ObserverT
23  {
24  public:
25 
26  /// The constructor.
27  SubmodelsListT(ChildFrameT* MainFrame, wxWindow* Parent, const wxSize& Size);
28 
29  /// The destructor.
31 
32  // ObserverT implementation.
33  void Notify_SubmodelsChanged(SubjectT* Subject);
34  void Notify_SubjectDies(SubjectT* dyingSubject);
35 
36 
37  private:
38 
39  friend class SubmodelsPanelT;
40 
41  void InitListItems();
42  void LoadSubmodel();
43  void UnloadSelectedSubmodels();
44 
45  void OnContextMenu (wxContextMenuEvent& CE);
46  void OnItemActivated(wxListEvent& LE); ///< The item has been activated (ENTER or double click).
47 
48  DECLARE_EVENT_TABLE()
49 
50  ModelDocumentT* m_ModelDoc;
51  ChildFrameT* m_MainFrame;
52  bool m_IsRecursiveSelfNotify;
53  };
54 
55 
56  class SubmodelsPanelT : public wxPanel
57  {
58  public:
59 
60  SubmodelsPanelT(ChildFrameT* MainFrame, const wxSize& Size);
61 
62 
63  private:
64 
65  /// IDs for the controls whose events we are interested in.
66  enum
67  {
68  ID_LISTVIEW=wxID_HIGHEST+1,
69  ID_BUTTON_LOAD,
70  ID_BUTTON_UP,
71  ID_BUTTON_DOWN,
72  ID_BUTTON_UNLOAD
73  };
74 
75  void OnButton(wxCommandEvent& Event);
76  void OnButtonUpdate(wxUpdateUIEvent& UE);
77 
78  ModelDocumentT* m_ModelDoc;
79  ChildFrameT* m_MainFrame;
80  SubmodelsListT* m_List;
81 
82  DECLARE_EVENT_TABLE()
83  };
84 }
85 
86 #endif
A control for displaying a list of the submodels that are rendered with the model.
Definition: SubmodelsList.hpp:22
~SubmodelsListT()
The destructor.
Definition: SubmodelsList.cpp:49
Definition: ChildFrame.hpp:35
void Notify_SubmodelsChanged(SubjectT *Subject)
Notifies the observer that the list of submodels has changed.
Definition: SubmodelsList.cpp:56
void Notify_SubjectDies(SubjectT *dyingSubject)
This method is called whenever a subject is about the be destroyed (and become unavailable).
Definition: SubmodelsList.cpp:64
This class represents a child frame.
Definition: ChildFrame.hpp:55
SubmodelsListT(ChildFrameT *MainFrame, wxWindow *Parent, const wxSize &Size)
The constructor.
Definition: SubmodelsList.cpp:32
Definition: ObserverPattern.hpp:104
This file provides the classes for the Observer pattern as described in the book by the GoF...
Definition: ObserverPattern.hpp:28
Definition: SubmodelsList.hpp:56
Definition: ModelDocument.hpp:30