123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 |
- #ifndef TextFeld_H
- #define TextFeld_H
- #include "Zeichnung.h"
- #include "Array.h"
- namespace Framework
- {
- class Schrift;
- class Text;
- class AlphaFeld;
- class Rahmen;
- class TextFeld;
- class VScrollBar;
- class HScrollBar;
- class TextRenderer;
-
- class TextFeld : public ZeichnungHintergrund
- {
- public:
- struct TextStyle
- {
- int beginIndex;
- unsigned char fontSize;
- int fontColor;
- int selectedColor;
- int selectedBackcroundColor;
- bool underlined;
- bool selected;
- int interactParam;
- unsigned char rendererIndex;
- DLLEXPORT bool operator==( const TextStyle& rhs );
- };
- class TextStyleManager : public virtual ReferenceCounter
- {
- protected:
- RCArray< TextRenderer > *renderer;
- Array< TextStyle > textStyle;
- int index;
- int styleIndex;
- TextStyle current;
- Text *text;
- public:
- DLLEXPORT TextStyleManager();
- DLLEXPORT virtual ~TextStyleManager();
-
-
-
- DLLEXPORT void setTextStyle( int begin, int end, TextStyle style );
-
-
-
- DLLEXPORT void removeText( int begin, int end );
-
-
-
- DLLEXPORT void insertText( int pos, const char *text );
-
- DLLEXPORT void cleanupStyles();
-
- DLLEXPORT TextStyle ¤tStyle();
-
- DLLEXPORT TextRenderer *zCurrentRenderer();
-
-
- DLLEXPORT bool nextStyle();
-
-
-
- DLLEXPORT bool stepTo( int index );
-
- DLLEXPORT void resetIteration();
-
-
- DLLEXPORT TextStyle getTextStyle( int index ) const;
- friend TextFeld;
- };
- class Style : public ZeichnungHintergrund::Style
- {
- public:
- const static __int64 Mehrzeilig = 0x001000;
- const static __int64 HCenter = 0x002000;
- const static __int64 VCenter = 0x004000;
- const static __int64 Editierbar = 0x2000000;
-
- const static __int64 Center = HCenter | VCenter;
- const static __int64 TextFeld = Sichtbar | Erlaubt | Rahmen | Buffered | VCenter | Editierbar;
- const static __int64 Text = Sichtbar | Mehrzeilig | Erlaubt;
- const static __int64 TextGebiet = Sichtbar | Erlaubt | Rahmen | Hintergrund | Editierbar | Mehrzeilig | VScroll;
- const static __int64 Scroll = VScroll | HScroll;
- };
- private:
- TextStyleManager *tm;
- unsigned char showChar;
- int cpos;
- double tickVal;
- bool mausKlick;
- std::function< void( int, int, MausEreignis me ) > charEvent;
- int getTextHeight() const;
- int getTextWidth() const;
-
-
- DLLEXPORT virtual void doMausEreignis( MausEreignis &me, bool userRet ) override;
- public:
-
- DLLEXPORT TextFeld();
-
- DLLEXPORT virtual ~TextFeld();
-
-
- DLLEXPORT void setCharEvent( std::function< void( int, int, MausEreignis me ) > charEvent );
-
-
- DLLEXPORT void setTextZ( Text *txt );
-
-
- DLLEXPORT void setText( Text *txt );
-
-
- DLLEXPORT void setText( const char *txt );
-
-
-
-
-
-
-
-
-
-
-
- DLLEXPORT void setFormattedText( const char *txt );
-
-
- DLLEXPORT void addLineBreaks( const char *spacing = "" );
-
-
-
- DLLEXPORT void setTextStyle( int begin, int end, TextStyle style );
-
-
- DLLEXPORT void addZeile( const char *zeile );
-
-
-
- DLLEXPORT void addZeile( const char *zeile, int color );
-
- DLLEXPORT void deselectAuswahl();
-
-
-
- DLLEXPORT void setAuswahl( int pos1, int pos2 );
-
-
- DLLEXPORT void setAuswahl( Punkt &auswahl );
-
-
-
- DLLEXPORT void addAuswahl( int pos1, int pos2 );
-
-
- DLLEXPORT void addAuswahl( Punkt &auswahl );
-
-
-
- DLLEXPORT void invertAuswahl( int begin, int end );
-
-
- DLLEXPORT void replaceAuswahl( const char *text );
-
-
- DLLEXPORT void setTextRendererZ( TextRenderer *textRd );
-
-
- DLLEXPORT void addTextRendererZ( TextRenderer *textRd );
-
-
- DLLEXPORT void setTextRendererZ( RCArray< TextRenderer > *textRd );
-
-
- DLLEXPORT void setSchriftZ( Schrift *schrift );
-
-
-
- DLLEXPORT void setSchriftZ( int rendererIndex, Schrift *schrift );
-
-
- DLLEXPORT void setSchriftSize( unsigned char gr );
-
-
-
-
- DLLEXPORT void setSchriftSize( int begin, int end, unsigned char gr );
-
-
- DLLEXPORT void setSchriftFarbe( int fc );
-
-
-
-
- DLLEXPORT void setSchriftFarbe( int begin, int end, int fc );
-
-
-
- DLLEXPORT void setSchowChar( unsigned char c );
-
-
- DLLEXPORT void setVScrollZuZeile( int zeile );
-
-
- DLLEXPORT void updateVScroll( int pos = -1 );
-
-
- DLLEXPORT void updateHScroll( int pos = -1 );
-
- DLLEXPORT int getNeededWidth();
-
- DLLEXPORT int getNeededHeight();
-
-
-
- DLLEXPORT virtual bool tick( double tickval ) override;
-
-
- DLLEXPORT void doTastaturEreignis( TastaturEreignis &te ) override;
-
-
- DLLEXPORT virtual void render( Bild &zRObj ) override;
-
- DLLEXPORT Text *getText() const;
-
- DLLEXPORT Text *zText() const;
-
-
- DLLEXPORT Schrift *getSchrift() const;
-
-
- DLLEXPORT Schrift *zSchrift() const;
-
-
-
- DLLEXPORT Schrift *getSchrift( int rendererIndex ) const;
-
-
-
- DLLEXPORT Schrift *zSchrift( int rendererIndex ) const;
-
-
- DLLEXPORT TextRenderer *getTextRenderer() const;
-
-
- DLLEXPORT TextRenderer *zTextRenderer() const;
-
-
-
- DLLEXPORT TextRenderer *getTextRenderer( int index ) const;
-
-
-
- DLLEXPORT TextRenderer *zTextRenderer( int index ) const;
-
- DLLEXPORT unsigned char getSchriftSize() const;
-
-
- DLLEXPORT unsigned char getSchriftSize( int index ) const;
-
- DLLEXPORT int getSchriftFarbe() const;
-
-
- DLLEXPORT int getSchriftFarbe( int index ) const;
-
- DLLEXPORT unsigned char getShowChar() const;
-
- DLLEXPORT int getCursorPos() const;
-
-
- DLLEXPORT bool isCharSelected( int index ) const;
-
-
-
-
- DLLEXPORT int getTextIndexAt( int mx, int my ) const;
-
-
-
- DLLEXPORT int getCurserPosAt( int mx, int my ) const;
-
-
- DLLEXPORT TextStyle getTextStyle( int index ) const;
-
- DLLEXPORT Zeichnung *dublizieren() const override;
- };
- }
- #endif
|