*** empty log message ***

This commit is contained in:
Joe Shochet 2002-01-24 03:00:13 +00:00
parent 6b2190a8d3
commit 6008bc93a9
2 changed files with 34 additions and 8 deletions

View File

@ -174,8 +174,21 @@ write(ostream &out, int indent_level) const {
// false if it was already on the list.
////////////////////////////////////////////////////////////////////
bool MouseWatcher::
add_group(MouseWatcherGroup *group) {
return _groups.insert(group).second;
add_group(PT(MouseWatcherGroup) group) {
// return _groups.insert(group).second;
// See if the group is in the set/vector already
Groups::const_iterator gi = find(_groups.begin(),
_groups.end(),
group);
if (gi != _groups.end()) {
// Already in the set, return false
return false;
}
// Not in the set, add it and return true
_groups.push_back(group);
return true;
}
////////////////////////////////////////////////////////////////////
@ -187,7 +200,7 @@ add_group(MouseWatcherGroup *group) {
// removed or was never added via add_group().
////////////////////////////////////////////////////////////////////
bool MouseWatcher::
remove_group(MouseWatcherGroup *group) {
remove_group(PT(MouseWatcherGroup) group) {
remove_regions_from(_current_regions, group);
if (group->has_region(_preferred_region)) {
_preferred_region = (MouseWatcherRegion *)NULL;
@ -196,7 +209,18 @@ remove_group(MouseWatcherGroup *group) {
_preferred_button_down_region = (MouseWatcherRegion *)NULL;
}
return _groups.erase(group) != 0;
// See if the group is in the set/vector
Groups::iterator gi = find(_groups.begin(),
_groups.end(),
group);
if (gi != _groups.end()) {
// Found it, now erase it
_groups.erase(gi);
return true;
}
// Did not find the group to erase
return false;
}
////////////////////////////////////////////////////////////////////

View File

@ -34,7 +34,7 @@
#include "modifierButtons.h"
#include "buttonHandle.h"
#include "pset.h"
#include "pvector.h"
class MouseWatcherParameter;
@ -110,8 +110,8 @@ public:
virtual void output(ostream &out) const;
virtual void write(ostream &out, int indent_level = 0) const;
bool add_group(MouseWatcherGroup *group);
bool remove_group(MouseWatcherGroup *group);
bool add_group(PT(MouseWatcherGroup) group);
bool remove_group(PT(MouseWatcherGroup) group);
protected:
typedef pvector< PT(MouseWatcherRegion) > VRegions;
@ -143,7 +143,9 @@ protected:
void enter_region(MouseWatcherRegion *region, const MouseWatcherParameter &param);
void exit_region(MouseWatcherRegion *region, const MouseWatcherParameter &param);
typedef pset< PT(MouseWatcherGroup) > Groups;
// This wants to be a set, but because you cannot export sets across
// dlls in windows, we will make it a vector instead
typedef pvector< PT(MouseWatcherGroup) > Groups;
Groups _groups;
bool _has_mouse;