open_toontown_panda3d/panda/src/tform/mouseWatcherGroup.h

94 lines
2.5 KiB
C++

// Filename: mouseWatcherGroup.h
// Created by: drose (02Jul01)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef MOUSEWATCHERGROUP_H
#define MOUSEWATCHERGROUP_H
#include "pandabase.h"
#include "mouseWatcherRegion.h"
#include "pointerTo.h"
#include "referenceCount.h"
#include "pvector.h"
#include "nodePath.h"
////////////////////////////////////////////////////////////////////
// Class : MouseWatcherGroup
// Description : This represents a collection of MouseWatcherRegions
// that may be managed as a group.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA MouseWatcherGroup : virtual public ReferenceCount {
public:
MouseWatcherGroup();
virtual ~MouseWatcherGroup();
PUBLISHED:
void add_region(MouseWatcherRegion *region);
bool has_region(MouseWatcherRegion *region) const;
bool remove_region(MouseWatcherRegion *region);
MouseWatcherRegion *find_region(const string &name) const;
void clear_regions();
int get_num_regions() const;
MouseWatcherRegion *get_region(int n) const;
void output(ostream &out) const;
void write(ostream &out, int indent_level = 0) const;
#ifndef NDEBUG
void show_regions(const NodePath &render2d);
void set_color(const Colorf &color);
void hide_regions();
#endif // NDEBUG
protected:
typedef pvector< PT(MouseWatcherRegion) > Regions;
Regions _regions;
private:
#ifndef NDEBUG
void update_regions();
PandaNode *make_viz_region(MouseWatcherRegion *region);
typedef pvector< PT(PandaNode) > Vizzes;
Vizzes _vizzes;
bool _show_regions;
NodePath _show_regions_root;
Colorf _color;
#endif // NDEBUG
public:
static TypeHandle get_class_type() {
ReferenceCount::init_type();
return _type_handle;
}
static void init_type() {
register_type(_type_handle, "MouseWatcherGroup",
ReferenceCount::get_class_type());
}
private:
static TypeHandle _type_handle;
friend class MouseWatcher;
friend class BlobWatcher;
};
#endif