OpenASIP  2.0
OSEdTreeView.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file OSEdTreeView.hh
26  *
27  * Declaration of OSEdTreeView class.
28  *
29  * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_OSED_TREE_VIEW_HH
34 #define TTA_OSED_TREE_VIEW_HH
35 
36 #include <wx/wx.h>
37 #include <wx/treectrl.h>
38 
39 #include <map>
40 #include <string>
41 #include <vector>
42 
43 #include "Exception.hh"
44 
45 class OSEdInfoView;
46 class Operation;
47 
48 /**
49  * Models a tree view of the operation data base.
50  *
51  * Shows a tree-like structure of search paths, operation modules, and
52  * operations.
53  */
54 class OSEdTreeView : public wxTreeCtrl {
55 public:
56  OSEdTreeView(wxWindow* parent, OSEdInfoView* infoView);
57  virtual ~OSEdTreeView();
58 
60  wxTreeItemId selectedOperationId();
61  std::string moduleOfOperation(wxTreeItemId id);
62  wxTreeItemId moduleIdOfOperation(wxTreeItemId id);
63  std::string pathOfModule(wxTreeItemId id);
64  wxTreeItemId pathIdOfModule(wxTreeItemId id);
65  std::string selectedPath();
66  wxTreeItemId selectedPathId();
67  wxTreeItemId selectedModuleId();
68  std::string selectedModule();
69  OSEdInfoView* infoView() const;
70  std::vector<std::string> constructTree();
71  void addItem(wxTreeItemId parent, std::string item);
72  void changeText(wxTreeItemId id, const std::string& text);
73 
74  void removeItem(wxTreeItemId id);
75  void update();
76 
77  bool isPathSelected() const;
78  bool isModuleSelected() const;
79  bool isOperationSelected() const;
80 
81 private:
82  /// Value type for the map.
83  typedef std::map<std::string, wxTreeItemId>::value_type ValType;
84  /// Iterators for the maps.
85  typedef std::map<std::string, wxTreeItemId>::iterator Iter;
86  typedef std::multimap<std::string, wxTreeItemId>::iterator IterM;
87 
88  /// Copying not allowed.
89  OSEdTreeView(const OSEdTreeView&);
90  /// Assignment not allowed.
92 
93  bool isPath(wxTreeItemId id) const;
94  bool isModule(wxTreeItemId id) const;
95  bool isOperation(wxTreeItemId id) const;
96 
97  void onItemClicked(wxTreeEvent& event);
98  void onDropDownMenu(wxMouseEvent& event);
99  void onItemSelected(wxTreeEvent& event);
100 
101  /// An info window controlled by tree view.
103  /// Paths of the operation data base.
104  std::map<std::string, wxTreeItemId> paths_;
105  /// Modules of the operation data base.
106  std::multimap<std::string, wxTreeItemId> modules_;
107  /// Operations of operation data base.
108  std::multimap<std::string, wxTreeItemId> operations_;
109 
110  DECLARE_EVENT_TABLE()
111 };
112 
113 #endif
OSEdTreeView::selectedModule
std::string selectedModule()
Definition: OSEdTreeView.cc:513
OSEdTreeView::selectedModuleId
wxTreeItemId selectedModuleId()
Definition: OSEdTreeView.cc:537
OSEdTreeView::removeItem
void removeItem(wxTreeItemId id)
Definition: OSEdTreeView.cc:622
OSEdTreeView::pathOfModule
std::string pathOfModule(wxTreeItemId id)
Definition: OSEdTreeView.cc:431
OSEdTreeView::isPath
bool isPath(wxTreeItemId id) const
Definition: OSEdTreeView.cc:294
Exception.hh
OSEdTreeView::moduleIdOfOperation
wxTreeItemId moduleIdOfOperation(wxTreeItemId id)
Definition: OSEdTreeView.cc:420
OSEdTreeView::addItem
void addItem(wxTreeItemId parent, std::string item)
Definition: OSEdTreeView.cc:573
OSEdTreeView::selectedPathId
wxTreeItemId selectedPathId()
Definition: OSEdTreeView.cc:480
OSEdTreeView::infoView
OSEdInfoView * infoView() const
Definition: OSEdTreeView.cc:662
OSEdTreeView::onDropDownMenu
void onDropDownMenu(wxMouseEvent &event)
Definition: OSEdTreeView.cc:243
OSEdTreeView::infoView_
OSEdInfoView * infoView_
An info window controlled by tree view.
Definition: OSEdTreeView.hh:102
OSEdTreeView::onItemSelected
void onItemSelected(wxTreeEvent &event)
Definition: OSEdTreeView.cc:171
OSEdTreeView
Definition: OSEdTreeView.hh:54
OSEdTreeView::selectedPath
std::string selectedPath()
Definition: OSEdTreeView.cc:456
OSEdTreeView::moduleOfOperation
std::string moduleOfOperation(wxTreeItemId id)
Definition: OSEdTreeView.cc:407
OSEdTreeView::isOperationSelected
bool isOperationSelected() const
Definition: OSEdTreeView.cc:745
OSEdTreeView::isPathSelected
bool isPathSelected() const
Definition: OSEdTreeView.cc:716
OSEdTreeView::pathIdOfModule
wxTreeItemId pathIdOfModule(wxTreeItemId id)
Definition: OSEdTreeView.cc:444
OSEdTreeView::changeText
void changeText(wxTreeItemId id, const std::string &text)
Definition: OSEdTreeView.cc:592
OSEdInfoView
Definition: OSEdInfoView.hh:47
OSEdTreeView::isModule
bool isModule(wxTreeItemId id) const
Definition: OSEdTreeView.cc:305
OSEdTreeView::OSEdTreeView
OSEdTreeView(wxWindow *parent, OSEdInfoView *infoView)
Definition: OSEdTreeView.cc:71
OSEdTreeView::isModuleSelected
bool isModuleSelected() const
Definition: OSEdTreeView.cc:731
OSEdTreeView::selectedOperation
Operation * selectedOperation()
Definition: OSEdTreeView.cc:328
OSEdTreeView::operator=
OSEdTreeView & operator=(const OSEdTreeView &)
Assignment not allowed.
OSEdTreeView::IterM
std::multimap< std::string, wxTreeItemId >::iterator IterM
Definition: OSEdTreeView.hh:86
Operation
Definition: Operation.hh:59
OSEdTreeView::onItemClicked
void onItemClicked(wxTreeEvent &event)
Definition: OSEdTreeView.cc:220
OSEdTreeView::operations_
std::multimap< std::string, wxTreeItemId > operations_
Operations of operation data base.
Definition: OSEdTreeView.hh:108
OSEdTreeView::update
void update()
Definition: OSEdTreeView.cc:670
OSEdTreeView::selectedOperationId
wxTreeItemId selectedOperationId()
Definition: OSEdTreeView.cc:379
OSEdTreeView::Iter
std::map< std::string, wxTreeItemId >::iterator Iter
Iterators for the maps.
Definition: OSEdTreeView.hh:85
OSEdTreeView::constructTree
std::vector< std::string > constructTree()
Definition: OSEdTreeView.cc:90
OSEdTreeView::paths_
std::map< std::string, wxTreeItemId > paths_
Paths of the operation data base.
Definition: OSEdTreeView.hh:104
OSEdTreeView::ValType
std::map< std::string, wxTreeItemId >::value_type ValType
Value type for the map.
Definition: OSEdTreeView.hh:83
OSEdTreeView::~OSEdTreeView
virtual ~OSEdTreeView()
Definition: OSEdTreeView.cc:78
OSEdTreeView::modules_
std::multimap< std::string, wxTreeItemId > modules_
Modules of the operation data base.
Definition: OSEdTreeView.hh:106
OSEdTreeView::isOperation
bool isOperation(wxTreeItemId id) const
Definition: OSEdTreeView.cc:316