mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-18 12:43:44 -04:00
*** empty log message ***
This commit is contained in:
parent
6008bc93a9
commit
03476f1b2f
@ -38,8 +38,21 @@ MouseWatcherGroup::
|
|||||||
// added, or false if it was already on the list.
|
// added, or false if it was already on the list.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
bool MouseWatcherGroup::
|
bool MouseWatcherGroup::
|
||||||
add_region(MouseWatcherRegion *region) {
|
add_region(PT(MouseWatcherRegion) region) {
|
||||||
return _regions.insert(region).second;
|
//return _regions.insert(region).second;
|
||||||
|
|
||||||
|
// See if the region is in the set/vector already
|
||||||
|
Regions::const_iterator ri = find(_regions.begin(),
|
||||||
|
_regions.end(),
|
||||||
|
region);
|
||||||
|
if (ri != _regions.end()) {
|
||||||
|
// Already in the set, return false
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not in the set, add it and return true
|
||||||
|
_regions.push_back(region);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -49,8 +62,17 @@ add_region(MouseWatcherRegion *region) {
|
|||||||
// added to the MouseWatcherGroup, false otherwise.
|
// added to the MouseWatcherGroup, false otherwise.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
bool MouseWatcherGroup::
|
bool MouseWatcherGroup::
|
||||||
has_region(MouseWatcherRegion *region) const {
|
has_region(PT(MouseWatcherRegion) region) const {
|
||||||
return _regions.count(region) != 0;
|
// See if the region is in the set/vector
|
||||||
|
Regions::const_iterator ri = find(_regions.begin(),
|
||||||
|
_regions.end(),
|
||||||
|
region);
|
||||||
|
if (ri != _regions.end()) {
|
||||||
|
// Found it
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Did not find the region
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -61,8 +83,21 @@ has_region(MouseWatcherRegion *region) const {
|
|||||||
// if it wasn't there in the first place.
|
// if it wasn't there in the first place.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
bool MouseWatcherGroup::
|
bool MouseWatcherGroup::
|
||||||
remove_region(MouseWatcherRegion *region) {
|
remove_region(PT(MouseWatcherRegion) region) {
|
||||||
return _regions.erase(region) != 0;
|
//return _regions.erase(region) != 0;
|
||||||
|
|
||||||
|
// See if the region is in the set/vector
|
||||||
|
Regions::iterator ri = find(_regions.begin(),
|
||||||
|
_regions.end(),
|
||||||
|
region);
|
||||||
|
if (ri != _regions.end()) {
|
||||||
|
// Found it, now erase it
|
||||||
|
_regions.erase(ri);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Did not find the region to erase
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#include "pointerTo.h"
|
#include "pointerTo.h"
|
||||||
#include "referenceCount.h"
|
#include "referenceCount.h"
|
||||||
#include "pset.h"
|
#include "pvector.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Class : MouseWatcherGroup
|
// Class : MouseWatcherGroup
|
||||||
@ -36,14 +36,14 @@ public:
|
|||||||
virtual ~MouseWatcherGroup();
|
virtual ~MouseWatcherGroup();
|
||||||
|
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
bool add_region(MouseWatcherRegion *region);
|
bool add_region(PT(MouseWatcherRegion) region);
|
||||||
bool has_region(MouseWatcherRegion *region) const;
|
bool has_region(PT(MouseWatcherRegion) region) const;
|
||||||
bool remove_region(MouseWatcherRegion *region);
|
bool remove_region(PT(MouseWatcherRegion) region);
|
||||||
MouseWatcherRegion *find_region(const string &name) const;
|
MouseWatcherRegion *find_region(const string &name) const;
|
||||||
void clear_regions();
|
void clear_regions();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef pset< PT(MouseWatcherRegion) > Regions;
|
typedef pvector< PT(MouseWatcherRegion) > Regions;
|
||||||
Regions _regions;
|
Regions _regions;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user