Panda3D

textGraphic.I

00001 // Filename: textGraphic.I
00002 // Created by:  drose (18Aug06)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: TextGraphic::Constructor
00018 //       Access: Published
00019 //  Description:
00020 ////////////////////////////////////////////////////////////////////
00021 INLINE TextGraphic::
00022 TextGraphic() {
00023   _frame = LVecBase4::zero();
00024   _instance_flag = false;
00025 }
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //     Function: TextGraphic::Constructor
00029 //       Access: Published
00030 //  Description:
00031 ////////////////////////////////////////////////////////////////////
00032 INLINE TextGraphic::
00033 TextGraphic(const NodePath &model, const LVecBase4 &frame) :
00034   _model(model),
00035   _frame(frame),
00036   _instance_flag(false)
00037 {
00038 }
00039 
00040 ////////////////////////////////////////////////////////////////////
00041 //     Function: TextGraphic::Constructor
00042 //       Access: Published
00043 //  Description:
00044 ////////////////////////////////////////////////////////////////////
00045 INLINE TextGraphic::
00046 TextGraphic(const NodePath &model, PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top) :
00047   _model(model),
00048   _frame(left, right, bottom, top),
00049   _instance_flag(false)
00050 {
00051 }
00052 
00053 ////////////////////////////////////////////////////////////////////
00054 //     Function: TextGraphic::get_model
00055 //       Access: Published
00056 //  Description: Returns the NodePath associated with the graphic,
00057 //               that renders the desired image.
00058 ////////////////////////////////////////////////////////////////////
00059 INLINE NodePath TextGraphic::
00060 get_model() const {
00061   return _model;
00062 }
00063 
00064 ////////////////////////////////////////////////////////////////////
00065 //     Function: TextGraphic::set_model
00066 //       Access: Published
00067 //  Description: Changes the NodePath associated with the graphic.
00068 //               This NodePath should contain geometry that will
00069 //               render the desired graphic image.
00070 ////////////////////////////////////////////////////////////////////
00071 INLINE void TextGraphic::
00072 set_model(const NodePath &model) {
00073   _model = model;
00074 }
00075 
00076 ////////////////////////////////////////////////////////////////////
00077 //     Function: TextGraphic::get_frame
00078 //       Access: Published
00079 //  Description: Returns the frame specified for the graphic.  This is
00080 //               the amount of space that will be reserved for the
00081 //               graphic when it is embedded in a text paragraph, in
00082 //               the form (left, right, bottom, top).
00083 //
00084 //               The actual graphic, as rendered by the NodePath
00085 //               specified via set_model(), should more or less fit
00086 //               within this rectangle.  It is not required to fit
00087 //               completely within it, but if it does not, it may
00088 //               visually overlap with nearby text.
00089 ////////////////////////////////////////////////////////////////////
00090 INLINE LVecBase4 TextGraphic::
00091 get_frame() const {
00092   return _frame;
00093 }
00094 
00095 ////////////////////////////////////////////////////////////////////
00096 //     Function: TextGraphic::set_frame
00097 //       Access: Published
00098 //  Description: Specifies the (left, right, bottom, top) bounding
00099 //               frame for the graphic.  See get_frame().
00100 ////////////////////////////////////////////////////////////////////
00101 INLINE void TextGraphic::
00102 set_frame(const LVecBase4 &frame) {
00103   _frame = frame;
00104 }
00105 
00106 ////////////////////////////////////////////////////////////////////
00107 //     Function: TextGraphic::set_frame
00108 //       Access: Published
00109 //  Description: Specifies the (left, right, bottom, top) bounding
00110 //               frame for the graphic.  See get_frame().
00111 ////////////////////////////////////////////////////////////////////
00112 INLINE void TextGraphic::
00113 set_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top) {
00114   _frame.set(left, right, bottom, top);
00115 }
00116 
00117 ////////////////////////////////////////////////////////////////////
00118 //     Function: TextGraphic::get_instance_flag
00119 //       Access: Published
00120 //  Description: Returns the instance_flag.  See set_instance_flag().
00121 ////////////////////////////////////////////////////////////////////
00122 INLINE bool TextGraphic::
00123 get_instance_flag() const {
00124   return _instance_flag;
00125 }
00126 
00127 ////////////////////////////////////////////////////////////////////
00128 //     Function: TextGraphic::set_instance_flag
00129 //       Access: Published
00130 //  Description: Sets the instance_flag.  When this is true, the
00131 //               graphic is directly instanced to the scene graph
00132 //               whenever it appears; when it is false, the graphic is
00133 //               copied.  The default is false, which is best for most
00134 //               applications.  You might need to set it true for
00135 //               special kinds of "graphics" like interactive
00136 //               elements, for instance a PGEntry.
00137 ////////////////////////////////////////////////////////////////////
00138 INLINE void TextGraphic::
00139 set_instance_flag(bool instance_flag) {
00140   _instance_flag = instance_flag;
00141 }
 All Classes Functions Variables Enumerations