41#ifndef INCLUDED_GLS_CTL_TEXT_BOX_H 
   42#define INCLUDED_GLS_CTL_TEXT_BOX_H 
   47#if defined( EMSCRIPTEN ) 
   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 
   76#    define CTL_BASE_CLASS GlsText 
   79#    define CTL_BASE_CLASS GlsTextBox 
   83#define LIB_BASE_NAME "gls_ctl_text_box" 
   89#    if !defined( NO_GLS_AUTOLIB ) && !defined( GLS_IMPORT_LIBRARY ) 
   91#            define PANGO_SUFFIX "_64" 
   93#            define PANGO_SUFFIX "" 
   95#        pragma message( "Will automatically link with libfontconfig" PANGO_SUFFIX "-1.0.lib" )
 
   96#        pragma message( "Will automatically link with libpango" PANGO_SUFFIX "-1.0.lib" )
 
   97#        pragma message( "Will automatically link with libpangoft2" PANGO_SUFFIX "-1.0.lib" )
 
   98#        pragma message( "Will automatically link with libgobject" PANGO_SUFFIX "-2.0.lib" )
 
   99#        pragma comment( lib, "libfontconfig" PANGO_SUFFIX "-1.0.lib" )
 
  100#        pragma comment( lib, "libpango" PANGO_SUFFIX "-1.0.lib" )
 
  101#        pragma comment( lib, "libpangoft2" PANGO_SUFFIX "-1.0.lib" )
 
  102#        pragma comment( lib, "libgobject" PANGO_SUFFIX "-2.0.lib" )
 
  109#ifndef GLS_CTL_FALLBACK_ENABLED 
  110class GlsPangoWrapper;
 
  113class GlsTextBoxFontRenderer;
 
  117class GlsGloFileAttribute;
 
  118class GlsStateManager;
 
  119class GlsQuadListVCT_2D;
 
  133    DISTI_DEPRECATED( 
"This identifier is forbidden by the C++ standard. Use BaseClass instead." )
 
  142    friend class GlsCTLTextBoxEditor;
 
  144#ifndef GLS_CTL_FALLBACK_ENABLED 
  158        VERTICAL_ALIGNMENT_CENTER = ALIGN_CENTER,
 
  159        VERTICAL_ALIGNMENT_TOP    = ALIGN_TOP,
 
  160        VERTICAL_ALIGNMENT_BOTTOM = ALIGN_BOTTOM
 
  167        ELLIPSIZE_MODE_START,
 
  168        ELLIPSIZE_MODE_MIDDLE,
 
  183        TEXT_DIRECTION_AUTOMATIC,
 
  184        TEXT_DIRECTION_AUTO_BY_LINE
 
  187#ifndef GLS_CTL_FALLBACK_ENABLED 
  191        RESIZE_MODE_AUTO_WIDTH,
 
  192        RESIZE_MODE_AUTO_HEIGHT
 
  231#ifndef GLS_CTL_FALLBACK_ENABLED 
  380#ifndef GLS_CTL_FALLBACK_ENABLED 
  412#ifndef GLS_CTL_FALLBACK_ENABLED 
  437    void ApplyTextScale( 
float textBoxWidth, 
float textBoxHeight, PangoRect& verts );
 
  445    void ClampToTextBoxSize( 
float textBoxWidth, 
float textBoxHeight, PangoRect& verts, PangoRect& texCoords );
 
  455    static bool s_isAutomaticPixelAlignmentEnabled;
 
  460#    ifndef GLS_CTL_FALLBACK_ENABLED 
  473#    ifndef GLS_CTL_FALLBACK_ENABLED 
  480    bool _geometryRefreshDraw;
 
  498#ifndef GLS_CTL_FALLBACK_ENABLED 
  522#ifndef GLS_CTL_FALLBACK_ENABLED 
  533    if( str == 
"ALIGN_TOP" || str == 
"VERTICAL_ALIGNMENT_TOP" )
 
  535        verticalAlignment = disti::GlsCTLTextBox::ALIGN_TOP;
 
  537    else if( str == 
"ALIGN_CENTER" || str == 
"VERTICAL_ALIGNMENT_CENTER" )
 
  539        verticalAlignment = disti::GlsCTLTextBox::ALIGN_CENTER;
 
  541    else if( str == 
"ALIGN_BOTTOM" || str == 
"VERTICAL_ALIGNMENT_BOTTOM" )
 
  543        verticalAlignment = disti::GlsCTLTextBox::ALIGN_BOTTOM;
 
  554    switch( verticalAlignment )
 
  556    case disti::GlsCTLTextBox::ALIGN_TOP:
 
  557        outstr << 
"ALIGN_TOP";
 
  559    case disti::GlsCTLTextBox::ALIGN_CENTER:
 
  560        outstr << 
"ALIGN_CENTER";
 
  562    case disti::GlsCTLTextBox::ALIGN_BOTTOM:
 
  563        outstr << 
"ALIGN_BOTTOM";
 
  579    if( str == 
"ELLIPSIZE_MODE_NONE" )
 
  581        ellipsizeMode = disti::GlsCTLTextBox::ELLIPSIZE_MODE_NONE;
 
  583    else if( str == 
"ELLIPSIZE_MODE_START" )
 
  585        ellipsizeMode = disti::GlsCTLTextBox::ELLIPSIZE_MODE_START;
 
  587    else if( str == 
"ELLIPSIZE_MODE_MIDDLE" )
 
  589        ellipsizeMode = disti::GlsCTLTextBox::ELLIPSIZE_MODE_MIDDLE;
 
  591    else if( str == 
"ELLIPSIZE_MODE_END" )
 
  593        ellipsizeMode = disti::GlsCTLTextBox::ELLIPSIZE_MODE_END;
 
  604    switch( ellipsizeMode )
 
  606    case disti::GlsCTLTextBox::ELLIPSIZE_MODE_NONE:
 
  607        outstr << 
"ELLIPSIZE_MODE_NONE";
 
  609    case disti::GlsCTLTextBox::ELLIPSIZE_MODE_START:
 
  610        outstr << 
"ELLIPSIZE_MODE_START";
 
  612    case disti::GlsCTLTextBox::ELLIPSIZE_MODE_MIDDLE:
 
  613        outstr << 
"ELLIPSIZE_MODE_MIDDLE";
 
  615    case disti::GlsCTLTextBox::ELLIPSIZE_MODE_END:
 
  616        outstr << 
"ELLIPSIZE_MODE_END";
 
  631    if( str == 
"TEXT_DIRECTION_LTR" )
 
  633        direction = disti::GlsCTLTextBox::TEXT_DIRECTION_LTR;
 
  635    else if( str == 
"TEXT_DIRECTION_RTL" )
 
  637        direction = disti::GlsCTLTextBox::TEXT_DIRECTION_RTL;
 
  639    else if( str == 
"TEXT_DIRECTION_AUTOMATIC" )
 
  641        direction = disti::GlsCTLTextBox::TEXT_DIRECTION_AUTOMATIC;
 
  643    else if( str == 
"TEXT_DIRECTION_AUTO_BY_LINE" )
 
  645        direction = disti::GlsCTLTextBox::TEXT_DIRECTION_AUTO_BY_LINE;
 
  658    case disti::GlsCTLTextBox::TEXT_DIRECTION_LTR:
 
  659        outstr << 
"TEXT_DIRECTION_LTR";
 
  661    case disti::GlsCTLTextBox::TEXT_DIRECTION_RTL:
 
  662        outstr << 
"TEXT_DIRECTION_RTL";
 
  664    case disti::GlsCTLTextBox::TEXT_DIRECTION_AUTOMATIC:
 
  665        outstr << 
"TEXT_DIRECTION_AUTOMATIC";
 
  667    case disti::GlsCTLTextBox::TEXT_DIRECTION_AUTO_BY_LINE:
 
  668        outstr << 
"TEXT_DIRECTION_AUTO_BY_LINE";
 
  674#ifndef GLS_CTL_FALLBACK_ENABLED 
  684    if( str == 
"RESIZE_MODE_FIXED" )
 
  686        resizeMode = disti::GlsCTLTextBox::RESIZE_MODE_FIXED;
 
  688    else if( str == 
"RESIZE_MODE_AUTO_WIDTH" )
 
  690        resizeMode = disti::GlsCTLTextBox::RESIZE_MODE_AUTO_WIDTH;
 
  692    else if( str == 
"RESIZE_MODE_AUTO_HEIGHT" )
 
  694        resizeMode = disti::GlsCTLTextBox::RESIZE_MODE_AUTO_HEIGHT;
 
  707    case disti::GlsCTLTextBox::RESIZE_MODE_FIXED:
 
  708        outstr << 
"RESIZE_MODE_FIXED";
 
  710    case disti::GlsCTLTextBox::RESIZE_MODE_AUTO_WIDTH:
 
  711        outstr << 
"RESIZE_MODE_AUTO_WIDTH";
 
  713    case disti::GlsCTLTextBox::RESIZE_MODE_AUTO_HEIGHT:
 
  714        outstr << 
"RESIZE_MODE_AUTO_HEIGHT";
 
Definition: dynamic_array.h:79
The Gls CTL (Complex Text Layout) Text Box.
Definition: gls_ctl_text_box.h:131
virtual InterfaceListType * GetCppInterfaceDescription(InterfaceListType *addToThisList=NULL) DISTI_METHOD_OVERRIDE
virtual void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
virtual void Draw() DISTI_METHOD_OVERRIDE
virtual void GetCppInterfaceDescriptionFree(InterfaceListType *array) DISTI_METHOD_OVERRIDE
virtual void TextHorizontalScale(float value)
float _altHeight
Definition: gls_ctl_text_box.h:416
static const unsigned int INTERNAL_BORDER
Definition: gls_ctl_text_box.h:140
virtual DisplayObject * CloneObject(bool generateNames=false) DISTI_METHOD_OVERRIDE
virtual VerticalAlignment_t VerticalAlignment()
virtual void VaString(const char *format,...)
float _resizeMaxWidth
Maximum resize width in logical units.
Definition: gls_ctl_text_box.h:462
TextDirection_t
Definition: gls_ctl_text_box.h:180
VerticalAlignment_t
Definition: gls_ctl_text_box.h:146
virtual ResizeMode_t ResizeMode()
virtual unsigned int GetGlyphCount()
virtual void PreDraw(const OpenGLMatrices ¤t, Culler &culler) DISTI_METHOD_OVERRIDE
virtual void MaxWidth(float value)
float _textHorizontalScale
Definition: gls_ctl_text_box.h:419
virtual EllipsizeMode_t EllipsizeMode()
virtual void VerticalAlignment(VerticalAlignmentCTL_t verticalAlignment)
Definition: gls_ctl_text_box.h:265
virtual TextDirection_t TextDirection()
ResizeMode_t _resizeMode
Resize behavior for this object.
Definition: gls_ctl_text_box.h:461
float _textVerticalScale
Definition: gls_ctl_text_box.h:421
virtual void CopyGeometry(DisplayObject *src) DISTI_METHOD_OVERRIDE
virtual void SetVertices(unsigned int nPoints, Vertex *vertices) DISTI_METHOD_OVERRIDE
void ApplyTextScale(float textBoxWidth, float textBoxHeight, PangoRect &verts)
bool RequiresFontFile() const DISTI_METHOD_OVERRIDE
Definition: gls_ctl_text_box.h:375
void ClampToTextBoxSize(float textBoxWidth, float textBoxHeight, PangoRect &verts, PangoRect &texCoords)
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:458
void ApplyVerticalAlignment(float textBoxHeight, PangoRect &verts)
virtual void MaxHeight(float value)
virtual float TextVerticalScale()
VerticalAlignmentCTL_t
Definition: gls_ctl_text_box.h:157
virtual void Scale(float px, float py, float pz, Vertex *anchor, int handleBar) DISTI_METHOD_OVERRIDE
virtual GlyphMetrics GetGlyphMetrics(const unsigned int glyphIndex)
virtual void SetAltWidth(float width)
virtual void CopyProperties(DisplayObject *src) DISTI_METHOD_OVERRIDE
ScopedPtr< GlsPangoWrapper > _glsPangoWrapper
Definition: gls_ctl_text_box.h:424
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:414
EllipsizeMode_t
Definition: gls_ctl_text_box.h:165
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:189
virtual void EllipsizeMode(const EllipsizeMode_t ellipsizeMode)
float _resizeMaxHeight
Maximum resize height in logical units.
Definition: gls_ctl_text_box.h:463
virtual void SetLayoutAutoDir(bool autoDir)
Definition: gls_ctl_text_box.h:333
Definition: gls_glo_file.h:1243
float _cellWidth
Definition: gls_text.h:669
float _cellHeight
Definition: gls_text.h:666
bool ControlCellSize() const
Definition: gls_text.h:344
Definition: gls_state_manager_interface.h:69
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:544
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:235
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:457
#define DISTI_METHOD_OVERRIDE
Macro to wrap the override keyword, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:214
#define GLSGEN_GLSCTLTEXTBOX_EXPORT
Provides support for creating DLLs.
Definition: gls_ctl_text_box.h:63
#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:76
The disti::GlsText class.
The disti::GlsTextBox class.
Force inclusion of the DirectShow library.
Definition: bmpimage.h:47
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:200
float minX
Minimum X in logical units.
Definition: gls_ctl_text_box.h:201
float maxX
Maximum X in logical units.
Definition: gls_ctl_text_box.h:203
float maxY
Maximum Y in logical units.
Definition: gls_ctl_text_box.h:204
float minY
Minimum Y in logical units.
Definition: gls_ctl_text_box.h:202
The DistiUnhideGlobalsDummyClass class.