41 #ifndef INCLUDED_GLS_CTL_TEXT_BOX_H
42 #define INCLUDED_GLS_CTL_TEXT_BOX_H
47 #if defined( EMSCRIPTEN ) || defined( RPI_ARCH )
48 # define GLS_CTL_FALLBACK_ENABLED
50 # error "GLES should always be enabled when using the CTL fallback code"
55 #if( defined( GLSGEN_EXPORT_GLSCTLTEXTBOX ) || defined( GLSGEN_IMPORT_GLSCTLTEXTBOX ) || defined( GLSGEN_GLSCTLTEXTBOX_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
56 && defined( _MSC_VER )
57 # if defined( GLSGEN_EXPORT_GLSCTLTEXTBOX ) || defined( GLSGEN_GLSCTLTEXTBOX_EXPORT_GENERATED )
58 # define GLSGEN_GLSCTLTEXTBOX_EXPORT __declspec( dllexport )
60 # define GLSGEN_GLSCTLTEXTBOX_EXPORT __declspec( dllimport )
63 # define GLSGEN_GLSCTLTEXTBOX_EXPORT
73 #ifndef GLS_CTL_FALLBACK_ENABLED
75 # define CTL_BASE_CLASS GlsText
78 # define CTL_BASE_CLASS GlsTextBox
81 #define LIB_BASE_NAME "gls_ctl_text_box"
87 # if !defined( NO_GLS_AUTOLIB ) && !defined( GLS_IMPORT_LIBRARY )
89 # define PANGO_SUFFIX "_64"
91 # define PANGO_SUFFIX ""
93 # pragma message( "Will automatically link with libfontconfig" PANGO_SUFFIX "-1.0.lib" )
94 # pragma message( "Will automatically link with libpango" PANGO_SUFFIX "-1.0.lib" )
95 # pragma message( "Will automatically link with libpangoft2" PANGO_SUFFIX "-1.0.lib" )
96 # pragma message( "Will automatically link with libgobject" PANGO_SUFFIX "-2.0.lib" )
97 # pragma comment( lib, "libfontconfig" PANGO_SUFFIX "-1.0.lib" )
98 # pragma comment( lib, "libpango" PANGO_SUFFIX "-1.0.lib" )
99 # pragma comment( lib, "libpangoft2" PANGO_SUFFIX "-1.0.lib" )
100 # pragma comment( lib, "libgobject" PANGO_SUFFIX "-2.0.lib" )
107 #ifndef GLS_CTL_FALLBACK_ENABLED
108 class GlsPangoWrapper;
111 class GlsTextBoxFontRenderer;
112 #endif // GLS_CTL_FALLBACK_ENABLED
115 class GlsGloFileAttribute;
116 class GlsStateManager;
117 class GlsQuadListVCT_2D;
138 friend class GlsCTLTextBoxEditor;
140 #ifndef GLS_CTL_FALLBACK_ENABLED
149 #endif // GLS_CTL_FALLBACK_ENABLED
154 VERTICAL_ALIGNMENT_CENTER = ALIGN_CENTER,
155 VERTICAL_ALIGNMENT_TOP = ALIGN_TOP,
156 VERTICAL_ALIGNMENT_BOTTOM = ALIGN_BOTTOM
163 ELLIPSIZE_MODE_START,
164 ELLIPSIZE_MODE_MIDDLE,
179 TEXT_DIRECTION_AUTOMATIC,
180 TEXT_DIRECTION_AUTO_BY_LINE
218 #ifndef GLS_CTL_FALLBACK_ENABLED
232 virtual GLSGEN_GLSCTLTEXTBOX_EXPORT
void Draw();
235 virtual GLSGEN_GLSCTLTEXTBOX_EXPORT
void SetVertices(
unsigned int nPoints,
Vertex* vertices );
238 virtual GLSGEN_GLSCTLTEXTBOX_EXPORT
void Scale(
float px,
float py,
float pz,
Vertex* anchor,
int handleBar );
244 virtual GLSGEN_GLSCTLTEXTBOX_EXPORT
void VaString(
const char* format, ... );
249 virtual GLSGEN_GLSCTLTEXTBOX_EXPORT
void VerticalAlignment( VerticalAlignment_t verticalAlignment );
256 virtual GLSGEN_GLSCTLTEXTBOX_EXPORT
void VerticalAlignment( VerticalAlignment_t verticalAlignment ) { _BaseClass::VerticalAlignment( verticalAlignment ); }
259 #endif // GLS_CTL_FALLBACK_ENABLED
279 virtual GLSGEN_GLSCTLTEXTBOX_EXPORT
void Rebuild();
300 virtual GLSGEN_GLSCTLTEXTBOX_EXPORT
unsigned int GetLineCount();
306 virtual GLSGEN_GLSCTLTEXTBOX_EXPORT
unsigned int GetGlyphCount();
313 virtual GLSGEN_GLSCTLTEXTBOX_EXPORT GlyphMetrics
GetGlyphMetrics(
const unsigned int glyphIndex );
327 virtual GLSGEN_GLSCTLTEXTBOX_EXPORT
void SetAltWidth(
float width );
333 virtual GLSGEN_GLSCTLTEXTBOX_EXPORT
void SetAltHeight(
float height );
374 GLSGEN_GLSCTLTEXTBOX_EXPORT
static void SetAutomaticPixelAlignmentEnabled(
const bool enabled );
378 #ifndef GLS_CTL_FALLBACK_ENABLED
400 static bool s_isAutomaticPixelAlignmentEnabled;
405 #endif // GLS_CTL_FALLBACK_ENABLED
412 # ifndef GLS_CTL_FALLBACK_ENABLED
419 bool _geometryRefreshDraw;
424 virtual GLSGEN_GLSCTLTEXTBOX_EXPORT
void PopulateQuadStorage(
IGlsStateManager* stateManager );
430 # endif // GLS_CTL_FALLBACK_ENABLED
435 virtual GLSGEN_GLSCTLTEXTBOX_EXPORT
void DrawText();
437 #ifndef GLS_CTL_FALLBACK_ENABLED
441 #endif // GLS_CTL_FALLBACK_ENABLED
445 void OnCellDimensionChanged()
457 #ifndef GLS_CTL_FALLBACK_ENABLED
466 if( str ==
"ALIGN_TOP" || str ==
"VERTICAL_ALIGNMENT_TOP" )
468 verticalAlignment = disti::GlsCTLTextBox::ALIGN_TOP;
470 else if( str ==
"ALIGN_CENTER" || str ==
"VERTICAL_ALIGNMENT_CENTER" )
472 verticalAlignment = disti::GlsCTLTextBox::ALIGN_CENTER;
474 else if( str ==
"ALIGN_BOTTOM" || str ==
"VERTICAL_ALIGNMENT_BOTTOM" )
476 verticalAlignment = disti::GlsCTLTextBox::ALIGN_BOTTOM;
485 switch( verticalAlignment )
487 case disti::GlsCTLTextBox::ALIGN_TOP:
488 outstr <<
"ALIGN_TOP";
490 case disti::GlsCTLTextBox::ALIGN_CENTER:
491 outstr <<
"ALIGN_CENTER";
493 case disti::GlsCTLTextBox::ALIGN_BOTTOM:
494 outstr <<
"ALIGN_BOTTOM";
499 #endif // GLS_CTL_FALLBACK_ENABLED
508 if( str ==
"ELLIPSIZE_MODE_NONE" )
510 ellipsizeMode = disti::GlsCTLTextBox::ELLIPSIZE_MODE_NONE;
512 else if( str ==
"ELLIPSIZE_MODE_START" )
514 ellipsizeMode = disti::GlsCTLTextBox::ELLIPSIZE_MODE_START;
516 else if( str ==
"ELLIPSIZE_MODE_MIDDLE" )
518 ellipsizeMode = disti::GlsCTLTextBox::ELLIPSIZE_MODE_MIDDLE;
520 else if( str ==
"ELLIPSIZE_MODE_END" )
522 ellipsizeMode = disti::GlsCTLTextBox::ELLIPSIZE_MODE_END;
531 switch( ellipsizeMode )
533 case disti::GlsCTLTextBox::ELLIPSIZE_MODE_NONE:
534 outstr <<
"ELLIPSIZE_MODE_NONE";
536 case disti::GlsCTLTextBox::ELLIPSIZE_MODE_START:
537 outstr <<
"ELLIPSIZE_MODE_START";
539 case disti::GlsCTLTextBox::ELLIPSIZE_MODE_MIDDLE:
540 outstr <<
"ELLIPSIZE_MODE_MIDDLE";
542 case disti::GlsCTLTextBox::ELLIPSIZE_MODE_END:
543 outstr <<
"ELLIPSIZE_MODE_END";
556 if( str ==
"TEXT_DIRECTION_LTR" )
558 direction = disti::GlsCTLTextBox::TEXT_DIRECTION_LTR;
560 else if( str ==
"TEXT_DIRECTION_RTL" )
562 direction = disti::GlsCTLTextBox::TEXT_DIRECTION_RTL;
564 else if( str ==
"TEXT_DIRECTION_AUTOMATIC" )
566 direction = disti::GlsCTLTextBox::TEXT_DIRECTION_AUTOMATIC;
568 else if( str ==
"TEXT_DIRECTION_AUTO_BY_LINE" )
570 direction = disti::GlsCTLTextBox::TEXT_DIRECTION_AUTO_BY_LINE;
581 case disti::GlsCTLTextBox::TEXT_DIRECTION_LTR:
582 outstr <<
"TEXT_DIRECTION_LTR";
584 case disti::GlsCTLTextBox::TEXT_DIRECTION_RTL:
585 outstr <<
"TEXT_DIRECTION_RTL";
587 case disti::GlsCTLTextBox::TEXT_DIRECTION_AUTOMATIC:
588 outstr <<
"TEXT_DIRECTION_AUTOMATIC";
590 case disti::GlsCTLTextBox::TEXT_DIRECTION_AUTO_BY_LINE:
591 outstr <<
"TEXT_DIRECTION_AUTO_BY_LINE";
599 #endif // INCLUDED_GLS_CTL_TEXT_BOX_H
The DistiUnhideGlobalsDummyClass class.
virtual VerticalAlignment_t VerticalAlignment()
The disti::GlsTextBox class.
ScopedPtr< GlsPangoWrapper > _glsPangoWrapper
Definition: gls_ctl_text_box.h:390
virtual float TextHorizontalScale()
void AdjustImageVertsAndCoords(PangoRect &verts, PangoRect &texCoords)
virtual void PreDraw(const OpenGLMatrices ¤t, Culler &culler)
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:276
virtual void CopyGeometry(DisplayObject *src)
virtual void SetVertices(unsigned int nPoints, Vertex *vertices)
float _altWidth
Definition: gls_ctl_text_box.h:380
bool RequiresFontFile() const DISTI_METHOD_OVERRIDE
Definition: gls_ctl_text_box.h:364
virtual DisplayObject * CloneObject(bool generateNames=false)
EllipsizeMode_t
Definition: gls_ctl_text_box.h:160
virtual void SetAvailableAttributes(unsigned int value)
virtual void VaString(const char *format,...)
virtual GlyphMetrics GetGlyphMetrics(const unsigned int glyphIndex)
float _cellHeight
Definition: gls_text.h:785
Definition: gls_state_manager_interface.h:67
virtual void RecalcVertices()
virtual unsigned int GetLineCount()
The disti::GlsText class.
float _altHeight
Definition: gls_ctl_text_box.h:382
Definition: gls_glo_file.h:982
virtual unsigned int GetGlyphCount()
virtual void CopyProperties(DisplayObject *src)
virtual float TextVerticalScale()
virtual void Scale(float px, float py, float pz, Vertex *anchor, int handleBar)
The Gls CTL (Complex Text Layout) Text Box.
Definition: gls_ctl_text_box.h:128
bool ControlCellSize() const
Definition: gls_text.h:463
VerticalAlignmentCTL_t
Definition: gls_ctl_text_box.h:152
static const unsigned int INTERNAL_BORDER
Definition: gls_ctl_text_box.h:136
virtual void SetLayoutAutoDir(bool)
Definition: gls_ctl_text_box.h:321
TextDirection_t
Definition: gls_ctl_text_box.h:175
Definition: gls_ctl_text_box.h:186
VerticalAlignment_t
Definition: gls_ctl_text_box.h:142
virtual InterfaceListType * GetCppInterfaceDescription(InterfaceListType *addToThisList=NULL)
float _cellWidth
Definition: gls_text.h:788
virtual void GetCppInterfaceDescriptionFree(InterfaceListType *array)
float _textVerticalScale
Definition: gls_ctl_text_box.h:387
virtual EllipsizeMode_t EllipsizeMode()
virtual void SetAltHeight(float height)
A smart pointer with unique ownership – poor man's std::unique_ptr.
Macros and helper code to determine what subset of C++11/14/17 is available.
float _textHorizontalScale
Definition: gls_ctl_text_box.h:385
virtual TextDirection_t TextDirection()
Definition: bmpimage.h:46
virtual void SetAltWidth(float width)