Minsky
selection.h
Go to the documentation of this file.
1 /*
2  @copyright Steve Keen 2013
3  @author Russell Standish
4  This file is part of Minsky.
5 
6  Minsky is free software: you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Minsky is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Minsky. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef SELECTION_H
21 #define SELECTION_H
22 
23 #include "group.h"
24 
25 #include <cairo_base.h>
26 
27 #include <vector>
28 
29 namespace minsky
30 {
32  struct Selection: public Group
33  {
34  void clear();
35 
38  void toggleItemMembership(const ItemPtr& item);
39 
42  void ensureItemInserted(const ItemPtr& item);
43 
45  void ensureGroupInserted(const GroupPtr& item);
46 
47  void insertItem(const ItemPtr& item);
48 
49  void insertGroup(const GroupPtr& g) {
50  groups.push_back(g);
51  g->selected=true;
52  }
54  bool contains(const ItemPtr& item) const;
55  using Item::contains;
56  };
57 
58 }
59 
60 #include "selection.cd"
61 #include "selection.xcd"
62 #endif
represents items that have been selected
Definition: selection.h:32
void insertItem(const ItemPtr &item)
Definition: selection.cc:81
std::shared_ptr< Item > ItemPtr
Definition: item.h:57
void ensureGroupInserted(const GroupPtr &item)
check if group already present, and if not, inserts it
Definition: selection.cc:73
Creation and access to the minskyTCL_obj object, which has code to record whenever Minsky&#39;s state cha...
Definition: constMap.h:22
void insertGroup(const GroupPtr &g)
Definition: selection.h:49
virtual bool contains(float xx, float yy) const
Definition: item.h:196
void ensureItemInserted(const ItemPtr &item)
check if item already present, and if not, inserts item delegates to ensureGroupInserted if passed a ...
Definition: selection.cc:60
bool contains(const ItemPtr &item) const
return if item is contained in selection
Definition: selection.cc:102
Groups groups
Definition: group.h:79
std::shared_ptr< Group > GroupPtr
Definition: port.h:32
void toggleItemMembership(const ItemPtr &item)
add item to selection if not present, or removes it if present groups handled as well ...
Definition: selection.cc:37