OpenASIP 2.2
Loading...
Searching...
No Matches
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
45class OSEdInfoView;
46class 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 */
54class OSEdTreeView : public wxTreeCtrl {
55public:
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
81private:
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.
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
bool isModuleSelected() const
wxTreeItemId selectedModuleId()
std::string pathOfModule(wxTreeItemId id)
std::multimap< std::string, wxTreeItemId > operations_
Operations of operation data base.
std::vector< std::string > constructTree()
void changeText(wxTreeItemId id, const std::string &text)
void onItemClicked(wxTreeEvent &event)
bool isOperationSelected() const
wxTreeItemId selectedOperationId()
void addItem(wxTreeItemId parent, std::string item)
virtual ~OSEdTreeView()
Operation * selectedOperation()
OSEdInfoView * infoView() const
bool isPathSelected() const
std::map< std::string, wxTreeItemId > paths_
Paths of the operation data base.
std::string selectedPath()
void onDropDownMenu(wxMouseEvent &event)
std::map< std::string, wxTreeItemId >::value_type ValType
Value type for the map.
OSEdTreeView & operator=(const OSEdTreeView &)
Assignment not allowed.
std::map< std::string, wxTreeItemId >::iterator Iter
Iterators for the maps.
OSEdTreeView(const OSEdTreeView &)
Copying not allowed.
bool isPath(wxTreeItemId id) const
bool isOperation(wxTreeItemId id) const
wxTreeItemId selectedPathId()
void removeItem(wxTreeItemId id)
bool isModule(wxTreeItemId id) const
OSEdInfoView * infoView_
An info window controlled by tree view.
std::string selectedModule()
wxTreeItemId moduleIdOfOperation(wxTreeItemId id)
void onItemSelected(wxTreeEvent &event)
wxTreeItemId pathIdOfModule(wxTreeItemId id)
std::multimap< std::string, wxTreeItemId > modules_
Modules of the operation data base.
std::multimap< std::string, wxTreeItemId >::iterator IterM
std::string moduleOfOperation(wxTreeItemId id)