mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
*** empty log message ***
This commit is contained in:
parent
386cc76544
commit
60750be415
@ -20,18 +20,22 @@ class Button(DirectObject):
|
|||||||
# up
|
# up
|
||||||
self.l1 = GuiLabel.GuiLabel.makeSimpleTextLabel(self.label, font)
|
self.l1 = GuiLabel.GuiLabel.makeSimpleTextLabel(self.label, font)
|
||||||
self.l1.setForegroundColor(0., 0., 0., 1.)
|
self.l1.setForegroundColor(0., 0., 0., 1.)
|
||||||
|
self.l1.thaw()
|
||||||
# roll-over up
|
# roll-over up
|
||||||
self.l2 = GuiLabel.GuiLabel.makeSimpleTextLabel(self.label, font)
|
self.l2 = GuiLabel.GuiLabel.makeSimpleTextLabel(self.label, font)
|
||||||
self.l2.setForegroundColor(0., 0., 0., 1.)
|
self.l2.setForegroundColor(0., 0., 0., 1.)
|
||||||
self.l2.setBackgroundColor(1., 1., 0., 1.)
|
self.l2.setBackgroundColor(1., 1., 0., 1.)
|
||||||
|
self.l2.thaw()
|
||||||
# roll-over down
|
# roll-over down
|
||||||
self.l3 = GuiLabel.GuiLabel.makeSimpleTextLabel(self.label, font)
|
self.l3 = GuiLabel.GuiLabel.makeSimpleTextLabel(self.label, font)
|
||||||
self.l3.setForegroundColor(1., 1., 1., 1.)
|
self.l3.setForegroundColor(1., 1., 1., 1.)
|
||||||
self.l3.setBackgroundColor(0., 0., 0., 1.)
|
self.l3.setBackgroundColor(0., 0., 0., 1.)
|
||||||
|
self.l3.thaw()
|
||||||
self.button = GuiButton.GuiButton(self.name, self.l1, self.l2,
|
self.button = GuiButton.GuiButton(self.name, self.l1, self.l2,
|
||||||
self.l3, self.l3, self.l1)
|
self.l3, self.l3, self.l1)
|
||||||
self.setScale(0.1)
|
self.setScale(0.1)
|
||||||
self.managed = 0
|
self.managed = 0
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
@ -45,6 +49,7 @@ class Button(DirectObject):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Button: %s" % self.name
|
return "Button: %s" % self.name
|
||||||
|
|
||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
@ -63,6 +68,18 @@ class Button(DirectObject):
|
|||||||
self.l2.setWidth(width)
|
self.l2.setWidth(width)
|
||||||
self.l3.setWidth(width)
|
self.l3.setWidth(width)
|
||||||
|
|
||||||
|
def freeze(self):
|
||||||
|
self.l1.freeze()
|
||||||
|
self.l2.freeze()
|
||||||
|
self.l3.freeze()
|
||||||
|
self.button.freeze()
|
||||||
|
|
||||||
|
def thaw(self):
|
||||||
|
self.l1.thaw()
|
||||||
|
self.l2.thaw()
|
||||||
|
self.l3.thaw()
|
||||||
|
self.button.thaw()
|
||||||
|
|
||||||
def manage(self):
|
def manage(self):
|
||||||
self.button.manage(guiMgr, base.eventMgr.eventHandler)
|
self.button.manage(guiMgr, base.eventMgr.eventHandler)
|
||||||
self.managed = 1
|
self.managed = 1
|
||||||
|
@ -52,10 +52,12 @@ class ForceAcknowledge(StateData.StateData):
|
|||||||
|
|
||||||
# create a message
|
# create a message
|
||||||
self.text = OnscreenText.OnscreenText("", 0.0, 0.25)
|
self.text = OnscreenText.OnscreenText("", 0.0, 0.25)
|
||||||
|
self.text.freeze()
|
||||||
self.text.node().setAlign(0)
|
self.text.node().setAlign(0)
|
||||||
self.text.node().setTextColor(0.0, 0.0, 0.0, 1.0)
|
self.text.node().setTextColor(0.0, 0.0, 0.0, 1.0)
|
||||||
self.text.node().setFrameColor(1.0, 1.0, 1.0, 1.0)
|
self.text.node().setFrameColor(1.0, 1.0, 1.0, 1.0)
|
||||||
self.text.setScale(0.08)
|
self.text.setScale(0.08)
|
||||||
|
self.text.thaw()
|
||||||
|
|
||||||
# create a button
|
# create a button
|
||||||
self.okButton = Button.Button("ForceAcknowledge", "OK")
|
self.okButton = Button.Button("ForceAcknowledge", "OK")
|
||||||
|
@ -47,6 +47,12 @@ class Frame(DirectObject):
|
|||||||
self.offset = offset
|
self.offset = offset
|
||||||
|
|
||||||
# actions
|
# actions
|
||||||
|
def freeze(self):
|
||||||
|
self.frame.freeze()
|
||||||
|
|
||||||
|
def thaw(self):
|
||||||
|
self.frame.thaw()
|
||||||
|
|
||||||
def manage(self):
|
def manage(self):
|
||||||
self.frame.manage(guiMgr, base.eventMgr.eventHandler)
|
self.frame.manage(guiMgr, base.eventMgr.eventHandler)
|
||||||
self.managed = 1
|
self.managed = 1
|
||||||
|
@ -54,6 +54,12 @@ class OnscreenText(PandaObject, NodePath):
|
|||||||
NodePath.__del__(self)
|
NodePath.__del__(self)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def freeze(self):
|
||||||
|
self.textNode.freeze()
|
||||||
|
|
||||||
|
def thaw(self):
|
||||||
|
self.textNode.thaw()
|
||||||
|
|
||||||
def setText(self, string):
|
def setText(self, string):
|
||||||
"""setText(self, string)
|
"""setText(self, string)
|
||||||
Set the text of the onscreen text
|
Set the text of the onscreen text
|
||||||
|
@ -25,6 +25,7 @@ class ScrollingLabel(PandaObject.PandaObject):
|
|||||||
label = GuiLabel.GuiLabel.makeSimpleTextLabel(self.name, font)
|
label = GuiLabel.GuiLabel.makeSimpleTextLabel(self.name, font)
|
||||||
label.setForegroundColor(1., 0., 0., 1.)
|
label.setForegroundColor(1., 0., 0., 1.)
|
||||||
label.setBackgroundColor(1., 1., 1., 0.)
|
label.setBackgroundColor(1., 1., 1., 0.)
|
||||||
|
label.thaw()
|
||||||
self.title = Sign.Sign(self.name, label)
|
self.title = Sign.Sign(self.name, label)
|
||||||
self.frame.addItem(self.title)
|
self.frame.addItem(self.title)
|
||||||
|
|
||||||
@ -36,6 +37,7 @@ class ScrollingLabel(PandaObject.PandaObject):
|
|||||||
label = GuiLabel.GuiLabel.makeSimpleTextLabel(longest, font)
|
label = GuiLabel.GuiLabel.makeSimpleTextLabel(longest, font)
|
||||||
label.setForegroundColor(0., 0., 0., 1.)
|
label.setForegroundColor(0., 0., 0., 1.)
|
||||||
label.setBackgroundColor(1., 1., 1., 1.)
|
label.setBackgroundColor(1., 1., 1., 1.)
|
||||||
|
label.thaw()
|
||||||
self.itemSign = Sign.Sign(longest, label)
|
self.itemSign = Sign.Sign(longest, label)
|
||||||
self.frame.addItem(self.itemSign)
|
self.frame.addItem(self.itemSign)
|
||||||
|
|
||||||
|
@ -303,6 +303,32 @@ void GuiButton::unmanage(void) {
|
|||||||
GuiItem::unmanage();
|
GuiItem::unmanage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GuiButton::freeze() {
|
||||||
|
_up->freeze();
|
||||||
|
_down->freeze();
|
||||||
|
if (_up_rollover != (GuiLabel*)0L)
|
||||||
|
_up_rollover->freeze();
|
||||||
|
if (_down_rollover != (GuiLabel*)0L)
|
||||||
|
_down_rollover->freeze();
|
||||||
|
if (_inactive != (GuiLabel*)0L)
|
||||||
|
_inactive->freeze();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiButton::thaw() {
|
||||||
|
_up->thaw();
|
||||||
|
_down->thaw();
|
||||||
|
if (_up_rollover != (GuiLabel*)0L)
|
||||||
|
_up_rollover->thaw();
|
||||||
|
if (_down_rollover != (GuiLabel*)0L)
|
||||||
|
_down_rollover->thaw();
|
||||||
|
if (_inactive != (GuiLabel*)0L)
|
||||||
|
_inactive->thaw();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void GuiButton::set_scale(float f) {
|
void GuiButton::set_scale(float f) {
|
||||||
_up->set_scale(f * _up_scale);
|
_up->set_scale(f * _up_scale);
|
||||||
_down->set_scale(f * _down_scale);
|
_down->set_scale(f * _down_scale);
|
||||||
|
@ -48,6 +48,9 @@ public:
|
|||||||
virtual void unmanage(void);
|
virtual void unmanage(void);
|
||||||
|
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
|
virtual int freeze();
|
||||||
|
virtual int thaw();
|
||||||
|
|
||||||
INLINE void enter(void);
|
INLINE void enter(void);
|
||||||
INLINE void exit(void);
|
INLINE void exit(void);
|
||||||
INLINE void up(void);
|
INLINE void up(void);
|
||||||
|
@ -23,7 +23,11 @@ GuiFrame::Boxes::iterator GuiFrame::find_box(GuiItem* item) {
|
|||||||
|
|
||||||
void GuiFrame::recompute_frame(void) {
|
void GuiFrame::recompute_frame(void) {
|
||||||
GuiItem::recompute_frame();
|
GuiItem::recompute_frame();
|
||||||
|
|
||||||
|
freeze();
|
||||||
|
|
||||||
Boxes::iterator i;
|
Boxes::iterator i;
|
||||||
|
|
||||||
// go thru and make sure everything is packed correctly. This is a stupid
|
// go thru and make sure everything is packed correctly. This is a stupid
|
||||||
// and brute-force algorithm. Hopefully it will be replaced with something
|
// and brute-force algorithm. Hopefully it will be replaced with something
|
||||||
// more ellegant later
|
// more ellegant later
|
||||||
@ -202,6 +206,8 @@ void GuiFrame::recompute_frame(void) {
|
|||||||
tmp = (*i).get_item()->get_top();
|
tmp = (*i).get_item()->get_top();
|
||||||
_top = (_top<tmp)?tmp:_top;
|
_top = (_top<tmp)?tmp:_top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
thaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiFrame::GuiFrame(const string& name) : GuiItem(name), _align_to_left(false),
|
GuiFrame::GuiFrame(const string& name) : GuiItem(name), _align_to_left(false),
|
||||||
@ -214,6 +220,32 @@ GuiFrame::~GuiFrame(void) {
|
|||||||
this->unmanage();
|
this->unmanage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GuiFrame::freeze() {
|
||||||
|
int result = 0;
|
||||||
|
Boxes::iterator i;
|
||||||
|
|
||||||
|
for (i=_items.begin(); i!=_items.end(); ++i) {
|
||||||
|
GuiItem* here = (*i).get_item();
|
||||||
|
int count = here->freeze();
|
||||||
|
result = max(result, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiFrame::thaw() {
|
||||||
|
int result = 0;
|
||||||
|
Boxes::iterator i;
|
||||||
|
|
||||||
|
for (i=_items.begin(); i!=_items.end(); ++i) {
|
||||||
|
GuiItem* here = (*i).get_item();
|
||||||
|
int count = here->thaw();
|
||||||
|
result = max(result, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void GuiFrame::add_item(GuiItem* item) {
|
void GuiFrame::add_item(GuiItem* item) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (Boxes::iterator i=_items.begin(); (!found)&&(i!=_items.end()); ++i)
|
for (Boxes::iterator i=_items.begin(); (!found)&&(i!=_items.end()); ++i)
|
||||||
|
@ -84,6 +84,9 @@ PUBLISHED:
|
|||||||
GuiFrame(const string&);
|
GuiFrame(const string&);
|
||||||
~GuiFrame(void);
|
~GuiFrame(void);
|
||||||
|
|
||||||
|
virtual int freeze();
|
||||||
|
virtual int thaw();
|
||||||
|
|
||||||
void add_item(GuiItem*);
|
void add_item(GuiItem*);
|
||||||
void remove_item(GuiItem*);
|
void remove_item(GuiItem*);
|
||||||
void pack_item(GuiItem*, Packing, GuiItem*, float = 0.);
|
void pack_item(GuiItem*, Packing, GuiItem*, float = 0.);
|
||||||
|
@ -24,6 +24,14 @@ GuiItem::~GuiItem(void) {
|
|||||||
this->unmanage();
|
this->unmanage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GuiItem::freeze() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiItem::thaw() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void GuiItem::manage(GuiManager* mgr, EventHandler&) {
|
void GuiItem::manage(GuiManager* mgr, EventHandler&) {
|
||||||
test_ref_count_integrity();
|
test_ref_count_integrity();
|
||||||
_mgr = mgr;
|
_mgr = mgr;
|
||||||
|
@ -31,6 +31,9 @@ PUBLISHED:
|
|||||||
virtual void manage(GuiManager*, EventHandler&) = 0;
|
virtual void manage(GuiManager*, EventHandler&) = 0;
|
||||||
virtual void unmanage(void) = 0;
|
virtual void unmanage(void) = 0;
|
||||||
|
|
||||||
|
virtual int freeze();
|
||||||
|
virtual int thaw();
|
||||||
|
|
||||||
virtual void set_scale(float) = 0;
|
virtual void set_scale(float) = 0;
|
||||||
virtual void set_pos(const LVector3f&) = 0;
|
virtual void set_pos(const LVector3f&) = 0;
|
||||||
INLINE void set_priority(const Priority);
|
INLINE void set_priority(const Priority);
|
||||||
|
@ -160,6 +160,10 @@ GuiLabel* GuiLabel::make_simple_text_label(const string& text, Node* font,
|
|||||||
TextNode* n = new TextNode("GUI label");
|
TextNode* n = new TextNode("GUI label");
|
||||||
ret->_geom = n;
|
ret->_geom = n;
|
||||||
ret->_tex = tex;
|
ret->_tex = tex;
|
||||||
|
|
||||||
|
// The GuiLabel is initially frozen at the time it is created.
|
||||||
|
n->freeze();
|
||||||
|
|
||||||
n->set_font(font);
|
n->set_font(font);
|
||||||
n->set_align(TM_ALIGN_CENTER);
|
n->set_align(TM_ALIGN_CENTER);
|
||||||
n->set_text_color(ret->get_foreground_color());
|
n->set_text_color(ret->get_foreground_color());
|
||||||
@ -172,6 +176,32 @@ GuiLabel* GuiLabel::make_simple_text_label(const string& text, Node* font,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GuiLabel::freeze() {
|
||||||
|
switch (_type) {
|
||||||
|
case SIMPLE_TEXT:
|
||||||
|
{
|
||||||
|
TextNode* n = DCAST(TextNode, _geom);
|
||||||
|
return n->freeze();
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiLabel::thaw() {
|
||||||
|
switch (_type) {
|
||||||
|
case SIMPLE_TEXT:
|
||||||
|
{
|
||||||
|
TextNode* n = DCAST(TextNode, _geom);
|
||||||
|
return n->thaw();
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GuiLabel::get_extents(float& l, float& r, float& b, float& t) {
|
void GuiLabel::get_extents(float& l, float& r, float& b, float& t) {
|
||||||
switch (_type) {
|
switch (_type) {
|
||||||
case SIMPLE_TEXT:
|
case SIMPLE_TEXT:
|
||||||
|
@ -55,6 +55,9 @@ PUBLISHED:
|
|||||||
static GuiLabel* make_simple_text_label(const string&, Node*,
|
static GuiLabel* make_simple_text_label(const string&, Node*,
|
||||||
Texture* = (Texture*)0L);
|
Texture* = (Texture*)0L);
|
||||||
|
|
||||||
|
int freeze();
|
||||||
|
int thaw();
|
||||||
|
|
||||||
void get_extents(float&, float&, float&, float&);
|
void get_extents(float&, float&, float&, float&);
|
||||||
float get_width(void);
|
float get_width(void);
|
||||||
float get_height(void);
|
float get_height(void);
|
||||||
|
@ -40,6 +40,14 @@ void GuiSign::unmanage(void) {
|
|||||||
GuiItem::unmanage();
|
GuiItem::unmanage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GuiSign::freeze() {
|
||||||
|
return _sign->freeze();
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiSign::thaw() {
|
||||||
|
return _sign->thaw();
|
||||||
|
}
|
||||||
|
|
||||||
void GuiSign::set_scale(float f) {
|
void GuiSign::set_scale(float f) {
|
||||||
_sign->set_scale(f * _sign_scale);
|
_sign->set_scale(f * _sign_scale);
|
||||||
GuiItem::set_scale(f);
|
GuiItem::set_scale(f);
|
||||||
|
@ -25,6 +25,9 @@ PUBLISHED:
|
|||||||
virtual void manage(GuiManager*, EventHandler&);
|
virtual void manage(GuiManager*, EventHandler&);
|
||||||
virtual void unmanage(void);
|
virtual void unmanage(void);
|
||||||
|
|
||||||
|
virtual int freeze();
|
||||||
|
virtual int thaw();
|
||||||
|
|
||||||
virtual void set_scale(float);
|
virtual void set_scale(float);
|
||||||
virtual void set_pos(const LVector3f&);
|
virtual void set_pos(const LVector3f&);
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
config_text.cxx config_text.h textNode.I textNode.cxx textNode.h
|
config_text.cxx config_text.h textNode.I textNode.cxx textNode.h
|
||||||
|
|
||||||
#define INSTALL_HEADERS \
|
#define INSTALL_HEADERS \
|
||||||
textNode.I textNode.h
|
config_text.h textNode.I textNode.h
|
||||||
|
|
||||||
#define IGATESCAN all
|
#define IGATESCAN all
|
||||||
|
|
||||||
|
@ -26,6 +26,11 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE int TextNode::
|
INLINE int TextNode::
|
||||||
freeze() {
|
freeze() {
|
||||||
|
if (text_cat.is_debug()) {
|
||||||
|
text_cat.debug()
|
||||||
|
<< "Freezing " << this->get_name() << ", level = "
|
||||||
|
<< _freeze_level << "\n";
|
||||||
|
}
|
||||||
return _freeze_level++;
|
return _freeze_level++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +57,11 @@ get_freeze_level() const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE int TextNode::
|
INLINE int TextNode::
|
||||||
thaw() {
|
thaw() {
|
||||||
|
if (text_cat.is_debug()) {
|
||||||
|
text_cat.debug()
|
||||||
|
<< "Thawing " << this->get_name() << ", level = "
|
||||||
|
<< _freeze_level-1 << "\n";
|
||||||
|
}
|
||||||
nassertr(_freeze_level > 0, _freeze_level);
|
nassertr(_freeze_level > 0, _freeze_level);
|
||||||
_freeze_level--;
|
_freeze_level--;
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
#include <pandabase.h>
|
#include <pandabase.h>
|
||||||
|
|
||||||
|
#include "config_text.h"
|
||||||
|
|
||||||
#include <pt_Node.h>
|
#include <pt_Node.h>
|
||||||
#include <namedNode.h>
|
#include <namedNode.h>
|
||||||
#include <luse.h>
|
#include <luse.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user