39#ifndef INCLUDED_GLS_CTL_TEXT_BOX_H
40#define INCLUDED_GLS_CTL_TEXT_BOX_H
45#if defined( EMSCRIPTEN )
46# define GLS_CTL_FALLBACK_ENABLED
48# error "GLES should always be enabled when using the CTL fallback code"
53#if( defined( GLSGEN_EXPORT_GLSCTLTEXTBOX ) || defined( GLSGEN_IMPORT_GLSCTLTEXTBOX ) || defined( GLSGEN_GLSCTLTEXTBOX_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
54 && defined( _MSC_VER )
55# if defined( GLSGEN_EXPORT_GLSCTLTEXTBOX ) || defined( GLSGEN_GLSCTLTEXTBOX_EXPORT_GENERATED )
56# define GLSGEN_GLSCTLTEXTBOX_EXPORT __declspec( dllexport )
58# define GLSGEN_GLSCTLTEXTBOX_EXPORT __declspec( dllimport )
61# define GLSGEN_GLSCTLTEXTBOX_EXPORT
71#ifndef GLS_CTL_FALLBACK_ENABLED
74# define CTL_BASE_CLASS GlsText
77# 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
108class GlsPangoWrapper;
111class GlsTextBoxFontRenderer;
115class GlsGloFileAttribute;
116class GlsStateManager;
117class GlsQuadListVCT_2D;
131 DISTI_DEPRECATED(
"This identifier is forbidden by the C++ standard. Use BaseClass instead." )
140 friend class GlsCTLTextBoxEditor;
142#ifndef GLS_CTL_FALLBACK_ENABLED
156 VERTICAL_ALIGNMENT_CENTER = ALIGN_CENTER,
157 VERTICAL_ALIGNMENT_TOP = ALIGN_TOP,
158 VERTICAL_ALIGNMENT_BOTTOM = ALIGN_BOTTOM
165 ELLIPSIZE_MODE_START,
166 ELLIPSIZE_MODE_MIDDLE,
181 TEXT_DIRECTION_AUTOMATIC,
182 TEXT_DIRECTION_AUTO_BY_LINE
185#ifndef GLS_CTL_FALLBACK_ENABLED
189 RESIZE_MODE_AUTO_WIDTH,
190 RESIZE_MODE_AUTO_HEIGHT
229#ifndef GLS_CTL_FALLBACK_ENABLED
384#ifndef GLS_CTL_FALLBACK_ENABLED
416#ifndef GLS_CTL_FALLBACK_ENABLED
441 void ApplyTextScale(
float textBoxWidth,
float textBoxHeight, PangoRect& verts );
449 void ClampToTextBoxSize(
float textBoxWidth,
float textBoxHeight, PangoRect& verts, PangoRect& texCoords );
459 static bool s_isAutomaticPixelAlignmentEnabled;
464# ifndef GLS_CTL_FALLBACK_ENABLED
477# ifndef GLS_CTL_FALLBACK_ENABLED
484 bool _geometryRefreshDraw;
502#ifndef GLS_CTL_FALLBACK_ENABLED
526#ifndef GLS_CTL_FALLBACK_ENABLED
537 if( str ==
"ALIGN_TOP" || str ==
"VERTICAL_ALIGNMENT_TOP" )
539 verticalAlignment = disti::GlsCTLTextBox::ALIGN_TOP;
541 else if( str ==
"ALIGN_CENTER" || str ==
"VERTICAL_ALIGNMENT_CENTER" )
543 verticalAlignment = disti::GlsCTLTextBox::ALIGN_CENTER;
545 else if( str ==
"ALIGN_BOTTOM" || str ==
"VERTICAL_ALIGNMENT_BOTTOM" )
547 verticalAlignment = disti::GlsCTLTextBox::ALIGN_BOTTOM;
558 switch( verticalAlignment )
560 case disti::GlsCTLTextBox::ALIGN_TOP:
561 outstr <<
"ALIGN_TOP";
563 case disti::GlsCTLTextBox::ALIGN_CENTER:
564 outstr <<
"ALIGN_CENTER";
566 case disti::GlsCTLTextBox::ALIGN_BOTTOM:
567 outstr <<
"ALIGN_BOTTOM";
583 if( str ==
"ELLIPSIZE_MODE_NONE" )
585 ellipsizeMode = disti::GlsCTLTextBox::ELLIPSIZE_MODE_NONE;
587 else if( str ==
"ELLIPSIZE_MODE_START" )
589 ellipsizeMode = disti::GlsCTLTextBox::ELLIPSIZE_MODE_START;
591 else if( str ==
"ELLIPSIZE_MODE_MIDDLE" )
593 ellipsizeMode = disti::GlsCTLTextBox::ELLIPSIZE_MODE_MIDDLE;
595 else if( str ==
"ELLIPSIZE_MODE_END" )
597 ellipsizeMode = disti::GlsCTLTextBox::ELLIPSIZE_MODE_END;
608 switch( ellipsizeMode )
610 case disti::GlsCTLTextBox::ELLIPSIZE_MODE_NONE:
611 outstr <<
"ELLIPSIZE_MODE_NONE";
613 case disti::GlsCTLTextBox::ELLIPSIZE_MODE_START:
614 outstr <<
"ELLIPSIZE_MODE_START";
616 case disti::GlsCTLTextBox::ELLIPSIZE_MODE_MIDDLE:
617 outstr <<
"ELLIPSIZE_MODE_MIDDLE";
619 case disti::GlsCTLTextBox::ELLIPSIZE_MODE_END:
620 outstr <<
"ELLIPSIZE_MODE_END";
635 if( str ==
"TEXT_DIRECTION_LTR" )
637 direction = disti::GlsCTLTextBox::TEXT_DIRECTION_LTR;
639 else if( str ==
"TEXT_DIRECTION_RTL" )
641 direction = disti::GlsCTLTextBox::TEXT_DIRECTION_RTL;
643 else if( str ==
"TEXT_DIRECTION_AUTOMATIC" )
645 direction = disti::GlsCTLTextBox::TEXT_DIRECTION_AUTOMATIC;
647 else if( str ==
"TEXT_DIRECTION_AUTO_BY_LINE" )
649 direction = disti::GlsCTLTextBox::TEXT_DIRECTION_AUTO_BY_LINE;
662 case disti::GlsCTLTextBox::TEXT_DIRECTION_LTR:
663 outstr <<
"TEXT_DIRECTION_LTR";
665 case disti::GlsCTLTextBox::TEXT_DIRECTION_RTL:
666 outstr <<
"TEXT_DIRECTION_RTL";
668 case disti::GlsCTLTextBox::TEXT_DIRECTION_AUTOMATIC:
669 outstr <<
"TEXT_DIRECTION_AUTOMATIC";
671 case disti::GlsCTLTextBox::TEXT_DIRECTION_AUTO_BY_LINE:
672 outstr <<
"TEXT_DIRECTION_AUTO_BY_LINE";
678#ifndef GLS_CTL_FALLBACK_ENABLED
688 if( str ==
"RESIZE_MODE_FIXED" )
690 resizeMode = disti::GlsCTLTextBox::RESIZE_MODE_FIXED;
692 else if( str ==
"RESIZE_MODE_AUTO_WIDTH" )
694 resizeMode = disti::GlsCTLTextBox::RESIZE_MODE_AUTO_WIDTH;
696 else if( str ==
"RESIZE_MODE_AUTO_HEIGHT" )
698 resizeMode = disti::GlsCTLTextBox::RESIZE_MODE_AUTO_HEIGHT;
711 case disti::GlsCTLTextBox::RESIZE_MODE_FIXED:
712 outstr <<
"RESIZE_MODE_FIXED";
714 case disti::GlsCTLTextBox::RESIZE_MODE_AUTO_WIDTH:
715 outstr <<
"RESIZE_MODE_AUTO_WIDTH";
717 case disti::GlsCTLTextBox::RESIZE_MODE_AUTO_HEIGHT:
718 outstr <<
"RESIZE_MODE_AUTO_HEIGHT";
Definition: dynamic_array.h:79
The Gls CTL (Complex Text Layout) Text Box.
Definition: gls_ctl_text_box.h:129
void CopyGeometry(DisplayObject *src) DISTI_METHOD_OVERRIDE
virtual void TextHorizontalScale(float value)
float _altHeight
Definition: gls_ctl_text_box.h:420
static const unsigned int INTERNAL_BORDER
Definition: gls_ctl_text_box.h:138
void CopyProperties(DisplayObject *src) DISTI_METHOD_OVERRIDE
virtual void VaString(const char *format,...)
float _resizeMaxWidth
Maximum resize width in logical units.
Definition: gls_ctl_text_box.h:466
void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
void GetCppInterfaceDescriptionFree(InterfaceListType *array) DISTI_METHOD_OVERRIDE
TextDirection_t
Definition: gls_ctl_text_box.h:178
VerticalAlignment_t
Definition: gls_ctl_text_box.h:144
virtual ResizeMode_t ResizeMode()
virtual unsigned int GetGlyphCount()
virtual void MaxWidth(float value)
float _textHorizontalScale
Definition: gls_ctl_text_box.h:423
virtual EllipsizeMode_t EllipsizeMode()
virtual void VerticalAlignment(VerticalAlignmentCTL_t verticalAlignment)
Definition: gls_ctl_text_box.h:263
virtual TextDirection_t TextDirection()
void SetVertices(unsigned int nPoints, Vertex *vertices) DISTI_METHOD_OVERRIDE
ResizeMode_t _resizeMode
Resize behavior for this object.
Definition: gls_ctl_text_box.h:465
float _textVerticalScale
Definition: gls_ctl_text_box.h:425
void Draw() DISTI_METHOD_OVERRIDE
void ApplyTextScale(float textBoxWidth, float textBoxHeight, PangoRect &verts)
bool RequiresFontFile() const DISTI_METHOD_OVERRIDE
Definition: gls_ctl_text_box.h:379
void ClampToTextBoxSize(float textBoxWidth, float textBoxHeight, PangoRect &verts, PangoRect &texCoords)
void PreDraw(const OpenGLMatrices ¤t, Culler &culler) DISTI_METHOD_OVERRIDE
virtual void ResizeMode(ResizeMode_t value)
virtual float MaxHeight()
GlsCTLTextBox(const GlsCTLTextBox &that, const bool generateNames)
virtual void TextVerticalScale(float value)
TextDirection_t _textDirection
Text direction behavior for this object.
Definition: gls_ctl_text_box.h:462
void ApplyVerticalAlignment(float textBoxHeight, PangoRect &verts)
virtual VerticalAlignment_t VerticalAlignment() const
virtual void MaxHeight(float value)
virtual float TextVerticalScale()
void Scale(float px, float py, float pz, Vertex *anchor, int handleBar) DISTI_METHOD_OVERRIDE
VerticalAlignmentCTL_t
Definition: gls_ctl_text_box.h:155
virtual GlyphMetrics GetGlyphMetrics(const unsigned int glyphIndex)
virtual void SetAltWidth(float width)
ScopedPtr< GlsPangoWrapper > _glsPangoWrapper
Definition: gls_ctl_text_box.h:428
virtual void RecalcVertices()
virtual void SetAltHeight(float height)
virtual float TextHorizontalScale()
virtual void SetVerticesToImageSize(const PangoRect &verts, bool keepWidth)
virtual unsigned int GetLineCount()
float _altWidth
Definition: gls_ctl_text_box.h:418
EllipsizeMode_t
Definition: gls_ctl_text_box.h:163
DisplayObject * CloneObject(bool generateNames=false) DISTI_METHOD_OVERRIDE
void AdjustImageVertsAndCoords(PangoRect &verts, PangoRect &texCoords)
virtual void TextDirection(const TextDirection_t textDirection)
ResizeMode_t
The resize behavior types.
Definition: gls_ctl_text_box.h:187
virtual void EllipsizeMode(const EllipsizeMode_t ellipsizeMode)
InterfaceListType * GetCppInterfaceDescription(InterfaceListType *addToThisList=NULL) DISTI_METHOD_OVERRIDE
float _resizeMaxHeight
Maximum resize height in logical units.
Definition: gls_ctl_text_box.h:467
virtual void SetLayoutAutoDir(bool autoDir)
Definition: gls_ctl_text_box.h:337
Definition: gls_glo_file.h:1241
float _cellWidth
Definition: gls_text.h:667
float _cellHeight
Definition: gls_text.h:664
virtual bool ControlCellSize() const
Definition: gls_text.h:342
Definition: gls_state_manager_interface.h:65
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:540
Macros and helper code to determine what subset of C++11/14/17 is available.
#define DISTI_SPECIAL_MEM_FUN_DELETE
Macro to wrap function deletion, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:245
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:487
#define DISTI_METHOD_OVERRIDE
Macro to wrap the override keyword, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:221
#define GLSGEN_GLSCTLTEXTBOX_EXPORT
Provides support for creating DLLs.
Definition: gls_ctl_text_box.h:61
#define CTL_BASE_CLASS
Base class to use for GlsCTLTextBox, used to support platforms that don't support CTL.
Definition: gls_ctl_text_box.h:74
The disti::GlsText class.
The disti::GlsTextBox class.
Definition: bmpimage.h:46
std::ostream & operator<<(std::ostream &outstr, const AttributeName &name)
std::istream & operator>>(std::istream &instr, GlsColor &color)
A smart pointer with unique ownership – poor man's std::unique_ptr.
Definition: gls_ctl_text_box.h:198
float minX
Minimum X in logical units.
Definition: gls_ctl_text_box.h:199
float maxX
Maximum X in logical units.
Definition: gls_ctl_text_box.h:201
float maxY
Maximum Y in logical units.
Definition: gls_ctl_text_box.h:202
float minY
Minimum Y in logical units.
Definition: gls_ctl_text_box.h:200
The DistiUnhideGlobalsDummyClass class.