#ifndef Liste_H #define Liste_H #include "Array.h" #include "Drawing.h" namespace Framework { class Rahmen; //! Border.h class AlphaFeld; //! AlphaField.h class Bild; //! Image.h class Text; //! Text.h class TextFeld; //! TextField.h class VScrollBar; //! Scroll.h struct TastaturEreignis; //! KeyboardEvent.h struct MausEreignis; //! MouseEvent.h class Schrift; //! Font.h class AuswahlListe; //! from this file //! A drawing of the 2D GUI Framework that displays a list from which //! the user can select and deselect elements class AuswahlListe : public ZeichnungHintergrund { public: class Style : public ZeichnungHintergrund::Style { public: //! Specifies whether the list entries have a border static const __int64 FeldRahmen = 0x0001000; //! Specifies whether the entries have a background static const __int64 FeldHintergrund = 0x0002000; //! Specifies whether the entries have a background image static const __int64 FeldHBild = 0x0004000; //! Specifies whether alpha blending is used when drawing //! entry backgrounds static const __int64 FeldHAlpha = 0x0008000; //! Specifies whether the entries have a color gradient static const __int64 FeldBuffer = 0x0010000; //! Specifies whether selected entries have a background static const __int64 AuswahlHintergrund = 0x0020000; //! Specifies whether selected entries have a background image static const __int64 AuswahlHBild = 0x0040000; //! Specifies whether alpha blending is used for drawing //! backgrounds of selected entries static const __int64 AuswahlHAlpha = 0x0080000; //! Specifies whether selected entries have a color gradient static const __int64 AuswahlBuffer = 0x0100000; //! Specifies whether selected entries have a border static const __int64 AuswahlRahmen = 0x0200000; //! Specifies whether each entry has its own background, //! color gradient, and border when selected static const __int64 MultiStyled = 0x0400000; //! Specifies that multiple entries can be selected simultaneously static const __int64 MultiSelect = 0x0800000; //! Specifies whether a specific entry is selected, if //! MultiSelect was set. static const __int64 Selected = 0x1000000; //! Combines the flags Sichtbar, Erlaubt, Rahmen, FeldHAlpha, //! FeldHintergrund, FeldRahmen, AuswahlBuffer, AuswahlRahmen static const __int64 Normal = Sichtbar | Erlaubt | Rahmen | FeldHAlpha | FeldHintergrund | FeldRahmen | AuswahlBuffer | AuswahlRahmen; }; private: RCArray* tfListe; int auswahl; int ahFarbe; Bild* ahBild; AlphaFeld* aBuffer; Rahmen* aRahmen; Array<__int64>* styles; Array* ahFarbeListe; RCArray* ahBildListe; RCArray* aBufferListe; RCArray* aRahmenListe; Schrift* schrift; //! Processes mouse messages //! \param me The event triggered by the mouse input DLLEXPORT void doMausEreignis(MausEreignis& me, bool userRet) override; DLLEXPORT bool hatStyle(int styleSet, int styleCheck) const; public: //! Constructor DLLEXPORT AuswahlListe(); //! Destructor DLLEXPORT virtual ~AuswahlListe(); //! Updates the styles, size and position of the entries DLLEXPORT void update(); //! Adds an entry //! \param txt The text of the entry DLLEXPORT void addEintrag(Text* txt); //! Adds an entry //! \param txt The text of the entry DLLEXPORT void addEintrag(const char* txt); //! Adds a pointer to an entry //! \param tf The TextFeld used to draw the entry DLLEXPORT void addEintragZ(TextFeld* tf); //! Adds an entry at a specific position //! \param pos The index of the new entry //! \param txt The text of the entry DLLEXPORT void addEintrag(int pos, Text* txt); //! Adds an entry at a specific position //! \param pos The index of the new entry //! \param txt The text of the entry DLLEXPORT void addEintrag(int pos, const char* txt); //! Adds a pointer to an entry at a specific position //! \param pos The index of the new entry \param tf The TextFeld //! used to draw the entry DLLEXPORT void addEintragZ(int pos, TextFeld* tf); //! Changes an entry //! \param pos The index of the entry //! \param txt The new text of the entry DLLEXPORT void setEintrag(int pos, Text* txt); //! Changes an entry //! \param pos The index of the entry //! \param txt The new text of the entry DLLEXPORT void setEintrag(int pos, const char* txt); //! Changes the pointer of an entry //! \param pos The index of the entry //! \param tf The new entry DLLEXPORT void setEintragZ(int pos, TextFeld* tf); //! Swaps the positions of two entries //! \param vpos The index of the first entry //! \param npos The index of the second entry DLLEXPORT void tauschEintragPos(int vpos, int npos); //! Sets the position of an entry //! \param vpos The index of the entry //! \param npos The index the entry should have DLLEXPORT void setEintragPos(int vpos, int npos); //! Deletes an entry //! pos: The index of the entry DLLEXPORT void removeEintrag(int pos); //! Sets the font to use //! \param schrift The font DLLEXPORT void setSchriftZ(Schrift* schrift); //! Scrolls to a specific entry //! \param eintrag The index of the entry DLLEXPORT void setVScrollZuEintrag(int eintrag); //! Updates the maximum scroll height by adding the heights of all entries DLLEXPORT void updateVScroll(); //! Sets a pointer to the border used for selected entries //! if MultiStyled is not set \param rahmen The border DLLEXPORT void setALRZ(Rahmen* rahmen); //! Sets the width of the border used for selected entries //! if MultiStyled is not set \param br The width in pixels DLLEXPORT void setALRBreite(int br); //! Sets the color of the border used for selected entries //! if MultiStyled is not set \param fc The color in A8R8G8B8 format DLLEXPORT void setALRFarbe(int fc); //! Sets a pointer to the color gradient used for selected entries //! if MultiStyled is not set \param buffer The color gradient DLLEXPORT void setAAFZ(AlphaFeld* buffer); //! Sets the strength of the color gradient used for selected entries //! if MultiStyled is not set \param st The strength DLLEXPORT void setAAFStrength(int st); //! Sets the color of the color gradient used for selected entries //! if MultiStyled is not set \param fc The color in A8R8G8B8 format DLLEXPORT void setAAFFarbe(int fc); //! Sets the background image by copying, used for selected entries //! if MultiStyled is not set \param bild The image to copy DLLEXPORT void setAHBild(Bild* bild); //! Sets a pointer to the background image used for selected entries //! if MultiStyled is not set \param bild The image DLLEXPORT void setAHBildZ(Bild* bild); //! Sets the background color used for selected entries //! if MultiStyled is not set \param fc The color in A8R8G8B8 format DLLEXPORT void setAHFarbe(int fc); //! Sets a pointer to the border used for a selected entry //! if MultiStyled is set \param pos The index of the entry //! \param rahmen The border DLLEXPORT void setALRZ(int pos, Rahmen* rahmen); //! Sets the width of the border used for a selected entry //! if MultiStyled is set \param pos The index of the entry //! \param br The width in pixels DLLEXPORT void setALRBreite(int pos, int br); //! Sets the color of the border used for a selected entry //! if MultiStyled is set \param pos The index of the entry //! \param fc The color in A8R8G8B8 format DLLEXPORT void setALRFarbe(int pos, int fc); //! Sets a pointer to the color gradient used for a selected entry //! if MultiStyled is set \param pos The index of the entry //! \param buffer The color gradient DLLEXPORT void setAAFZ(int pos, AlphaFeld* buffer); //! Sets the strength of the color gradient used for a selected entry //! if MultiStyled is set \param pos The index of the entry //! \param st The strength DLLEXPORT void setAAFStrength(int pos, int st); //! Sets the color of the color gradient used for a selected entry //! if MultiStyled is set \param pos The index of the entry //! \param fc The color in A8R8G8B8 format DLLEXPORT void setAAFFarbe(int pos, int fc); //! Sets the background image by copying, used for a selected entry //! if MultiStyled is set //! \param pos The index of the entry //! \param bild The image to copy DLLEXPORT void setAHBild(int pos, Bild* bild); //! Sets a pointer to the background image used for a selected entry //! if MultiStyled is set //! \param pos The index of the entry //! \param bild The image DLLEXPORT void setAHBildZ(int pos, Bild* bild); //! Sets the background color used for a selected entry //! if MultiStyled is set \param pos The index of the entry //! \param fc The color in A8R8G8B8 format DLLEXPORT void setAHFarbe(int pos, int fc); //! Sets the style of an entry if MultiStyled is set, and specifies //! whether an entry is selected if MultiSelect is set //! \param pos The index of the entry \param style The new style DLLEXPORT void setMsStyle(int pos, __int64 style); //! Changes the style of an entry if MultiStyled is set, and specifies //! whether an entry is selected if MultiSelect is set //! \param pos The index of the entry \param style The style //! add_remove: 1 if the style should be added. 0 if the style //! should be removed DLLEXPORT void setMsStyle(int pos, __int64 style, bool add_remove); //! Adds styles to an entry if MultiStyled is set, and specifies //! whether an entry is selected if MultiSelect is set //! \param pos The index of the entry \param style The style to add DLLEXPORT void addMsStyle(int pos, __int64 style); //! Removes styles from an entry if MultiStyled is set, and specifies //! whether an entry is selected if MultiSelect is set //! \param pos The index of the entry \param style The style to remove DLLEXPORT void removeMsStyle(int pos, __int64 style); //! Processes a keyboard event. Called automatically by the framework //! \param te The event DLLEXPORT void doTastaturEreignis(TastaturEreignis& te) override; //! Draws the object to zRObj if it is visible //! \param zRObj The image to draw into DLLEXPORT void render(Bild& zRObj) override; //! Returns the index of an entry the mouse points to //! \param my The position of the mouse on the Y axis relative to //! the top edge of the list DLLEXPORT int getKlickEintrag(int my); //! Selects an entry //! \param ausw The index of the entry DLLEXPORT void setAuswahl(int ausw); //! Deselects all selected entries DLLEXPORT void deSelect(); //! Returns the number of entries DLLEXPORT int getEintragAnzahl() const; //! Returns the index of the selected entry if MultiSelect is not //! set. If MultiSelect is set, the selection of an entry can be //! checked with hatMsStyle( entry index, //! AuswahlListe::Style::Ausgewaehlt ) DLLEXPORT int getAuswahl() const; //! Returns the index of an entry //! \param eintragText The text of the entry DLLEXPORT int getEintragPos(Text* eintragText); //! Returns an entry //! \param pos The index of the entry DLLEXPORT TextFeld* getEintrag(int pos) const; //! Returns an entry without increased reference counter //! \param pos The index of the entry DLLEXPORT TextFeld* zEintrag(int pos) const; //! Returns the border used for selected entries //! if MultiStyled is not set DLLEXPORT Rahmen* getARahmen() const; //! Returns the border without increased reference counter used for //! selected entries if MultiStyled is not set DLLEXPORT Rahmen* zARahmen() const; //! Returns the background color in A8R8G8B8 format used for //! selected entries if MultiStyled is not set DLLEXPORT int getAHFarbe() const; //! Returns the background image used for selected entries //! if MultiStyled is not set DLLEXPORT Bild* getAHBild() const; //! Returns the background image without increased reference counter //! used for selected entries if MultiStyled is not set DLLEXPORT Bild* zAHBild() const; //! Returns the color gradient used for selected entries //! if MultiStyled is not set DLLEXPORT AlphaFeld* getABuffer() const; //! Returns the color gradient without increased reference counter //! used for selected entries if MultiStyled is not set DLLEXPORT AlphaFeld* zABuffer() const; //! Returns the border used for a selected entry //! if MultiStyled is set DLLEXPORT Rahmen* getARahmen(int pos) const; //! Returns the border without increased reference counter used for //! a selected entry if MultiStyled is set DLLEXPORT Rahmen* zARahmen(int pos) const; //! Returns the background color in A8R8G8B8 format used for a //! selected entry if MultiStyled is set DLLEXPORT int getAHFarbe(int pos) const; //! Returns the background image used for a selected entry //! if MultiStyled is set DLLEXPORT Bild* getAHBild(int pos) const; //! Returns the background image without increased reference counter //! used for a selected entry if MultiStyled is set DLLEXPORT Bild* zAHBild(int pos) const; //! Returns the color gradient used for a selected entry //! if MultiStyled is set DLLEXPORT AlphaFeld* getABuffer(int pos) const; //! Returns the color gradient without increased reference counter //! used for a selected entry if MultiStyled is set DLLEXPORT AlphaFeld* zABuffer(int pos) const; //! Checks whether specific styles are set for a specific entry //! if MultiStyled is set. Also checks whether an entry is selected //! if MultiSelect is set \param pos The index of the entry //! \param style The styles to check DLLEXPORT inline bool hatMsStyle(int pos, __int64 style) const; //! Checks whether specific styles are not set for a specific entry //! if MultiStyled is set. Also checks whether an entry is not selected //! if MultiSelect is set //! \param pos The index of the entry //! \param style The styles to check DLLEXPORT inline bool hatMsStyleNicht(int pos, __int64 style) const; }; class ZListe : public ZeichnungHintergrund { public: class Style : public ZeichnungHintergrund::Style { public: //! draws a seperation line between the entries static const __int64 EntrySeperator = 0x0001000; //! Combines the flags Sichtbar, Erlaubt, //! Rahmen, Hintergrund static const __int64 Normal = Sichtbar | Erlaubt | Rahmen | Hintergrund | EntrySeperator; }; private: int entrySeperatorSize; int entrySeperatorColor; RCArray list; protected: //! Processes mouse messages //! \param me The event triggered by the mouse input DLLEXPORT void doMausEreignis(MausEreignis& me, bool userRet) override; public: //! Constructor DLLEXPORT ZListe(); //! Destructor DLLEXPORT virtual ~ZListe(); //! Adds an entry //! \param entry The drawing to add DLLEXPORT void addEintrag(Zeichnung* entry); //! Changes an entry //! \param pos The index of the entry //! \param entry The new drawing DLLEXPORT void setEintrag(int pos, Zeichnung* entry); //! Swaps the positions of two entries //! \param vpos The index of the first entry //! \param npos The index of the second entry DLLEXPORT void tauschEintragPos(int vpos, int npos); //! Sets the position of an entry //! \param vpos The index of the entry //! \param npos The index the entry should have DLLEXPORT void setEintragPos(int vpos, int npos); //! Deletes an entry //! pos: The index of the entry DLLEXPORT void removeEintrag(int pos); //! Scrolls to a specific entry //! \param eintrag The index of the entry DLLEXPORT void setVScrollZuEintrag(int eintrag); //! Updates the maximum scroll height by adding the heights of all entries DLLEXPORT void updateVScroll(); //! sets the size of the entry seperator DLLEXPORT void setEntrySeperatorSize(int size); //! sets the color of the entry seperator DLLEXPORT void setEntrySeperatorColor(int color); //! Processes a keyboard event. Called automatically by the framework //! \param te The event DLLEXPORT void doTastaturEreignis(TastaturEreignis& te) override; //! Updates the drawing //! \param tickVal The elapsed time in seconds since the last //! call of this function \return 1 if the drawing has changed //! since the last call DLLEXPORT bool tick(double tickVal) override; //! Draws the object to zRObj if it is visible //! \param zRObj The image to draw into DLLEXPORT void render(Bild& rObj) override; //! Returns the index of an entry the mouse points to //! \param my The position of the mouse on the Y axis relative to //! the top edge of the list DLLEXPORT int getKlickEintrag(int my); //! Returns the number of entries DLLEXPORT int getEintragAnzahl() const; //! Returns the index of an entry //! \param zEntry The drawing DLLEXPORT int getEintragPos(Zeichnung* zEntry); //! Returns an entry //! \param pos The index of the entry DLLEXPORT Zeichnung* getEintrag(int pos) const; //! Returns an entry without increased reference counter //! \param pos The index of the entry DLLEXPORT Zeichnung* zEintrag(int pos) const; //! Returns the needed height DLLEXPORT int getNeededHeight() const; //! returns the size of the entry seperator DLLEXPORT int getEntrySeperatorSize() const; //! returns the color of the entry seperator DLLEXPORT int getEntrySeperatorColor() const; }; } // namespace Framework #endif