1 /* GemRB - Infinity Engine Emulator
2 * Copyright (C) 2003-2005 The GemRB Project
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 * Declares Progressbar widget for displaying progress of loading and saving games
29 #include "GUI/Control.h"
33 #include "Animation.h"
36 // !!! Keep in sync with GUIDefines.py !!!
37 #define IE_GUI_PROGRESS_END_REACHED 0x01000000
42 * Widget for displaying progressbars, mainly on loading/saving screens
45 class GEM_EXPORT Progressbar
: public Control
{
47 Progressbar(unsigned short KnobStepsCount
, bool Clear
= false);
49 /** Draws the Control on the Output Display */
50 void Draw(unsigned short x
, unsigned short y
);
51 /** Returns the actual Progressbar Position */
52 unsigned int GetPosition();
53 /** Sets the actual Progressbar Position trimming to the Max and Min Values */
54 void SetPosition(unsigned int pos
);
55 /** Sets the background images */
56 void SetImage(Sprite2D
* img
, Sprite2D
* img2
);
57 /** Sets a bam resource for progressbar */
58 void SetAnimation(Animation
*arg
);
59 /** Sets a mos resource for progressbar cap */
60 void SetBarCap(Sprite2D
*img3
);
61 /** Sets the mos coordinates for the progressbar filler mos/cap */
62 void SetSliderPos(int x
, int y
, int x2
, int y2
);
64 int SetText(const char * string
, int pos
= 0);
65 /** Redraws a progressbar which is associated with VariableName */
66 void RedrawProgressbar(const char *VariableName
, int Sum
);
67 /** Set handler for specified event */
68 bool SetEvent(int eventType
, EventHandler handler
);
70 private: // Private attributes
71 /** BackGround Images. If smaller than the Control Size, the image will be tiled. */
72 Sprite2D
* BackGround
;
73 Sprite2D
* BackGround2
; //mos resource for the filling of the bar
74 /** Knob Steps Count */
75 unsigned int KnobStepsCount
;
76 int KnobXPos
, KnobYPos
; //relative coordinates for Background2
77 int CapXPos
, CapYPos
; //relative coordinates for PBarCap
78 /** If true, on deletion the Progressbar will destroy the associated images */
80 /** The bam cycle whose frames work as a progressbar (animated progressbar) */
82 /** The most for the progressbar cap (linear progressbar) */
85 /** EndReached Scripted Event Function Name */
86 EventHandler EndReached
;