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