Progress.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. #ifndef Fortschritt_H
  2. #define Fortschritt_H
  3. #include "Drawing.h"
  4. namespace Framework
  5. {
  6. class Rahmen; //! Border.h
  7. class AlphaFeld; //! AlphaField.h
  8. class Bild; //! Image.h
  9. class Schrift; //! Font.h
  10. class FBalken; //! from this file
  11. class TextRenderer;
  12. //! A 2D GUI framework drawing that renders a progress bar
  13. class FBalken : public DrawableBackground
  14. {
  15. public:
  16. class Style : public DrawableBackground::Style
  17. {
  18. public:
  19. //! Determines whether a percentage is drawn
  20. static const __int64 Prozent = 0x001000;
  21. //! Determines whether the action steps are drawn
  22. static const __int64 Aktionen = 0x01000000;
  23. //! Determines whether the progress-covered part of the bar has
  24. //! its own border
  25. static const __int64 FRahmen = 0x002000;
  26. //! Determines whether the progress-covered part of the bar has
  27. //! its own background color
  28. static const __int64 FFarbe = 0x004000;
  29. //! Determines whether the progress-covered part of the bar has
  30. //! its own background image
  31. static const __int64 FBild = 0x008000;
  32. //! Determines whether the progress-covered part of the bar uses
  33. //! alpha blending for drawing its background
  34. static const __int64 FAlpha = 0x10000;
  35. //! Determines whether the progress-covered part of the bar has
  36. //! its own color gradient
  37. static const __int64 FBuffered = 0x20000;
  38. //! Determines whether the progress expands from left to right
  39. static const __int64 L_R = 0x0100000;
  40. //! Determines whether the progress expands from right to left
  41. static const __int64 R_L = 0x0200000;
  42. //! Determines whether the progress expands from bottom to top
  43. static const __int64 U_O = 0x0400000;
  44. //! Determines whether the progress expands from top to bottom
  45. static const __int64 O_U = 0x0800000;
  46. //! Combines flags Visible, Border, Background, BackgroundImage,
  47. //! FBorder, FImage, L_R, Percent
  48. static const __int64 normal = Sichtbar | Rahmen | Hintergrund
  49. | HBild | FRahmen | FBild | L_R
  50. | Prozent | Aktionen | HBildScale;
  51. };
  52. private:
  53. __int64 maxAk;
  54. __int64 ak;
  55. Rahmen* fRahmen;
  56. AlphaFeld* fBuffer;
  57. int fBgF;
  58. Bild* fBgBild;
  59. TextRenderer* textRd;
  60. int schriftFarbe;
  61. unsigned char schriftSize;
  62. public:
  63. //! Constructor
  64. DLLEXPORT FBalken();
  65. //! Destructor
  66. DLLEXPORT virtual ~FBalken();
  67. //! Sets the number of operations needed to reach 100% progress
  68. //! \param ak The number of operations
  69. DLLEXPORT void setAktionAnzahl(__int64 ak);
  70. //! Indicates that a certain number of operations have been performed
  71. //! since the last call \param aktionen The operations performed.
  72. //! Defaults to 1
  73. DLLEXPORT void aktionPlus(__int64 aktionen = 1);
  74. //! Resets all completed operations so that progress starts from 0% again
  75. DLLEXPORT void reset();
  76. //! Sets a pointer to the border drawn in the progress-covered part
  77. //! of the bar \param ram The border
  78. DLLEXPORT void setFRahmenZ(Rahmen* ram);
  79. //! Sets the color of the border drawn in the progress-covered part
  80. //! of the bar \param f The color in A8R8G8B8 format
  81. DLLEXPORT void setFRFarbe(int f);
  82. //! Sets the width of the border drawn in the progress-covered part
  83. //! of the bar \param br The width in pixels
  84. DLLEXPORT void setFRBreite(int br);
  85. //! Sets a pointer to the color gradient drawn in the progress-covered
  86. //! part of the bar \param af The color gradient
  87. DLLEXPORT void setFAlphaFeldZ(AlphaFeld* af);
  88. //! Sets the color of the color gradient drawn in the progress-covered
  89. //! part of the bar \param f The color in A8R8G8B8 format
  90. DLLEXPORT void setFAFFarbe(int f);
  91. //! Sets the strength of the color gradient drawn in the progress-covered
  92. //! part of the bar \param st The strength
  93. DLLEXPORT void setFAFStrength(int st);
  94. //! Sets the background color drawn in the progress-covered part
  95. //! of the bar \param f The color in A8R8G8B8 format
  96. DLLEXPORT void setFBgFarbe(int f);
  97. //! Sets a pointer to the background image drawn in the progress-covered
  98. //! part of the bar \param b The image
  99. DLLEXPORT void setFBgBildZ(Bild* b);
  100. //! Sets the background image by copying, drawn in the progress-covered
  101. //! part of the bar \param b The image to copy
  102. DLLEXPORT void setFBgBild(Bild* b);
  103. //! Sets the text renderer used
  104. //! \param textRd The text renderer
  105. DLLEXPORT void setTextRendererZ(TextRenderer* textRd);
  106. //! Sets the font used to draw the percentage display
  107. DLLEXPORT void setSchriftZ(Schrift* b);
  108. //! Sets the color of the percentage display
  109. //! \param f The color in A8R8G8B8 format
  110. DLLEXPORT void setSFarbe(int f);
  111. //! Sets the font size of the percentage display
  112. //! \param gr The height of a line in pixels
  113. DLLEXPORT void setSSize(unsigned char gr);
  114. //! Draws the object to zRObj if it is visible
  115. //! \param zRObj The image to draw into
  116. DLLEXPORT void render(Bild& zRObj) override;
  117. //! Returns the number of operations needed for 100%
  118. DLLEXPORT __int64 getAktionAnzahl() const;
  119. //! Returns the current percentage of progress
  120. DLLEXPORT double getProzent() const;
  121. //! Returns the number of completed operations
  122. DLLEXPORT __int64 getAktion() const;
  123. //! Returns the border drawn in the progress-covered part of the bar
  124. DLLEXPORT Rahmen* getFRahmen() const;
  125. //! Returns the border without increased reference counter drawn in the
  126. //! progress-covered part of the bar
  127. DLLEXPORT Rahmen* zFRahmen() const;
  128. //! Returns the color gradient drawn in the progress-covered part of the bar
  129. DLLEXPORT AlphaFeld* getFAlphaFeld() const;
  130. //! Returns the color gradient without increased reference counter drawn
  131. //! in the progress-covered part of the bar
  132. DLLEXPORT AlphaFeld* zFAlphaFeld() const;
  133. //! Returns the background color in A8R8G8B8 format drawn in the
  134. //! progress-covered part of the bar
  135. DLLEXPORT int getFBgFarbe() const;
  136. //! Returns the background image drawn in the progress-covered part
  137. //! of the bar
  138. DLLEXPORT Bild* getFBgBild() const;
  139. //! Returns the background image without increased reference counter
  140. //! drawn in the progress-covered part of the bar
  141. DLLEXPORT Bild* zFBgBild() const;
  142. //! Returns the font used for the percentage display
  143. DLLEXPORT Schrift* getSchrift() const;
  144. //! Returns the font without increased reference counter used for the
  145. //! percentage display
  146. DLLEXPORT Schrift* zSchrift() const;
  147. //! Returns the color of the percentage display in A8R8G8B8 format
  148. DLLEXPORT int getSFarbe() const;
  149. };
  150. } // namespace Framework
  151. #endif