mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-17 12:12:10 -04:00
whew
This commit is contained in:
parent
f2c62f162e
commit
880c346ad7
@ -9,7 +9,6 @@ guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(),
|
||||
font = None
|
||||
panel = None
|
||||
drawOrder = 100
|
||||
massiveLeak = []
|
||||
|
||||
def getDefaultFont():
|
||||
global font
|
||||
@ -45,8 +44,6 @@ def getNewRolloverFunctor(sound = None):
|
||||
val = AudioGuiFunctor(roll)
|
||||
else:
|
||||
val = AudioGuiFunctor()
|
||||
global massiveLeak
|
||||
massiveLeak.append(val)
|
||||
return val
|
||||
|
||||
def getNewClickFunctor(sound = None):
|
||||
@ -60,6 +57,4 @@ def getNewClickFunctor(sound = None):
|
||||
val = AudioGuiFunctor(click)
|
||||
else:
|
||||
val = AudioGuiFunctor()
|
||||
global massiveLeak
|
||||
massiveLeak.append(val)
|
||||
return val
|
||||
|
@ -5,13 +5,14 @@
|
||||
|
||||
#include "audio_gui_functor.h"
|
||||
|
||||
TypeHandle AudioGuiFunctor::_type_handle;
|
||||
|
||||
AudioGuiFunctor::AudioGuiFunctor(AudioSound* sound,
|
||||
GuiBehavior::BehaviorFunctor* prev)
|
||||
: _prev(prev), _sound(sound) {}
|
||||
: GuiBehavior::BehaviorFunctor(), _prev(prev), _sound(sound) {}
|
||||
|
||||
AudioGuiFunctor::~AudioGuiFunctor(void) {
|
||||
if (_prev != (GuiBehavior::BehaviorFunctor*)0L)
|
||||
delete _prev;
|
||||
_prev.clear();
|
||||
}
|
||||
|
||||
#include "audio_manager.h"
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
class EXPCL_PANDA AudioGuiFunctor : public GuiBehavior::BehaviorFunctor {
|
||||
protected:
|
||||
GuiBehavior::BehaviorFunctor* _prev;
|
||||
PT(GuiBehavior::BehaviorFunctor) _prev;
|
||||
PT(AudioSound) _sound;
|
||||
public:
|
||||
virtual ~AudioGuiFunctor(void);
|
||||
@ -22,6 +22,25 @@ PUBLISHED:
|
||||
(GuiBehavior::BehaviorFunctor*)0L);
|
||||
INLINE AudioSound* get_sound(void) const { return _sound; }
|
||||
INLINE GuiBehavior::BehaviorFunctor* get_prev(void) const { return _prev; }
|
||||
public:
|
||||
// type interface
|
||||
static TypeHandle get_class_type(void) {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type(void) {
|
||||
GuiBehavior::BehaviorFunctor::init_type();
|
||||
register_type(_type_handle, "AudioGuiFunctor",
|
||||
GuiBehavior::BehaviorFunctor::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type(void) const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type(void) {
|
||||
init_type();
|
||||
return get_class_type();
|
||||
}
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#endif /* __AUDIO_GUI_FUNCTOR_H__ */
|
||||
|
@ -25,6 +25,7 @@ ConfigureFn(config_gui) {
|
||||
GuiLabel::init_type();
|
||||
GuiItem::init_type();
|
||||
GuiBehavior::init_type();
|
||||
GuiBehavior::BehaviorFunctor::init_type();
|
||||
GuiSign::init_type();
|
||||
GuiRollover::init_type();
|
||||
GuiButton::init_type();
|
||||
|
@ -6,8 +6,9 @@
|
||||
#include "guiBehavior.h"
|
||||
|
||||
TypeHandle GuiBehavior::_type_handle;
|
||||
TypeHandle GuiBehavior::BehaviorFunctor::_type_handle;
|
||||
|
||||
GuiBehavior::BehaviorFunctor::BehaviorFunctor(void) {
|
||||
GuiBehavior::BehaviorFunctor::BehaviorFunctor(void) : TypedReferenceCount() {
|
||||
}
|
||||
|
||||
GuiBehavior::BehaviorFunctor::~BehaviorFunctor(void) {
|
||||
|
@ -15,12 +15,31 @@ protected:
|
||||
|
||||
INLINE GuiBehavior(void);
|
||||
PUBLISHED:
|
||||
class EXPCL_PANDA BehaviorFunctor {
|
||||
class EXPCL_PANDA BehaviorFunctor : public TypedReferenceCount {
|
||||
public:
|
||||
virtual void doit(GuiBehavior*) = 0;
|
||||
virtual ~BehaviorFunctor(void);
|
||||
PUBLISHED:
|
||||
BehaviorFunctor(void);
|
||||
virtual ~BehaviorFunctor(void);
|
||||
public:
|
||||
// type interface
|
||||
static TypeHandle get_class_type(void) {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type(void) {
|
||||
TypedReferenceCount::init_type();
|
||||
register_type(_type_handle, "GuiBehavior::BehaviorFunctor",
|
||||
TypedReferenceCount::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type(void) const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type(void) {
|
||||
init_type();
|
||||
return get_class_type();
|
||||
}
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
PUBLISHED:
|
||||
GuiBehavior(const string&);
|
||||
|
@ -531,9 +531,9 @@ GuiButton::~GuiButton(void) {
|
||||
}
|
||||
|
||||
if (_behavior_functor != (GuiBehavior::BehaviorFunctor*)0L)
|
||||
delete _behavior_functor;
|
||||
_behavior_functor.clear();
|
||||
if (_rollover_functor != (GuiBehavior::BehaviorFunctor*)0L)
|
||||
delete _behavior_functor;
|
||||
_rollover_functor.clear();
|
||||
}
|
||||
|
||||
void GuiButton::manage(GuiManager* mgr, EventHandler& eh) {
|
||||
|
@ -36,8 +36,8 @@ private:
|
||||
string _behavior_event;
|
||||
bool _have_event_param;
|
||||
int _event_param;
|
||||
GuiBehavior::BehaviorFunctor* _behavior_functor;
|
||||
GuiBehavior::BehaviorFunctor* _rollover_functor;
|
||||
PT(GuiBehavior::BehaviorFunctor) _behavior_functor;
|
||||
PT(GuiBehavior::BehaviorFunctor) _rollover_functor;
|
||||
|
||||
INLINE GuiButton(void);
|
||||
void switch_state(States);
|
||||
|
@ -6,13 +6,15 @@
|
||||
#include "guiChooser.h"
|
||||
|
||||
TypeHandle GuiChooser::_type_handle;
|
||||
TypeHandle GuiChooser::ChooseFunctor::_type_handle;
|
||||
|
||||
GuiChooser::ChooseFunctor::ChooseFunctor(GuiChooser* ch,
|
||||
GuiBehavior::BehaviorFunctor* func)
|
||||
: _prev(func), _ch(ch) {
|
||||
: GuiBehavior::BehaviorFunctor(), _prev(func), _ch(ch) {
|
||||
}
|
||||
|
||||
GuiChooser::ChooseFunctor::~ChooseFunctor(void) {
|
||||
_prev.clear();
|
||||
}
|
||||
|
||||
void GuiChooser::ChooseFunctor::doit(GuiBehavior* b) {
|
||||
@ -260,7 +262,7 @@ void GuiChooser::start_behavior(void) {
|
||||
return;
|
||||
if (_prev_functor != (GuiChooser::ChooseFunctor*)0L) {
|
||||
_prev_button->set_behavior_functor(_prev_functor->get_prev());
|
||||
delete _prev_functor;
|
||||
_prev_functor.clear();
|
||||
}
|
||||
_prev_functor =
|
||||
new GuiChooser::ChooseFunctor(this, _prev_button->get_behavior_functor());
|
||||
@ -268,7 +270,7 @@ void GuiChooser::start_behavior(void) {
|
||||
_prev_button->start_behavior();
|
||||
if (_next_functor != (GuiChooser::ChooseFunctor*)0L) {
|
||||
_next_button->set_behavior_functor(_next_functor->get_prev());
|
||||
delete _next_functor;
|
||||
_next_functor.clear();
|
||||
}
|
||||
_next_functor =
|
||||
new GuiChooser::ChooseFunctor(this, _next_button->get_behavior_functor());
|
||||
@ -282,14 +284,12 @@ void GuiChooser::stop_behavior(void) {
|
||||
return;
|
||||
if (_prev_functor != (GuiChooser::ChooseFunctor*)0L) {
|
||||
_prev_button->set_behavior_functor(_prev_functor->get_prev());
|
||||
delete _prev_functor;
|
||||
_prev_functor = (GuiChooser::ChooseFunctor*)0L;
|
||||
_prev_functor.clear();
|
||||
_prev_button->stop_behavior();
|
||||
}
|
||||
if (_next_functor != (GuiChooser::ChooseFunctor*)0L) {
|
||||
_next_button->set_behavior_functor(_next_functor->get_prev());
|
||||
delete _next_functor;
|
||||
_next_functor = (GuiChooser::ChooseFunctor*)0L;
|
||||
_next_functor.clear();
|
||||
_next_button->stop_behavior();
|
||||
}
|
||||
}
|
||||
|
@ -19,13 +19,32 @@ private:
|
||||
|
||||
class EXPCL_PANDA ChooseFunctor : public GuiBehavior::BehaviorFunctor {
|
||||
protected:
|
||||
GuiBehavior::BehaviorFunctor* _prev;
|
||||
PT(GuiBehavior::BehaviorFunctor) _prev;
|
||||
GuiChooser* _ch;
|
||||
public:
|
||||
ChooseFunctor(GuiChooser*, GuiBehavior::BehaviorFunctor*);
|
||||
virtual ~ChooseFunctor(void);
|
||||
virtual void doit(GuiBehavior*);
|
||||
INLINE GuiBehavior::BehaviorFunctor* get_prev(void) { return _prev; }
|
||||
public:
|
||||
// type interface
|
||||
static TypeHandle get_class_type(void) {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type(void) {
|
||||
GuiBehavior::BehaviorFunctor::init_type();
|
||||
register_type(_type_handle, "ChooseFunctor",
|
||||
GuiBehavior::BehaviorFunctor::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type(void) const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type(void) {
|
||||
init_type();
|
||||
return get_class_type();
|
||||
}
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
friend ChooseFunctor;
|
||||
@ -36,8 +55,8 @@ private:
|
||||
PT(GuiButton) _prev_button;
|
||||
PT(GuiButton) _next_button;
|
||||
|
||||
ChooseFunctor* _prev_functor;
|
||||
ChooseFunctor* _next_functor;
|
||||
PT(ChooseFunctor) _prev_functor;
|
||||
PT(ChooseFunctor) _next_functor;
|
||||
|
||||
INLINE GuiChooser(void);
|
||||
virtual void recompute_frame(void);
|
||||
|
@ -6,13 +6,15 @@
|
||||
#include "guiListBox.h"
|
||||
|
||||
TypeHandle GuiListBox::_type_handle;
|
||||
TypeHandle GuiListBox::ListFunctor::_type_handle;
|
||||
|
||||
GuiListBox::ListFunctor::ListFunctor(GuiListBox* box,
|
||||
GuiBehavior::BehaviorFunctor* func)
|
||||
: _prev(func), _lb(box) {
|
||||
: GuiBehavior::BehaviorFunctor(), _prev(func), _lb(box) {
|
||||
}
|
||||
|
||||
GuiListBox::ListFunctor::~ListFunctor(void) {
|
||||
_prev.clear();
|
||||
}
|
||||
|
||||
void GuiListBox::ListFunctor::doit(GuiBehavior* b) {
|
||||
@ -332,7 +334,7 @@ void GuiListBox::start_behavior(void) {
|
||||
return;
|
||||
if (_up_functor != (GuiListBox::ListFunctor*)0L) {
|
||||
_up_arrow->set_behavior_functor(_up_functor->get_prev());
|
||||
delete _up_functor;
|
||||
_up_functor.clear();
|
||||
}
|
||||
_up_functor =
|
||||
new GuiListBox::ListFunctor(this, _up_arrow->get_behavior_functor());
|
||||
@ -340,7 +342,7 @@ void GuiListBox::start_behavior(void) {
|
||||
_up_arrow->start_behavior();
|
||||
if (_down_functor != (GuiListBox::ListFunctor*)0L) {
|
||||
_down_arrow->set_behavior_functor(_down_functor->get_prev());
|
||||
delete _down_functor;
|
||||
_down_functor.clear();
|
||||
}
|
||||
_down_functor =
|
||||
new GuiListBox::ListFunctor(this, _down_arrow->get_behavior_functor());
|
||||
@ -354,14 +356,12 @@ void GuiListBox::stop_behavior(void) {
|
||||
return;
|
||||
if (_up_functor != (GuiListBox::ListFunctor*)0L) {
|
||||
_up_arrow->set_behavior_functor(_up_functor->get_prev());
|
||||
delete _up_functor;
|
||||
_up_functor = (GuiListBox::ListFunctor*)0L;
|
||||
_up_functor.clear();
|
||||
_up_arrow->stop_behavior();
|
||||
}
|
||||
if (_down_functor != (GuiListBox::ListFunctor*)0L) {
|
||||
_down_arrow->set_behavior_functor(_down_functor->get_prev());
|
||||
delete _down_functor;
|
||||
_down_functor = (GuiListBox::ListFunctor*)0L;
|
||||
_down_functor.clear();
|
||||
_down_arrow->stop_behavior();
|
||||
}
|
||||
}
|
||||
|
@ -19,13 +19,32 @@ private:
|
||||
|
||||
class EXPCL_PANDA ListFunctor : public GuiBehavior::BehaviorFunctor {
|
||||
protected:
|
||||
GuiBehavior::BehaviorFunctor* _prev;
|
||||
PT(GuiBehavior::BehaviorFunctor) _prev;
|
||||
GuiListBox* _lb;
|
||||
public:
|
||||
ListFunctor(GuiListBox*, GuiBehavior::BehaviorFunctor*);
|
||||
virtual ~ListFunctor(void);
|
||||
virtual void doit(GuiBehavior*);
|
||||
INLINE GuiBehavior::BehaviorFunctor* get_prev(void) { return _prev; }
|
||||
public:
|
||||
// type interface
|
||||
static TypeHandle get_class_type(void) {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type(void) {
|
||||
GuiBehavior::BehaviorFunctor::init_type();
|
||||
register_type(_type_handle, "ListFunctor",
|
||||
GuiBehavior::BehaviorFunctor::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type(void) const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type(void) {
|
||||
init_type();
|
||||
return get_class_type();
|
||||
}
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
friend ListFunctor;
|
||||
@ -37,8 +56,8 @@ private:
|
||||
PT(GuiButton) _down_arrow;
|
||||
unsigned int _n_visible;
|
||||
|
||||
ListFunctor* _up_functor;
|
||||
ListFunctor* _down_functor;
|
||||
PT(ListFunctor) _up_functor;
|
||||
PT(ListFunctor) _down_functor;
|
||||
|
||||
INLINE GuiListBox(void);
|
||||
virtual void recompute_frame(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user