1 /*
2  *  ppui/MessageBoxContainer.h
3  *
4  *  Copyright 2009 Peter Barth
5  *
6  *  This file is part of Milkytracker.
7  *
8  *  Milkytracker is free software: you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation, either version 3 of the License, or
11  *  (at your option) any later version.
12  *
13  *  Milkytracker is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with Milkytracker.  If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 /////////////////////////////////////////////////////////////////
24 //
25 //	PPContainer control that looks like a Message box
26 //  (can contain other controls)
27 //
28 /////////////////////////////////////////////////////////////////
29 #ifndef MESSAGEBOXCONTAINER__H
30 #define MESSAGEBOXCONTAINER__H
31 
32 #include "BasicTypes.h"
33 #include "Container.h"
34 
35 class PPButton;
36 
37 class PPMessageBoxContainer : public PPContainer
38 {
39 private:
40 	PPString caption;
41 	pp_int32 captionSize;
42 
43 	PPPoint buttonLocation;
44 	PPSize buttonSize;
45 	PPButton* button;
46 
47 	bool captured;
48 	PPPoint lastCapturePoint;
49 
50 public:
51 	PPMessageBoxContainer(pp_int32 id, PPScreen* parentScreen, EventListenerInterface* eventListener,
52 						  const PPPoint& location, const PPSize& size, const PPString& caption);
53 
54 	virtual ~PPMessageBoxContainer();
55 
56 	virtual void paint(PPGraphicsAbstract* graphics);
57 
58 	virtual void setSize(const PPSize& size);
59 	virtual void setLocation(const PPPoint& location);
60 
61 	virtual pp_int32 dispatchEvent(PPEvent* event);
62 
setCaption(const PPString & caption)63 	void setCaption(const PPString& caption) { this->caption = caption; }
64 
65 private:
66 	bool isPointInCaption(const PPPoint& point);
67 
68 	bool handleMove(PPPoint point);
69 };
70 
71 #endif
72