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 
53 namespace Graphics {
54 
55 class Font;
56 class ManagedSurface;
57 
58 class MacText;
59 class MacWindowManager;
60 
61 enum {
62  kMacDialogQuitRequested = -2
63 };
64 
66  Common::String text;
67  Common::Rect bounds;
68 
69  MacDialogButton(const char *t, int x1, int y1, int w, int h) {
70  text = t;
71  bounds.left = x1;
72  bounds.top = y1;
73  bounds.right = x1 + w - 1;
74  bounds.bottom = y1 + h - 1;
75  }
76 };
77 
79 
80 class MacDialog {
81 public:
82  MacDialog(ManagedSurface *screen, MacWindowManager *wm, int width, MacText *mactext, int maxTextWidth, MacDialogButtonArray *buttons, uint defaultButton);
83  ~MacDialog();
84 
85  int run();
86 
87 private:
88  ManagedSurface *_screen;
89  MacWindowManager *_wm;
90  ManagedSurface *_tempSurface;
91  Common::Rect _bbox;
92  Common::Rect _r;
93  MacText *_mactext;
94  int _maxTextWidth;
95 
96  const Font *_font;
97  MacDialogButtonArray *_buttons;
98  uint _defaultButton;
99  bool _mouseOverPressedButton;
100 
101 public:
102  int _pressedButton;
103  bool _needsRedraw;
104 
105 private:
106  const Font *getDialogFont();
107  void drawOutline(Common::Rect &bounds, int *spec, int speclen);
108 
109 public:
110  void paint();
111  void mouseMove(int x, int y);
112  void mouseClick(int x, int y);
113  int mouseRaise(int x, int y);
114  int matchButton(int x, int y);
115 };
116 
117 } // End of namespace Graphics
118 
119 #endif
Definition: managed_surface.h:51
Definition: str.h:59
Definition: font.h:83
Definition: macdialog.h:65
Definition: array.h:52
Definition: mactext.h:47
int16 right
Definition: rect.h:146
Definition: rect.h:144
Definition: macwindowmanager.h:149
Definition: formatinfo.h:28
int16 left
Definition: rect.h:145
Definition: macdialog.h:80