123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- #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;
- __declspec( dllexport ) bool operator==( const TextStyle& rhs );
- };
- class TextStyleManager
- {
- protected:
- RCArray< TextRenderer > *renderer;
- Array< TextStyle > textStyle;
- int index;
- int styleIndex;
- TextStyle current;
- Text *text;
- int ref;
- public:
- __declspec( dllexport ) TextStyleManager();
- __declspec( dllexport ) virtual ~TextStyleManager();
-
-
-
- __declspec( dllexport ) void setTextStyle( int begin, int end, TextStyle style );
-
-
-
- __declspec( dllexport ) void removeText( int begin, int end );
-
-
-
- __declspec( dllexport ) void insertText( int pos, const char *text );
-
- __declspec( dllexport ) void cleanupStyles();
-
- __declspec( dllexport ) TextStyle ¤tStyle();
-
- __declspec( dllexport ) TextRenderer *zCurrentRenderer();
-
-
- __declspec( dllexport ) bool nextStyle();
-
-
-
- __declspec( dllexport ) bool stepTo( int index );
-
- __declspec( dllexport ) void resetIteration();
-
-
- __declspec( dllexport ) TextStyle getTextStyle( int index ) const;
-
-
- __declspec( dllexport ) TextStyleManager *getThis();
-
-
- __declspec( dllexport ) virtual TextStyleManager *release();
- 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;
-
-
- __declspec( dllexport ) virtual void doMausEreignis( MausEreignis &me, bool userRet ) override;
- public:
-
- __declspec( dllexport ) TextFeld();
-
- __declspec( dllexport ) virtual ~TextFeld();
-
-
- __declspec( dllexport ) void setCharEvent( std::function< void( int, int, MausEreignis me ) > charEvent );
-
-
- __declspec( dllexport ) void setTextZ( Text *txt );
-
-
- __declspec( dllexport ) void setText( Text *txt );
-
-
- __declspec( dllexport ) void setText( const char *txt );
-
-
-
-
-
-
-
-
-
-
- __declspec( dllexport ) void setFormattedText( const char *txt );
-
- __declspec( dllexport ) void addLineBreaks();
-
-
-
- __declspec( dllexport ) void setTextStyle( int begin, int end, TextStyle style );
-
-
- __declspec( dllexport ) void addZeile( const char *zeile );
-
-
-
- __declspec( dllexport ) void addZeile( const char *zeile, int color );
-
- __declspec( dllexport ) void deselectAuswahl();
-
-
-
- __declspec( dllexport ) void setAuswahl( int pos1, int pos2 );
-
-
- __declspec( dllexport ) void setAuswahl( Punkt &auswahl );
-
-
-
- __declspec( dllexport ) void addAuswahl( int pos1, int pos2 );
-
-
- __declspec( dllexport ) void addAuswahl( Punkt &auswahl );
-
-
-
- __declspec( dllexport ) void invertAuswahl( int begin, int end );
-
-
- __declspec( dllexport ) void replaceAuswahl( const char *text );
-
-
- __declspec( dllexport ) void setTextRendererZ( TextRenderer *textRd );
-
-
- __declspec( dllexport ) void addTextRendererZ( TextRenderer *textRd );
-
-
- __declspec( dllexport ) void setTextRendererZ( RCArray< TextRenderer > *textRd );
-
-
- __declspec( dllexport ) void setSchriftZ( Schrift *schrift );
-
-
-
- __declspec( dllexport ) void setSchriftZ( int rendererIndex, Schrift *schrift );
-
-
- __declspec( dllexport ) void setSchriftSize( unsigned char gr );
-
-
-
-
- __declspec( dllexport ) void setSchriftSize( int begin, int end, unsigned char gr );
-
-
- __declspec( dllexport ) void setSchriftFarbe( int fc );
-
-
-
-
- __declspec( dllexport ) void setSchriftFarbe( int begin, int end, int fc );
-
-
-
- __declspec( dllexport ) void setSchowChar( unsigned char c );
-
-
- __declspec( dllexport ) void setVScrollZuZeile( int zeile );
-
-
- __declspec( dllexport ) void updateVScroll( int pos = -1 );
-
-
- __declspec( dllexport ) void updateHScroll( int pos = -1 );
-
- __declspec( dllexport ) int getNeededWidth();
-
- __declspec( dllexport ) int getNeededHeight();
-
-
-
- __declspec( dllexport ) virtual bool tick( double tickval ) override;
-
-
- __declspec( dllexport ) void doTastaturEreignis( TastaturEreignis &te ) override;
-
-
- __declspec( dllexport ) virtual void render( Bild &zRObj ) override;
-
- __declspec( dllexport ) Text *getText() const;
-
- __declspec( dllexport ) Text *zText() const;
-
-
- __declspec( dllexport ) Schrift *getSchrift() const;
-
-
- __declspec( dllexport ) Schrift *zSchrift() const;
-
-
-
- __declspec( dllexport ) Schrift *getSchrift( int rendererIndex ) const;
-
-
-
- __declspec( dllexport ) Schrift *zSchrift( int rendererIndex ) const;
-
-
- __declspec( dllexport ) TextRenderer *getTextRenderer() const;
-
-
- __declspec( dllexport ) TextRenderer *zTextRenderer() const;
-
-
-
- __declspec( dllexport ) TextRenderer *getTextRenderer( int index ) const;
-
-
-
- __declspec( dllexport ) TextRenderer *zTextRenderer( int index ) const;
-
- __declspec( dllexport ) unsigned char getSchriftSize() const;
-
-
- __declspec( dllexport ) unsigned char getSchriftSize( int index ) const;
-
- __declspec( dllexport ) int getSchriftFarbe() const;
-
-
- __declspec( dllexport ) int getSchriftFarbe( int index ) const;
-
- __declspec( dllexport ) unsigned char getShowChar() const;
-
- __declspec( dllexport ) int getCursorPos() const;
-
-
- __declspec( dllexport ) bool isCharSelected( int index ) const;
-
-
-
-
- __declspec( dllexport ) int getTextIndexAt( int mx, int my ) const;
-
-
-
- __declspec( dllexport ) int getCurserPosAt( int mx, int my ) const;
-
-
- __declspec( dllexport ) TextStyle getTextStyle( int index ) const;
-
- __declspec( dllexport ) Zeichnung *dublizieren() const override;
- };
- }
- #endif
|