| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- #ifndef Knopf_H
- #define Knopf_H
- #include "TextFeld.h"
- namespace Framework
- {
- class TextFeld; //! TextFeld.h
- class AlphaFeld; //! AlphaFeld.h
- class Text; //! Text.h
- class Schrift; //! Schrift.h
- class Rahmen; //! Rahmen.h
- class LTDBDatei; //! Dateisystem.h
- class Knopf; //! from this file
- class KontrollKnopf; //! from this file
- class TextRenderer;
- //! A 2D GUI Framework drawing that renders a button that the user can press
- class Knopf : public TextFeld
- {
- public:
- class Style : public ZeichnungHintergrund::Style
- {
- public:
- //! Specifies whether the button text may have multiple colors
- static const __int64 MehrfarbigText = 0x0010000;
- //! Specifies whether the button has a background color
- //! while being pressed
- static const __int64 KlickFarbe = 0x0020000;
- //! Specifies whether the button has a background image
- //! while being pressed
- static const __int64 KlickBild = 0x0040000;
- //! Specifies whether the button uses alpha blending
- //! for the background while being pressed
- static const __int64 KlickAlpha = 0x0080000;
- //! Specifies whether the button has a color gradient
- //! while being pressed
- static const __int64 KlickBuffer = 0x0100000;
- //! Combines flags Sichtbar, Erlaubt, Rahmen,
- //! Buffered, MehrfarbigText, KlickBuffer
- static const __int64 Normal = Sichtbar | Erlaubt | Rahmen | Buffered
- | MehrfarbigText | KlickBuffer;
- };
- private:
- int klickFarbe;
- Bild* klickBild;
- AlphaFeld* klickBuffer;
- int klickIndex;
- //! Processes mouse messages
- //! \param me The event triggered by the mouse input
- DLLEXPORT void doMausEreignis(MausEreignis& me, bool userRet) override;
- public:
- //! Constructor
- DLLEXPORT Knopf();
- //! Destructor
- DLLEXPORT virtual ~Knopf();
- //! Sets the color used as background when the button is pressed
- //! \param fc The color in A8R8G8B8 format
- DLLEXPORT void setKlickFarbe(int fc);
- //! Sets the background image by copying, used when the button is
- //! pressed
- //! \param bild The image to copy
- DLLEXPORT void setKlickBild(Bild* bild);
- //! Sets a pointer to the background image used when the button is
- //! pressed
- //! \param bild The new image
- DLLEXPORT void setKlickBildZ(Bild* bild);
- //! Sets a pointer to the color gradient used when the button is pressed
- //! \param af The new color gradient
- DLLEXPORT void setKBZ(AlphaFeld* af);
- //! Sets the strength of the color gradient used when the button is
- //! pressed
- //! \param st The strength
- DLLEXPORT void setKBStrength(int st);
- //! Sets the color of the color gradient used when the button is pressed
- //! \param fc The color in A8R8G8B8 format
- DLLEXPORT void setKBFarbe(int fc);
- //! Processes mouse messages
- //! \param me The event triggered by the keyboard input
- 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 background color in A8R8G8B8 format used when
- //! the button is pressed
- DLLEXPORT int getKlickFarbe() const;
- //! Returns the background image used when the button is pressed
- DLLEXPORT Bild* getKlickBild() const;
- //! Returns the background image without increased reference counter
- //! used when the button is pressed
- DLLEXPORT Bild* zKlickBild() const;
- //! Returns the color gradient used when the button is pressed
- DLLEXPORT AlphaFeld* getKB() const;
- //! Returns the color gradient without increased reference counter
- //! used when the button is pressed
- DLLEXPORT AlphaFeld* zKB() const;
- //! Returns the color of the color gradient in A8R8G8B8 format
- //! used when the button is pressed
- DLLEXPORT int getKBFarbe() const;
- //! Returns the strength of the color gradient used when the button
- //! is pressed
- DLLEXPORT int getKBStrength() const;
- //! Copies the button so it can be modified without affecting the
- //! original
- DLLEXPORT Zeichnung* dublizieren() const override;
- };
- //! A 2D GUI Framework drawing that renders a selectable checkbox
- //! with label
- class KontrollKnopf : public ZeichnungHintergrund
- {
- public:
- class Style : public ZeichnungHintergrund::Style
- {
- public:
- //! Specifies whether the checkbox is selected
- static const __int64 Selected = 0x1000000;
- //! Specifies whether the label text can be multicolored
- static const __int64 MehrfarbigText = 0x001000;
- //! Specifies whether the checkbox has a background color
- //! while being pressed
- static const __int64 KlickFarbe = 0x002000;
- //! Specifies whether the checkbox has a background image
- //! when clicked
- static const __int64 KlickBild = 0x004000;
- //! Specifies whether alpha blending is used for the
- //! checkbox background when clicked
- static const __int64 KlickAlpha = 0x008000;
- //! Specifies whether the checkbox has a color gradient
- //! when clicked
- static const __int64 KlickBuffer = 0x010000;
- //! Specifies whether the checkbox has a background color
- //! while selected
- static const __int64 SelectFarbe = 0x020000;
- //! Specifies whether the checkbox has a background image
- //! while selected
- static const __int64 SelectBild = 0x040000;
- //! Specifies whether alpha blending is used for the
- //! checkbox background while selected
- static const __int64 SelectAlpha = 0x080000;
- //! Specifies whether the checkbox has a color gradient
- //! while selected
- static const __int64 SelectBuffer = 0x100000;
- //! Specifies whether the checkbox has a different label
- //! while selected
- static const __int64 SelectText = 0x200000;
- //! Specifies whether the checkbox can have a multi-line label
- static const __int64 MehrzeiligText = 0x400000;
- //! Specifies whether the checkbox is currently being clicked
- //! with the mouse. (Managed by the checkbox itself)
- static const __int64 MausKlick = 0x800000;
- //! Combines the flags Sichtbar, Erlaubt, Rahmen,
- //! KlickBuffer
- static const __int64 Normal
- = Sichtbar | Erlaubt | Rahmen | KlickBuffer;
- };
- private:
- Text* txt;
- Text* sTxt;
- int sBgF;
- int kBgF;
- Bild* sBgB;
- Bild* kBgB;
- AlphaFeld* sAf;
- AlphaFeld* kAf;
- Bild* kasten;
- Bild* sKasten;
- TextRenderer* textRd;
- int sF;
- int sGr;
- //! Processes mouse messages
- //! \param me The event triggered by the mouse input
- DLLEXPORT void doMausEreignis(MausEreignis& me, bool userRet) override;
- public:
- //! Constructor
- DLLEXPORT KontrollKnopf();
- //! Destructor
- DLLEXPORT virtual ~KontrollKnopf();
- //! Sets a pointer to the label text
- //! \param txt The text
- DLLEXPORT void setTextZ(Text* txt);
- //! Sets the label text
- //! \param txt The text
- DLLEXPORT void setText(Text* txt);
- //! Sets the label text
- //! \param txt The text
- DLLEXPORT void setText(const char* txt);
- //! Sets a pointer to the label text displayed while the
- //! checkbox is selected \param txt The text
- DLLEXPORT void setSTextZ(Text* txt);
- //! Sets the label text displayed while the checkbox is selected
- //! \param txt The text
- DLLEXPORT void setSText(Text* txt);
- //! Sets the label text displayed while the checkbox is selected
- //! \param txt The text
- DLLEXPORT void setSText(const char* txt);
- //! Sets the TextRenderer to use
- //! \param textRd The text renderer
- DLLEXPORT void setTextRendererZ(TextRenderer* textRd);
- //! Sets the font to use for the label
- //! \param schrift The font
- DLLEXPORT void setSchriftZ(Schrift* schrift);
- //! Sets the color of the font used for the label
- //! \param f The color in A8R8G8B8 format
- DLLEXPORT void setSFarbe(int f);
- //! Sets the size of the font used for the label
- //! \param f The height of a line in pixels
- DLLEXPORT void setSSize(int gr);
- //! Sets the background color used while the checkbox is selected
- //! \param f The color in A8R8G8B8 format
- DLLEXPORT void setSBgFarbe(int f);
- //! Sets the background color used while the checkbox is being clicked
- //! \param f The color in A8R8G8B8 format
- DLLEXPORT void setKBgFarbe(int f);
- //! Sets a pointer to the background image used while the checkbox
- //! is selected \param b The image
- DLLEXPORT void setSBgBildZ(Bild* b);
- //! Sets the background image by copying, used while the checkbox
- //! is selected \param b The image to copy
- DLLEXPORT void setSBgBild(Bild* b);
- //! Sets a pointer to the background image used while the checkbox
- //! is being clicked \param b The image
- DLLEXPORT void setKBgBildZ(Bild* b);
- //! Sets the background image by copying, used while the checkbox
- //! is being clicked \param b The image to copy
- DLLEXPORT void setKBgBild(Bild* b);
- //! Sets a pointer to the color gradient used while the checkbox
- //! is selected \param af The color gradient
- DLLEXPORT void setSAlphaFeldZ(AlphaFeld* af);
- //! Sets the color of the color gradient used while the checkbox
- //! is selected \param f The color in A8R8G8B8 format
- DLLEXPORT void setSAFFarbe(int f);
- //! Sets the strength of the color gradient used while the checkbox
- //! is selected \param st The strength
- DLLEXPORT void setSAFStrength(int st);
- //! Sets a pointer to the color gradient used while the checkbox
- //! is being clicked \param af The color gradient
- DLLEXPORT void setKAlphaFeldZ(AlphaFeld* af);
- //! Sets the color of the color gradient used while the checkbox
- //! is being clicked \param f The color in A8R8G8B8 format
- DLLEXPORT void setKAFFarbe(int f);
- //! Sets the strength of the color gradient used while the checkbox
- //! is being clicked \param st The strength
- DLLEXPORT void setKAFStrength(int st);
- //! Loads images "kasten.gif" and "skasten.gif" from an LTDB file.
- //! kasten.gif is drawn when the checkbox is not selected.
- //! skasten.gif is drawn when the checkbox is selected.
- //! \param zDat The LTDB file
- DLLEXPORT void loadData(LTDBDatei* zDat);
- //! Loads images "kasten.gif" and "skasten.gif" from an LTDB file.
- //! kasten.gif is drawn when the checkbox is not selected.
- //! skasten.gif is drawn when the checkbox is selected.
- //! \param ltdb The path to the LTDB file
- DLLEXPORT void loadData(const char* ltdb);
- //! Draws the object to zRObj if it is visible
- //! \param zRObj The image to draw into
- DLLEXPORT void render(Bild& zRObj) override;
- //! Returns the label
- DLLEXPORT Text* getText() const;
- //! Returns the label without increased reference counter
- DLLEXPORT Text* zText() const;
- //! Returns the label used while the checkbox is selected
- DLLEXPORT Text* getSText() const;
- //! Returns the label without increased reference counter used
- //! while the checkbox is selected
- DLLEXPORT Text* zSText() const;
- //! Returns the font used
- DLLEXPORT Schrift* getSchrift() const;
- //! Returns the font used without increased reference counter
- DLLEXPORT Schrift* zSchrift() const;
- //! Returns the font color in A8R8G8B8 format
- DLLEXPORT int getSFarbe() const;
- //! Returns the font size
- DLLEXPORT int getSSize() const;
- //! Returns the background color in A8R8G8B8 format used while
- //! the checkbox is selected
- DLLEXPORT int getSBgFarbe() const;
- //! Returns the background color in A8R8G8B8 format used while
- //! the checkbox is being clicked
- DLLEXPORT int getKBgFarbe() const;
- //! Returns the background image used while the checkbox is selected
- DLLEXPORT Bild* getSBgBild() const;
- //! Returns the background image without increased reference counter
- //! used while the checkbox is selected
- DLLEXPORT Bild* zSBgBild() const;
- //! Returns the background image used while the checkbox is being clicked
- DLLEXPORT Bild* getKBgBild() const;
- //! Returns the background image without increased reference counter
- //! used while the checkbox is being clicked
- DLLEXPORT Bild* zKBgBild() const;
- //! Returns the color gradient used while the checkbox is selected
- DLLEXPORT AlphaFeld* getSAlphaFeld() const;
- //! Returns the color gradient without increased reference counter
- //! used while the checkbox is selected
- DLLEXPORT AlphaFeld* zSAlphaFeld() const;
- //! Returns the color gradient used while the checkbox is being clicked
- DLLEXPORT AlphaFeld* getKAlphaFeld() const;
- //! Returns the color gradient without increased reference counter
- //! used while the checkbox is being clicked
- DLLEXPORT AlphaFeld* zKAlphaFeld() const;
- };
- } // namespace Framework
- #endif
|