| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- // Filename: guiLabel.I
- // Created by: cary (26Oct00)
- //
- ////////////////////////////////////////////////////////////////////
- //
- // PANDA 3D SOFTWARE
- // Copyright (c) 2001, 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://www.panda3d.org/license.txt .
- //
- // To contact the maintainers of this program write to
- // [email protected] .
- //
- ////////////////////////////////////////////////////////////////////
- INLINE GuiLabel::GuiLabel(void) : _type(GuiLabel::NONE),
- _arc((RenderRelation*)0L),
- _tex((Texture*)0L),
- _internal((RenderRelation*)0L),
- _gset((Geom*)0L), _model_width(1.),
- _model_height(1.), _scale(1.),
- _scale_x(1.), _scale_y(1.), _scale_z(1.),
- _pos(0., 0., 0.),
- _model_pos(0., 0., 0.),
- _have_foreground(false),
- _foreground(1., 1., 1., 1.),
- _have_background(false),
- _background(0., 0., 0., 0.),
- _have_width(false), _width(0.),
- _have_height(false), _height(0.),
- _mirror_x(false), _mirror_y(false),
- _hard_pri(0), _highest_pri(false),
- _lowest_pri(false), _has_hard_pri(false) {
- }
- INLINE Node* GuiLabel::get_geometry(void) const {
- return _geom;
- }
- INLINE void GuiLabel::set_arc(RenderRelation* r) {
- _arc = r;
- }
- INLINE RenderRelation* GuiLabel::get_arc(void) const {
- return _arc;
- }
- INLINE void GuiLabel::set_width(float f) {
- if (f <= 0.) {
- _have_width = false;
- _width = 0.;
- } else {
- if (_type == MODEL)
- _width = f / this->_model_width;
- else
- _width = f;
- _have_width = true;
- }
- this->set_properties();
- }
- INLINE void GuiLabel::set_height(float f) {
- if (f <= 0.) {
- _have_height = false;
- _height = 0.;
- } else {
- if (_type == MODEL)
- _height = f / this->_model_height;
- else
- _height = f;
- _have_height = true;
- }
- this->set_properties();
- }
- INLINE void GuiLabel::set_scale(float f) {
- _scale = f;
- recompute_transform();
- }
- INLINE void GuiLabel::set_scale(float x, float y, float z) {
- _scale_x = x;
- _scale_y = y;
- _scale_z = z;
- recompute_transform();
- }
- INLINE void GuiLabel::set_mirror_x(bool b) {
- _mirror_x = b;
- }
- INLINE void GuiLabel::set_mirror_y(bool b) {
- _mirror_y = b;
- }
- INLINE void GuiLabel::set_pos(float x, float y, float z) {
- this->set_pos(LVector3f(x, y, z));
- }
- INLINE void GuiLabel::set_pos(const LVector3f& p) {
- _pos = p;
- recompute_transform();
- }
- INLINE float GuiLabel::get_scale(void) const {
- return _scale;
- }
- INLINE bool GuiLabel::get_mirror_x(void) const {
- return _mirror_x;
- }
- INLINE bool GuiLabel::get_mirror_y(void) const {
- return _mirror_y;
- }
- INLINE LVector3f GuiLabel::get_pos(void) const {
- return _pos;
- }
- INLINE void GuiLabel::set_foreground_color(float r, float g, float b,
- float a) {
- this->_have_foreground = true;
- this->set_foreground_color(Colorf(r, g, b, a));
- }
- INLINE void GuiLabel::set_background_color(float r, float g, float b,
- float a) {
- this->set_background_color(Colorf(r, g, b, a));
- }
- INLINE Colorf GuiLabel::get_foreground_color(void) const {
- return _foreground;
- }
- INLINE Colorf GuiLabel::get_background_color(void) const {
- return _background;
- }
- INLINE void GuiLabel::set_shadow_color(float r, float g, float b, float a) {
- this->set_shadow_color(Colorf(r, g, b, a));
- }
- INLINE void GuiLabel::recompute(void) {
- this->recompute_transform();
- }
- INLINE void GuiLabel::set_priority(GuiLabel* l, const PriorityType t) {
- if (t == P_HIGHEST)
- _highest_pri = true;
- else if (t == P_LOWEST)
- _lowest_pri = true;
- else
- this->_priorities[l] = t;
- }
- INLINE bool GuiLabel::has_hard_draw_order(void) const {
- return _has_hard_pri;
- }
- INLINE int GuiLabel::get_draw_order(void) const {
- return _hard_pri;
- }
|