Panda3D
textGraphic.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file textGraphic.I
10  * @author drose
11  * @date 2006-08-18
12  */
13 
14 /**
15  *
16  */
17 INLINE TextGraphic::
18 TextGraphic() {
19  _frame = LVecBase4::zero();
20  _instance_flag = false;
21 }
22 
23 /**
24  *
25  */
26 INLINE TextGraphic::
27 TextGraphic(const NodePath &model, const LVecBase4 &frame) :
28  _model(model),
29  _frame(frame),
30  _instance_flag(false)
31 {
32 }
33 
34 /**
35  *
36  */
37 INLINE TextGraphic::
38 TextGraphic(const NodePath &model, PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top) :
39  _model(model),
40  _frame(left, right, bottom, top),
41  _instance_flag(false)
42 {
43 }
44 
45 /**
46  * Returns the NodePath associated with the graphic, that renders the desired
47  * image.
48  */
49 INLINE NodePath TextGraphic::
50 get_model() const {
51  return _model;
52 }
53 
54 /**
55  * Changes the NodePath associated with the graphic. This NodePath should
56  * contain geometry that will render the desired graphic image.
57  */
58 INLINE void TextGraphic::
59 set_model(const NodePath &model) {
60  _model = model;
61 }
62 
63 /**
64  * Returns the frame specified for the graphic. This is the amount of space
65  * that will be reserved for the graphic when it is embedded in a text
66  * paragraph, in the form (left, right, bottom, top).
67  *
68  * The actual graphic, as rendered by the NodePath specified via set_model(),
69  * should more or less fit within this rectangle. It is not required to fit
70  * completely within it, but if it does not, it may visually overlap with
71  * nearby text.
72  */
73 INLINE LVecBase4 TextGraphic::
74 get_frame() const {
75  return _frame;
76 }
77 
78 /**
79  * Specifies the (left, right, bottom, top) bounding frame for the graphic.
80  * See get_frame().
81  */
82 INLINE void TextGraphic::
83 set_frame(const LVecBase4 &frame) {
84  _frame = frame;
85 }
86 
87 /**
88  * Specifies the (left, right, bottom, top) bounding frame for the graphic.
89  * See get_frame().
90  */
91 INLINE void TextGraphic::
92 set_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top) {
93  _frame.set(left, right, bottom, top);
94 }
95 
96 /**
97  * Returns the instance_flag. See set_instance_flag().
98  */
99 INLINE bool TextGraphic::
100 get_instance_flag() const {
101  return _instance_flag;
102 }
103 
104 /**
105  * Sets the instance_flag. When this is true, the graphic is directly
106  * instanced to the scene graph whenever it appears; when it is false, the
107  * graphic is copied. The default is false, which is best for most
108  * applications. You might need to set it true for special kinds of
109  * "graphics" like interactive elements, for instance a PGEntry.
110  */
111 INLINE void TextGraphic::
112 set_instance_flag(bool instance_flag) {
113  _instance_flag = instance_flag;
114 }
set_instance_flag
Sets the instance_flag.
Definition: textGraphic.h:54
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:161
set_model
Changes the NodePath associated with the graphic.
Definition: textGraphic.h:45
set_frame
Specifies the (left, right, bottom, top) bounding frame for the graphic.
Definition: textGraphic.h:50