ScummVM API documentation
macdialog.h
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 modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (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, see <http://www.gnu.org/licenses/>.
19 *
20 * MIT License:
21 *
22 * Copyright (c) 2009 Alexei Svitkine, Eugene Sandulenko
23 *
24 * Permission is hereby granted, free of charge, to any person
25 * obtaining a copy of this software and associated documentation
26 * files (the "Software"), to deal in the Software without
27 * restriction, including without limitation the rights to use,
28 * copy, modify, merge, publish, distribute, sublicense, and/or sell
29 * copies of the Software, and to permit persons to whom the
30 * Software is furnished to do so, subject to the following
31 * conditions:
32 *
33 * The above copyright notice and this permission notice shall be
34 * included in all copies or substantial portions of the Software.
35 *
36 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
37 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
38 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
39 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
40 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
41 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
42 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
43 * OTHER DEALINGS IN THE SOFTWARE.
44 *
45 */
46
47#ifndef GRAPHICS_MACGUI_MACDIALOG_H
48#define GRAPHICS_MACGUI_MACDIALOG_H
49
50#include "common/str.h"
51#include "common/rect.h"
52
53namespace Common {
54struct Event;
55}
56
57namespace Graphics {
58
59class Font;
60class ManagedSurface;
61
62class MacText;
63class MacWindowManager;
64
65enum {
66 kMacDialogQuitRequested = -2
67};
68
70 Common::String text;
71 Common::Rect bounds;
72
73 MacDialogButton(const char *t, int x1, int y1, int w, int h) {
74 text = t;
75 bounds.left = x1;
76 bounds.top = y1;
77 bounds.right = x1 + w - 1;
78 bounds.bottom = y1 + h - 1;
79 }
80};
81
83
84class MacDialog {
85public:
86 MacDialog(ManagedSurface *screen, MacWindowManager *wm, int width, MacText *mactext, int maxTextWidth, MacDialogButtonArray *buttons, uint defaultButton);
87 virtual ~MacDialog();
88
89 int run();
90 virtual bool processEvent(const Common::Event &event) { return false; }
91
92protected:
93 ManagedSurface *_screen;
95 ManagedSurface *_tempSurface;
96 Common::Rect _bbox;
97 Common::Rect _r;
98 MacText *_mactext;
99 int _maxTextWidth;
100
101 const Font *_font;
102 MacDialogButtonArray *_buttons;
103 uint _defaultButton;
104 bool _mouseOverPressedButton;
105 int _mouseOverButton;
106
107public:
108 int _pressedButton;
109 bool _needsRedraw;
110
111private:
112 const Font *getDialogFont();
113 void drawOutline(Common::Rect &bounds, int *spec, int speclen);
114
115public:
116 virtual void paint();
117 void blit();
118 void mouseMove(int x, int y);
119 void mouseClick(int x, int y);
120 int mouseRaise(int x, int y);
121 int matchButton(int x, int y);
122};
123
124} // End of namespace Graphics
125
126#endif
Definition: array.h:52
Definition: str.h:59
Definition: font.h:83
Definition: macdialog.h:84
Definition: mactext.h:47
Definition: macwindowmanager.h:149
Definition: managed_surface.h:51
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: events.h:218
T right
Definition: rect.h:171
T left
Definition: rect.h:170
Definition: rect.h:536
Definition: macdialog.h:69