1 /////////////////////////////////////////
2 //
3 //             OpenLieroX
4 //
5 // code under LGPL, based on JasonBs work,
6 // enhanced by Dark Charlie and Albert Zeyer
7 //
8 //
9 /////////////////////////////////////////
10 
11 
12 // Slider
13 // Created 30/6/02
14 // Jason Boettcher
15 
16 
17 #ifndef __CSLIDER_H__DEPRECATED_GUI__
18 #define __CSLIDER_H__DEPRECATED_GUI__
19 
20 #include <string>
21 #include "InputEvents.h"
22 #include "Color.h"
23 
24 namespace DeprecatedGUI {
25 
26 // Slider events
27 enum {
28 	SLD_NONE=-1,
29 	SLD_CHANGE=0
30 };
31 
32 
33 // Slider messages
34 enum {
35 	SLM_GETVALUE=0,
36 	SLM_SETVALUE
37 };
38 
39 
40 class CSlider : public CWidget {
41 public:
42 	// Constructor
43 	CSlider(int max, int min = 0, int val = 0, bool showText = false, int textPosX = 0, int textPosY = 0,
44 				Color textColor = Color(), float valueScale = 1.0f, const std::string & appendText = "" ) {
45 		Create();
46 		iType = wid_Slider;
47 		iMax = max;
48 		iMin = min;
49 		iValue = val;
50 		iVar = NULL;
51 		bShowText = showText;
52 		iTextPosX = textPosX;
53 		iTextPosY = textPosY;
54 		iTextColor = textColor;
55 		fValueScale = valueScale;
56 		sAppendText = appendText;
57 	}
58 
59 
60 private:
61 	// Attributes
62 
63 	int		iValue;
64 	int		iMax;
65 	int		iMin;
66 	int		*iVar;
67 	bool	bShowText;
68 	int		iTextPosX;
69 	int		iTextPosY;
70 	Color	iTextColor;
71 	float	fValueScale;
72 	std::string sAppendText;
73 
74 public:
75 	// Methods
76 
Create()77 	void	Create() { }
Destroy()78 	void	Destroy() { }
79 
80 	//These events return an event id, otherwise they return -1
MouseOver(mouse_t * tMouse)81 	int		MouseOver(mouse_t *tMouse)			{ return SLD_NONE; }
MouseUp(mouse_t * tMouse,int nDown)82 	int		MouseUp(mouse_t *tMouse, int nDown)		{ return SLD_NONE; }
83 	int		MouseDown(mouse_t *tMouse, int nDown);
MouseWheelDown(mouse_t * tMouse)84 	int		MouseWheelDown(mouse_t *tMouse)		{ return SLD_NONE; }
MouseWheelUp(mouse_t * tMouse)85 	int		MouseWheelUp(mouse_t *tMouse)		{ return SLD_NONE; }
86 	int		KeyDown(UnicodeChar c, int keysym, const ModifiersState& modstate);
KeyUp(UnicodeChar c,int keysym,const ModifiersState & modstate)87 	int		KeyUp(UnicodeChar c, int keysym, const ModifiersState& modstate)	{ return SLD_NONE; }
88 
89 	void	Draw(SDL_Surface * bmpDest);
90 
91 	DWORD SendMessage(int iMsg, DWORD Param1, DWORD Param2);
SendMessage(int iMsg,const std::string & sStr,DWORD Param)92 	DWORD SendMessage(int iMsg, const std::string& sStr, DWORD Param) { return 0; }
SendMessage(int iMsg,std::string * sStr,DWORD Param)93 	DWORD SendMessage(int iMsg, std::string *sStr, DWORD Param)  { return 0; }
94 
getValue()95 	int		getValue()						{ return iValue; }
setValue(int v)96 	void	setValue(int v)						{ iValue = v; }
97 
setMax(int _m)98 	void	setMax(int _m)						{ iMax = _m; }
setMin(int _m)99 	void	setMin(int _m)						{ iMin = _m; }
getMax()100 	int		getMax() const						{ return iMax; }
getMin()101 	int		getMin() const						{ return iMin; }
102 
103 };
104 
105 }; // namespace DeprecatedGUI
106 
107 #endif  //  __CSLIDER_H__DEPRECATED_GUI__
108