1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef GRAPHICS_MACGUI_MACBUTTON_H
24 #define GRAPHICS_MACGUI_MACBUTTON_H
25 
26 #include "graphics/macgui/mactext.h"
27 #include "graphics/macgui/macwidget.h"
28 
29 namespace Graphics {
30 
31 class MacWidget;
32 class MacText;
33 struct MacPlotData;
34 
35 enum MacButtonType {
36 	kRound,
37 	kCheckBox,
38 	kRadio
39 };
40 
41 // those name comes from Apartment
42 enum CheckBoxType {
43 	kCBNormal,
44 	kCBInsetBlack,
45 	kCBFilledBlack
46 };
47 
48 class MacButton : public MacText {
49 public:
50 	MacButton(MacButtonType buttonType, TextAlign textAlignment, MacWidget *parent, int x, int y, int w, int h, MacWindowManager *wm, const Common::U32String &s, const MacFont *macFont, int fgcolor, int bgcolor);
51 
52 	virtual void setActive(bool active) override;
53 
54 	void invertOuter();
55 	void invertInner();
56 
57 	void setHilite(bool hilite);
58 	void setCheckBoxType(int type);
setCheckBoxAccess(int type)59 	void setCheckBoxAccess(int type) { _checkBoxAccess = type; }
60 
61 	virtual bool draw(ManagedSurface *g, bool forceRedraw = false) override;
62 	virtual bool draw(bool forceRedraw = false) override;
63 	virtual bool processEvent(Common::Event &event) override;
64 	virtual Common::Point calculateOffset() override;
65 
66 private:
67 	void init();
68 
69 private:
70 	MacButtonType _buttonType;
71 	MacPlotData _pd;
72 	bool _invertInner;
73 	int _checkBoxType;
74 	int _checkBoxAccess;
75 };
76 
77 } // End of namespace Graphics
78 
79 #endif
80