50 explicit TextNode(
const std::string &name);
64 FF_dynamic_merge = 0x0008,
67 INLINE PN_stdfloat get_line_height()
const;
69 INLINE
void set_max_rows(
int max_rows);
70 INLINE
void clear_max_rows();
71 INLINE
bool has_max_rows()
const;
72 INLINE
int get_max_rows()
const;
73 INLINE
bool has_overflow()
const;
75 INLINE
void set_frame_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a);
76 INLINE
void set_frame_color(
const LColor &frame_color);
77 INLINE LColor get_frame_color()
const;
79 INLINE
void set_card_border(PN_stdfloat size, PN_stdfloat uv_portion);
80 INLINE
void clear_card_border();
81 INLINE PN_stdfloat get_card_border_size()
const;
82 INLINE PN_stdfloat get_card_border_uv_portion()
const;
83 INLINE
bool has_card_border()
const;
85 INLINE
void set_card_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a);
86 INLINE
void set_card_color(
const LColor &card_color);
87 INLINE LColor get_card_color()
const;
89 INLINE
void set_card_texture(
Texture *card_texture);
90 INLINE
void clear_card_texture();
91 INLINE
bool has_card_texture()
const;
92 INLINE
Texture *get_card_texture()
const;
94 INLINE
void set_frame_as_margin(PN_stdfloat left, PN_stdfloat right,
95 PN_stdfloat bottom, PN_stdfloat top);
96 INLINE
void set_frame_actual(PN_stdfloat left, PN_stdfloat right,
97 PN_stdfloat bottom, PN_stdfloat top);
98 INLINE
void clear_frame();
99 INLINE
bool has_frame()
const;
100 INLINE
bool is_frame_as_margin()
const;
101 INLINE LVecBase4 get_frame_as_set()
const;
102 INLINE LVecBase4 get_frame_actual()
const;
104 INLINE
void set_frame_line_width(PN_stdfloat line_width);
105 INLINE PN_stdfloat get_frame_line_width()
const;
106 INLINE
void set_frame_corners(
bool corners);
107 INLINE
bool get_frame_corners()
const;
109 INLINE
void set_card_as_margin(PN_stdfloat left, PN_stdfloat right,
110 PN_stdfloat bottom, PN_stdfloat top);
111 INLINE
void set_card_actual(PN_stdfloat left, PN_stdfloat right,
112 PN_stdfloat bottom, PN_stdfloat top);
113 INLINE
void set_card_decal(
bool card_decal);
114 INLINE
void clear_card();
115 INLINE
bool has_card()
const;
116 INLINE
bool get_card_decal()
const;
117 INLINE
bool is_card_as_margin()
const;
118 INLINE LVecBase4 get_card_as_set()
const;
119 INLINE LVecBase4 get_card_actual()
const;
120 INLINE LVecBase4 get_card_transformed()
const;
123 INLINE LMatrix4 get_transform()
const;
125 INLINE
void set_coordinate_system(CoordinateSystem cs);
126 INLINE CoordinateSystem get_coordinate_system()
const;
128 INLINE
void set_usage_hint(Geom::UsageHint usage_hint);
129 INLINE Geom::UsageHint get_usage_hint()
const;
131 INLINE
void set_flatten_flags(
int flatten_flags);
132 INLINE
int get_flatten_flags()
const;
138 INLINE
void clear_font();
141 INLINE
void clear_small_caps();
144 INLINE
void clear_small_caps_scale();
146 INLINE
void set_slant(PN_stdfloat slant);
147 INLINE
void clear_slant();
149 INLINE
void set_align(Alignment align_type);
150 INLINE
void clear_align();
153 INLINE
void clear_indent();
156 INLINE
void clear_wordwrap();
158 INLINE
void set_text_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a);
159 INLINE
void set_text_color(
const LColor &text_color);
160 INLINE
void clear_text_color();
162 INLINE
void set_shadow_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a);
163 INLINE
void set_shadow_color(
const LColor &shadow_color);
164 INLINE
void clear_shadow_color();
166 INLINE
void set_shadow(PN_stdfloat xoffset, PN_stdfloat yoffset);
167 INLINE
void set_shadow(
const LVecBase2 &shadow_offset);
168 INLINE
void clear_shadow();
170 INLINE
void set_bin(
const std::string &bin);
171 INLINE
void clear_bin();
174 INLINE
void clear_draw_order();
177 INLINE
void clear_tab_width();
180 INLINE
void clear_glyph_scale();
183 INLINE
void clear_glyph_shift();
187 INLINE std::string get_wordwrapped_text()
const;
191 PN_stdfloat calc_width(
wchar_t character)
const;
192 INLINE PN_stdfloat calc_width(
const std::string &line)
const;
194 bool has_exact_character(
wchar_t character)
const;
195 bool has_character(
wchar_t character)
const;
196 bool is_whitespace(
wchar_t character)
const;
198 INLINE std::wstring get_wordwrapped_wtext()
const;
199 PN_stdfloat calc_width(
const std::wstring &line)
const;
201 virtual void output(std::ostream &out)
const;
202 virtual void write(std::ostream &out,
int indent_level = 0)
const;
206 INLINE PN_stdfloat get_left()
const;
207 INLINE PN_stdfloat get_right()
const;
208 INLINE PN_stdfloat get_bottom()
const;
209 INLINE PN_stdfloat get_top()
const;
210 INLINE PN_stdfloat get_height()
const;
211 INLINE PN_stdfloat get_width()
const;
213 INLINE LPoint3 get_upper_left_3d()
const;
214 INLINE LPoint3 get_lower_right_3d()
const;
216 INLINE
int get_num_rows()
const;
219 INLINE
void update();
220 INLINE
void force_update();
225 MAKE_PROPERTY(max_rows, get_max_rows, set_max_rows);
226 MAKE_PROPERTY(frame_color, get_frame_color, set_frame_color);
227 MAKE_PROPERTY(card_color, get_card_color, set_card_color);
228 MAKE_PROPERTY(card_texture, get_card_texture, set_card_texture);
229 MAKE_PROPERTY(frame_line_width, get_frame_line_width, set_frame_line_width);
230 MAKE_PROPERTY(frame_corners, get_frame_corners, set_frame_corners);
231 MAKE_PROPERTY(transform, get_transform, set_transform);
232 MAKE_PROPERTY(coordinate_system, get_coordinate_system, set_coordinate_system);
233 MAKE_PROPERTY(usage_hint, get_usage_hint, set_usage_hint);
234 MAKE_PROPERTY(flatten_flags, get_flatten_flags, set_flatten_flags);
236 MAKE_PROPERTY2(font, has_font, get_font, set_font, clear_font);
237 MAKE_PROPERTY2(small_caps, has_small_caps, get_small_caps,
238 set_small_caps, clear_small_caps);
239 MAKE_PROPERTY2(small_caps_scale, has_small_caps_scale, get_small_caps_scale,
240 set_small_caps_scale, clear_small_caps_scale);
241 MAKE_PROPERTY2(slant, has_slant, get_slant, set_slant, clear_slant);
242 MAKE_PROPERTY2(underscore, has_underscore, get_underscore,
243 set_underscore, clear_underscore);
244 MAKE_PROPERTY2(underscore_height, has_underscore_height, get_underscore_height,
245 set_underscore_height, clear_underscore_height);
246 MAKE_PROPERTY2(align, has_align, get_align, set_align, clear_align);
247 MAKE_PROPERTY2(
indent, has_indent, get_indent, set_indent, clear_indent);
248 MAKE_PROPERTY2(wordwrap, has_wordwrap, get_wordwrap, set_wordwrap, clear_wordwrap);
249 MAKE_PROPERTY2(preserve_trailing_whitespace,
250 has_preserve_trailing_whitespace, get_preserve_trailing_whitespace,
251 set_preserve_trailing_whitespace, clear_preserve_trailing_whitespace);
252 MAKE_PROPERTY2(text_color, has_text_color, get_text_color,
253 set_text_color, clear_text_color);
254 MAKE_PROPERTY2(shadow_color, has_shadow_color, get_shadow_color,
255 set_shadow_color, clear_shadow_color);
256 MAKE_PROPERTY2(shadow, has_shadow, get_shadow, set_shadow, clear_shadow);
257 MAKE_PROPERTY2(bin, has_bin, get_bin, set_bin, clear_bin);
258 MAKE_PROPERTY2(draw_order, has_draw_order, get_draw_order,
259 set_draw_order, clear_draw_order);
260 MAKE_PROPERTY2(tab_width, has_tab_width, get_tab_width,
261 set_tab_width, clear_tab_width);
262 MAKE_PROPERTY2(glyph_scale, has_glyph_scale, get_glyph_scale,
263 set_glyph_scale, clear_glyph_scale);
264 MAKE_PROPERTY2(glyph_shift, has_glyph_shift, get_glyph_shift,
265 set_glyph_shift, clear_glyph_shift);
266 MAKE_PROPERTY2(text_scale, has_text_scale, get_text_scale,
267 set_text_scale, clear_text_scale);
271 virtual void text_changed() final;
274 virtual
int get_unsafe_to_apply_attribs() const;
279 calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point,
282 Thread *current_thread) const;
285 virtual
bool is_renderable() const;
287 virtual
void compute_internal_bounds(CPT(
BoundingVolume) &internal_bounds,
288 int &internal_vertices,
290 Thread *current_thread) const;
298 INLINE
void invalidate_no_measure();
299 INLINE
void invalidate_with_measure();
300 INLINE
void check_rebuild() const;
301 INLINE
void check_measure() const;
307 PT(
PandaNode) do_get_internal_geom() const;
323 F_has_frame = 0x0001,
324 F_frame_as_margin = 0x0002,
326 F_card_as_margin = 0x0008,
327 F_has_card_texture = 0x0010,
328 F_frame_corners = 0x0020,
329 F_card_transp = 0x0040,
330 F_has_card_border = 0x0080,
331 F_needs_rebuild = 0x0100,
332 F_needs_measure = 0x0200,
333 F_has_overflow = 0x0400,
334 F_card_decal = 0x0800,
339 GeomEnums::UsageHint _usage_hint;
341 PN_stdfloat _frame_width;
342 PN_stdfloat _card_border_size;
343 PN_stdfloat _card_border_uv_portion;
345 LVector2 _frame_ul, _frame_lr;
346 LVector2 _card_ul, _card_lr;
349 CoordinateSystem _coordinate_system;
351 LPoint3 _ul3d, _lr3d;
354 LVector2 _text_ul, _text_lr;
356 std::wstring _wordwrapped_wtext;
364 static void init_type() {
365 PandaNode::init_type();
366 TextProperties::init_type();
368 PandaNode::get_class_type(),
369 TextProperties::get_class_type());
372 return get_class_type();
374 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
set_align
Specifies the alignment of the text within its margins.
A basic node of the scene graph or data graph.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class can be used to convert text between multiple representations, e.g.
set_glyph_scale
Specifies the factor by which to scale each letter of the text as it is placed, in addition to any sc...
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This collects together the pieces of data that are accumulated for each node while walking the scene ...
A standard mutex, or mutual exclusion lock.
An encapsulation of a font; i.e.
set_transform
Sets the transform that will be applied to this node and below.
set_tab_width
Sets the width of each tab stop, in screen units.
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
A lightweight class that represents a single element that may be timed and/or counted via stats.
set_shadow
Specifies that the text should be drawn with a shadow, by creating a second copy of the text and offs...
This class is used by the SceneGraphReducer to maintain and accumulate the set of attributes we have ...
set_draw_order
Sets the drawing order of text created by the TextNode.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
set_small_caps
Sets the small_caps flag.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
set_wordwrap
Sets the text up to automatically wordwrap when it exceeds the indicated width.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual PandaNode * make_copy() const
Returns a newly-allocated PandaNode that is a shallow copy of this one.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
set_glyph_shift
Specifies a vertical amount to shift each letter of the text as it is placed.
set_slant
Specifies the factor by which the text slants to the right.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
set_indent
Specifies the amount of extra space that is inserted before the first character of each line.
A thread; that is, a lightweight process.
set_bin
Names the CullBin that the text geometry should be assigned to.
The primary interface to this module.
This defines the set of visual properties that may be assigned to the individual characters of the te...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
set_small_caps_scale
Sets the scale factor applied to lowercase letters from their uppercase equivalents,...
set_font
Sets the font that will be used when making text.
TypeHandle is the identifier used to differentiate C++ class types.
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.