2016-01-19 11:07:54 +01:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
2021-12-26 18:47:58 +01:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2016-09-03 12:46:38 +02:00
|
|
|
*
|
2016-01-19 11:07:54 +01:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2016-09-03 12:46:38 +02:00
|
|
|
*
|
2016-01-19 11:07:54 +01:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-12-26 18:47:58 +01:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2016-01-19 11:07:54 +01:00
|
|
|
*
|
|
|
|
* MIT License:
|
|
|
|
*
|
|
|
|
* Copyright (c) 2009 Alexei Svitkine, Eugene Sandulenko
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person
|
|
|
|
* obtaining a copy of this software and associated documentation
|
|
|
|
* files (the "Software"), to deal in the Software without
|
|
|
|
* restriction, including without limitation the rights to use,
|
|
|
|
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following
|
|
|
|
* conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
|
|
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
|
|
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2022-07-19 22:28:50 +05:30
|
|
|
#ifndef GRAPHICS_MACGUI_MACDIALOG_H
|
|
|
|
#define GRAPHICS_MACGUI_MACDIALOG_H
|
|
|
|
|
|
|
|
#include "common/str.h"
|
|
|
|
#include "common/rect.h"
|
|
|
|
|
|
|
|
#include "graphics/managed_surface.h"
|
|
|
|
#include "graphics/font.h"
|
2016-01-19 11:07:54 +01:00
|
|
|
|
|
|
|
namespace Wage {
|
2022-07-19 22:28:50 +05:30
|
|
|
class Gui;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Graphics {
|
2016-01-19 11:07:54 +01:00
|
|
|
|
2022-07-19 23:37:52 +05:30
|
|
|
class MacText;
|
|
|
|
|
2022-07-19 22:28:50 +05:30
|
|
|
struct MacDialogButton {
|
2016-01-19 18:16:36 +01:00
|
|
|
Common::String text;
|
|
|
|
Common::Rect bounds;
|
2016-01-19 18:41:35 +01:00
|
|
|
|
2022-07-19 22:28:50 +05:30
|
|
|
MacDialogButton(const char *t, int x1, int y1, int w, int h) {
|
2016-01-19 18:41:35 +01:00
|
|
|
text = t;
|
|
|
|
bounds.left = x1;
|
|
|
|
bounds.top = y1;
|
2016-01-20 22:36:36 +01:00
|
|
|
bounds.right = x1 + w - 1;
|
|
|
|
bounds.bottom = y1 + h - 1;
|
2016-01-19 18:41:35 +01:00
|
|
|
}
|
2016-01-19 18:16:36 +01:00
|
|
|
};
|
|
|
|
|
2022-07-19 22:28:50 +05:30
|
|
|
typedef Common::Array<MacDialogButton *> MacDialogButtonArray;
|
2016-01-19 18:16:36 +01:00
|
|
|
|
2022-07-19 22:28:50 +05:30
|
|
|
class MacDialog {
|
2016-01-19 11:07:54 +01:00
|
|
|
public:
|
2022-07-19 23:37:52 +05:30
|
|
|
MacDialog(Wage::Gui *gui, int width, MacText *mactext, MacDialogButtonArray *buttons, uint defaultButton);
|
2022-07-19 22:28:50 +05:30
|
|
|
~MacDialog();
|
2016-01-19 11:07:54 +01:00
|
|
|
|
2016-01-21 11:47:58 +01:00
|
|
|
int run();
|
2016-01-19 18:41:35 +01:00
|
|
|
|
2016-01-19 11:07:54 +01:00
|
|
|
private:
|
2022-07-19 22:28:50 +05:30
|
|
|
Wage::Gui *_gui;
|
|
|
|
ManagedSurface _tempSurface;
|
2016-01-19 18:16:36 +01:00
|
|
|
Common::Rect _bbox;
|
2022-07-19 23:37:52 +05:30
|
|
|
MacText *_mactext;
|
2016-01-19 11:07:54 +01:00
|
|
|
|
2022-07-19 22:28:50 +05:30
|
|
|
const Font *_font;
|
|
|
|
MacDialogButtonArray *_buttons;
|
2016-01-20 22:36:36 +01:00
|
|
|
int _pressedButton;
|
2016-02-14 15:25:44 +01:00
|
|
|
uint _defaultButton;
|
2016-01-19 18:16:36 +01:00
|
|
|
bool _mouseOverPressedButton;
|
2016-01-19 11:07:54 +01:00
|
|
|
|
2016-01-21 11:47:58 +01:00
|
|
|
bool _needsRedraw;
|
|
|
|
|
2016-01-19 11:07:54 +01:00
|
|
|
private:
|
2022-07-19 22:28:50 +05:30
|
|
|
const Font *getDialogFont();
|
2016-01-19 18:16:36 +01:00
|
|
|
void drawOutline(Common::Rect &bounds, int *spec, int speclen);
|
|
|
|
void paint();
|
2016-01-21 11:47:58 +01:00
|
|
|
void mouseMove(int x, int y);
|
|
|
|
void mouseClick(int x, int y);
|
|
|
|
int mouseRaise(int x, int y);
|
|
|
|
int matchButton(int x, int y);
|
2016-01-19 11:07:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Wage
|
|
|
|
|
|
|
|
#endif
|