| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- #ifndef Fortschritt_H
- #define Fortschritt_H
- #include "Drawing.h"
- namespace Framework
- {
- class Border; //! Border.h
- class AlphaField; //! AlphaField.h
- class Image; //! Image.h
- class Font; //! Font.h
- class ProgressBar; //! from this file
- class TextRenderer;
- //! A 2D GUI framework drawing that renders a progress bar
- class ProgressBar : public DrawableBackground
- {
- public:
- class Style : public DrawableBackground::Style
- {
- public:
- //! Determines whether a percentage is drawn
- static const __int64 Prozent = 0x001000;
- //! Determines whether the action steps are drawn
- static const __int64 Aktionen = 0x01000000;
- //! Determines whether the progress-covered part of the bar has
- //! its own border
- static const __int64 FBorder = 0x002000;
- //! Determines whether the progress-covered part of the bar has
- //! its own background color
- static const __int64 FColor = 0x004000;
- //! Determines whether the progress-covered part of the bar has
- //! its own background image
- static const __int64 FImage = 0x008000;
- //! Determines whether the progress-covered part of the bar uses
- //! alpha blending for drawing its background
- static const __int64 FAlpha = 0x10000;
- //! Determines whether the progress-covered part of the bar has
- //! its own color gradient
- static const __int64 FBuffered = 0x20000;
- //! Determines whether the progress expands from left to right
- static const __int64 L_R = 0x0100000;
- //! Determines whether the progress expands from right to left
- static const __int64 R_L = 0x0200000;
- //! Determines whether the progress expands from bottom to top
- static const __int64 U_O = 0x0400000;
- //! Determines whether the progress expands from top to bottom
- static const __int64 O_U = 0x0800000;
- //! Combines flags Visible, Border, Background, BackgroundImage,
- //! FBorder, FImage, L_R, Percent
- static const __int64 normal = Visible | Border | Background
- | HImage | FBorder | FImage | L_R
- | Prozent | Aktionen | HImageScale;
- };
- private:
- __int64 maxAk;
- __int64 ak;
- Border* fBorder;
- AlphaField* fBuffer;
- int fBgF;
- Image* fBgImage;
- TextRenderer* textRd;
- int fontColor;
- unsigned char fontSize;
- public:
- //! Constructor
- DLLEXPORT ProgressBar();
- //! Destructor
- DLLEXPORT virtual ~ProgressBar();
- //! Sets the number of operations needed to reach 100% progress
- //! \param ak The number of operations
- DLLEXPORT void setActionCount(__int64 ak);
- //! Indicates that a certain number of operations have been performed
- //! since the last call \param aktionen The operations performed.
- //! Defaults to 1
- DLLEXPORT void actionPlus(__int64 aktionen = 1);
- //! Resets all completed operations so that progress starts from 0% again
- DLLEXPORT void reset();
- //! Sets a pointer to the border drawn in the progress-covered part
- //! of the bar \param ram The border
- DLLEXPORT void setFBorderZ(Border* ram);
- //! Sets the color of the border drawn in the progress-covered part
- //! of the bar \param f The color in A8R8G8B8 format
- DLLEXPORT void setFRColor(int f);
- //! Sets the width of the border drawn in the progress-covered part
- //! of the bar \param br The width in pixels
- DLLEXPORT void setFRWidth(int br);
- //! Sets a pointer to the color gradient drawn in the progress-covered
- //! part of the bar \param af The color gradient
- DLLEXPORT void setFAlphaFieldZ(AlphaField* af);
- //! Sets the color of the color gradient drawn in the progress-covered
- //! part of the bar \param f The color in A8R8G8B8 format
- DLLEXPORT void setFAFColor(int f);
- //! Sets the strength of the color gradient drawn in the progress-covered
- //! part of the bar \param st The strength
- DLLEXPORT void setFAFStrength(int st);
- //! Sets the background color drawn in the progress-covered part
- //! of the bar \param f The color in A8R8G8B8 format
- DLLEXPORT void setFBgColor(int f);
- //! Sets a pointer to the background image drawn in the progress-covered
- //! part of the bar \param b The image
- DLLEXPORT void setFBgImageZ(Image* b);
- //! Sets the background image by copying, drawn in the progress-covered
- //! part of the bar \param b The image to copy
- DLLEXPORT void setFBgImage(Image* b);
- //! Sets the text renderer used
- //! \param textRd The text renderer
- DLLEXPORT void setTextRendererZ(TextRenderer* textRd);
- //! Sets the font used to draw the percentage display
- DLLEXPORT void setFontZ(Font* b);
- //! Sets the color of the percentage display
- //! \param f The color in A8R8G8B8 format
- DLLEXPORT void setSColor(int f);
- //! Sets the font size of the percentage display
- //! \param gr The height of a line in pixels
- DLLEXPORT void setSSize(unsigned char gr);
- //! Draws the object to zRObj if it is visible
- //! \param zRObj The image to draw into
- DLLEXPORT void render(Image& zRObj) override;
- //! Returns the number of operations needed for 100%
- DLLEXPORT __int64 getActionCount() const;
- //! Returns the current percentage of progress
- DLLEXPORT double getProzent() const;
- //! Returns the number of completed operations
- DLLEXPORT __int64 getAktion() const;
- //! Returns the border drawn in the progress-covered part of the bar
- DLLEXPORT Border* getFBorder() const;
- //! Returns the border without increased reference counter drawn in the
- //! progress-covered part of the bar
- DLLEXPORT Border* zFBorder() const;
- //! Returns the color gradient drawn in the progress-covered part of the bar
- DLLEXPORT AlphaField* getFAlphaField() const;
- //! Returns the color gradient without increased reference counter drawn
- //! in the progress-covered part of the bar
- DLLEXPORT AlphaField* zFAlphaField() const;
- //! Returns the background color in A8R8G8B8 format drawn in the
- //! progress-covered part of the bar
- DLLEXPORT int getFBgColor() const;
- //! Returns the background image drawn in the progress-covered part
- //! of the bar
- DLLEXPORT Image* getFBgImage() const;
- //! Returns the background image without increased reference counter
- //! drawn in the progress-covered part of the bar
- DLLEXPORT Image* zFBgImage() const;
- //! Returns the font used for the percentage display
- DLLEXPORT Font* getFont() const;
- //! Returns the font without increased reference counter used for the
- //! percentage display
- DLLEXPORT Font* zFont() const;
- //! Returns the color of the percentage display in A8R8G8B8 format
- DLLEXPORT int getSColor() const;
- };
- } // namespace Framework
- #endif
|