1 // OpenLieroX
2 
3 
4 // Image
5 // Created 29/10/06
6 // Dark Charlie
7 
8 // code under LGPL
9 
10 
11 #ifndef __CBOX_H__DEPRECATED_GUI__
12 #define __CBOX_H__DEPRECATED_GUI__
13 
14 #include "InputEvents.h"
15 
16 namespace DeprecatedGUI {
17 
18 // Event types
19 enum {
20 	BOX_NOEVENT=-2,
21 	BOX_NONE=-1,
22 	BOX_MOUSEOVER=0
23 };
24 
25 
26 class CBox : public CWidget {
27 public:
28 	// Constructor
CBox(int round,int border,Color lightcolour,Color darkcolour,Color bgcolour)29 	CBox(int round, int border, Color lightcolour, Color darkcolour, Color bgcolour) {
30 		iType = wid_Frame;
31 		iRound = round;
32 		iBorder = border;
33 		iLightColour = lightcolour;
34 		iDarkColour = darkcolour;
35 		iBgColour = bgcolour;
36 		bmpBuffer = NULL;
37 	}
38 
39 private:
40     // Attributes
41 	int		iRound;
42 	int		iBorder;
43 	Color	iLightColour;
44 	Color	iDarkColour;
45 	Color	iBgColour;
46 
47 	SmartPointer<SDL_Surface> bmpBuffer;
48 
49 
50 public:
51     // Methods
52 
Create()53     void			Create()		{ iType = wid_Frame; PreDraw(); }
54 	void			Destroy();
55 
setRound(int round)56 	void			setRound(int round)			{ iRound = round; }
getRound()57 	int				getRound()				{ return iRound; }
setBorder(int border)58 	void			setBorder(int border)		{ iBorder = border; }
getBorder()59 	int				getBorder()				{ return iBorder; }
setLightColour(Color col)60 	void			setLightColour(Color col)	{ iLightColour = col; }
getLightColour()61 	Color			getLightColour()		{ return iLightColour; }
setDarkColour(Color col)62 	void			setDarkColour(Color col)	{ iDarkColour = col;  }
getDarkColour()63 	Color			getDarkColour()			{ return iDarkColour; }
setBgColour(Color col)64 	void			setBgColour(Color col)		{ iBgColour = col; }
getBgColour()65 	Color			getBgColour()			{ return iBgColour; }
66 
67 	//These events return an event id, otherwise they return -1
MouseOver(mouse_t * tMouse)68 	int		MouseOver(mouse_t *tMouse)				{ return CheckEvent(); }
MouseUp(mouse_t * tMouse,int nDown)69 	int		MouseUp(mouse_t *tMouse, int nDown)		{ return CheckEvent(); }
MouseDown(mouse_t * tMouse,int nDown)70 	int		MouseDown(mouse_t *tMouse, int nDown)	{ return CheckEvent(); }
MouseWheelDown(mouse_t * tMouse)71 	int		MouseWheelDown(mouse_t *tMouse)			{ return CheckEvent(); }
MouseWheelUp(mouse_t * tMouse)72 	int		MouseWheelUp(mouse_t *tMouse)			{ return CheckEvent(); }
KeyDown(UnicodeChar c,int keysym,const ModifiersState & modstate)73 	int		KeyDown(UnicodeChar c, int keysym, const ModifiersState& modstate)		{ return BOX_NONE; }
KeyUp(UnicodeChar c,int keysym,const ModifiersState & modstate)74 	int		KeyUp(UnicodeChar c, int keysym, const ModifiersState& modstate)		{ return BOX_NONE; }
75 
SendMessage(int iMsg,DWORD Param1,DWORD Param2)76 	DWORD SendMessage(int iMsg, DWORD Param1, DWORD Param2)	{ return 0; }
SendMessage(int iMsg,const std::string & sStr,DWORD Param)77 	DWORD SendMessage(int iMsg, const std::string& sStr, DWORD Param) { return 0; }
SendMessage(int iMsg,std::string * sStr,DWORD Param)78 	DWORD SendMessage(int iMsg, std::string *sStr, DWORD Param)  { return 0; }
79 
80 	int		CheckEvent();
81 
82 	void	PreDraw();
83 	void	Draw(SDL_Surface * bmpDest);
84 };
85 
86 }; // namespace DeprecatedGUI
87 
88 #endif  //  __CBOX_H__DEPRECATED_GUI__
89