157
160
bool modified() const {return valModified;};
160
template<class T> class SelectionDevice
163
class SelectionDevice
163
166
std::vector<SelectionBinding> bindingVec;
167
const Filter *target;
166
169
//!Create a new selection device
167
SelectionDevice(const T *p);
170
SelectionDevice(const Filter *p);
169
172
//!Copy constructor (not implemented)
170
173
SelectionDevice(const SelectionDevice ©Src);
177
180
bool getBinding(const DrawableObj *d, unsigned int mouseFlags,
178
181
unsigned int keyFlags, SelectionBinding* &b);
180
bool getAvailBindings(const DrawableObj *d, vector<const SelectionBinding*> &b) const;
181
void getModifiedBindings(vector<std::pair<const T *,SelectionBinding> > &bindings);
183
bool getAvailBindings(const DrawableObj *d, std::vector<const SelectionBinding*> &b) const;
184
void getModifiedBindings(std::vector<std::pair<const Filter *,SelectionBinding> > &bindings);
186
size_t getNumBindings() const { return bindingVec.size(); }
185
SelectionDevice<T>::SelectionDevice(const T *p) : target(p)
190
void SelectionDevice<T>::addBinding(SelectionBinding b)
192
bindingVec.push_back(b);
196
bool SelectionDevice<T>::getBinding(const DrawableObj *d,unsigned int mouseFlags,
197
unsigned int keyFlags,SelectionBinding* &b)
200
unsigned int keyMask=0;
205
for(unsigned int ui=0;ui<bindingVec.size();ui++)
207
if(bindingVec[ui].matchesDrawable(d,mouseFlags,keyFlags))
214
keyMask=b->getKeyFlags();
218
//OK, we already have one, but we can be "trumped"
219
//by a more complex keymask.
220
if( (keyMask & bindingVec[ui].getKeyFlags() )== keyMask)
223
keyMask=b->getKeyFlags();
229
//This selection device does not match
230
//the targeted object.
235
void SelectionDevice<T>::getModifiedBindings(vector<std::pair<const T *,SelectionBinding> > &bindings)
238
for(unsigned int ui=0;ui<bindingVec.size();ui++)
240
if(bindingVec[ui].modified())
241
bindings.push_back(std::make_pair(target,bindingVec[ui]));
246
bool SelectionDevice<T>::getAvailBindings(const DrawableObj *d,vector<const SelectionBinding*> &b) const
249
for(unsigned int ui=0;ui<bindingVec.size();ui++)
251
if(bindingVec[ui].matchesDrawable(d))
252
b.push_back(&(bindingVec[ui]));