TickHook: Fix crash when TickHook isn't set.
[gemrb.git] / gemrb / core / GUI / Progressbar.h
blob411ae5510215eb8bd7c68977c9f4dc262817c4aa
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.
21 /**
22 * @file Progressbar.h
23 * Declares Progressbar widget for displaying progress of loading and saving games
26 #ifndef PROGRESSBAR_H
27 #define PROGRESSBAR_H
29 #include "GUI/Control.h"
31 #include "exports.h"
33 #include "Animation.h"
34 #include "Sprite2D.h"
36 // !!! Keep in sync with GUIDefines.py !!!
37 #define IE_GUI_PROGRESS_END_REACHED 0x01000000
40 /**
41 * @class Progressbar
42 * Widget for displaying progressbars, mainly on loading/saving screens
45 class GEM_EXPORT Progressbar : public Control {
46 public:
47 Progressbar(unsigned short KnobStepsCount, bool Clear = false);
48 ~Progressbar();
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);
63 /** Dummy function */
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 */
79 bool Clear;
80 /** The bam cycle whose frames work as a progressbar (animated progressbar) */
81 Animation *PBarAnim;
82 /** The most for the progressbar cap (linear progressbar) */
83 Sprite2D *PBarCap;
84 public:
85 /** EndReached Scripted Event Function Name */
86 EventHandler EndReached;
89 #endif