| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403 |
- #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 DrawableBackground
- {
- public:
- class Style : public DrawableBackground::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<TextFeld>* tfListe;
- int auswahl;
- int ahFarbe;
- Bild* ahBild;
- AlphaFeld* aBuffer;
- Rahmen* aRahmen;
- Array<__int64>* styles;
- Array<int>* ahFarbeListe;
- RCArray<Bild>* ahBildListe;
- RCArray<AlphaFeld>* aBufferListe;
- RCArray<Rahmen>* 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 DrawableBackground
- {
- public:
- class Style : public DrawableBackground::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<Drawable> 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(Drawable* entry);
- //! Changes an entry
- //! \param pos The index of the entry
- //! \param entry The new drawing
- DLLEXPORT void setEintrag(int pos, Drawable* 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(Drawable* zEntry);
- //! Returns an entry
- //! \param pos The index of the entry
- DLLEXPORT Drawable* getEintrag(int pos) const;
- //! Returns an entry without increased reference counter
- //! \param pos The index of the entry
- DLLEXPORT Drawable* 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
|