scummvm/engines/saga2/msgbox.h
2021-07-01 01:37:00 +02:00

142 lines
3.9 KiB
C++

/* 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.
*
* 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 2
* of the License, or (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* aint32 with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
* Based on the original sources
* Faery Tale II -- The Halls of the Dead
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
#ifndef SAGA2_MSGBOX_H
#define SAGA2_MSGBOX_H
#include "saga2/grequest.h"
namespace Saga2 {
struct textPallete;
void ModalModeSetup(void);
void ModalModeCleanup(void);
void ModalModeHandleTask(void);
void ModalModeHandleKey(short, short);
//Modal Mode GameMode Object
extern GameMode ModalMode;
/* ===================================================================== *
ModalWindow --
* ===================================================================== */
class SimpleWindow : public gWindow {
GameMode *prevModeStackPtr[Max_Modes];
int prevModeStackCtr;
public:
SimpleWindow(const Rect16 &r,
uint16 ident,
char *title,
AppFunc *cmd);
~SimpleWindow();
bool isModal(void);
void update(const Rect16 &);
void draw(void); // redraw the panel.
void drawClipped(gPort &port, const Point16 &offset, const Rect16 &r);
static void DrawOutlineFrame(gPort &port, const Rect16 &r, int16 fillColor);
static void writeWrappedPlaqText(gPort &port,
const Rect16 &r,
gFont *font,
int16 textPos,
textPallete &pal,
bool hiLite,
const char *msg, ...);
};
class SimpleButton : public gControl {
gWindow *window;
public:
SimpleButton(gWindow &, const Rect16 &, char *, uint16, AppFunc *cmd = NULL);
void draw(void); // redraw the panel.
void drawClipped(gPort &port, const Point16 &offset, const Rect16 &r);
private:
bool activate(gEventType why); // activate the control
void deactivate(void);
bool pointerHit(gPanelMessage &msg);
void pointerDrag(gPanelMessage &msg);
void pointerRelease(gPanelMessage &msg);
};
class ErrorWindow : public SimpleWindow {
static char mbChs1Text[8];
static char mbChs2Text[8];
static uint8 numBtns;
public:
static requestInfo rInfo;
ErrorWindow(char *msg,
char *btnMsg1,
char *btnMsg2);
~ErrorWindow();
int16 getResult(void);
static APPFUNC(cmdMessageWindow);
static void ErrorModeSetup(void) {}
static void ErrorModeCleanup(void) {}
static void ErrorModeHandleTask(void) {}
static void ErrorModeHandleKey(short key, short);
};
struct MBErr {
int16 errNo;
MBErr(int16 e) {
errNo = e;
}
};
#define assert_alloc(e,p) if (NULL==p) throw MBErr(e)
int16 FTAMessageBox(char *msg, char *btnMsg1, char *btnMsg2);
#if 0
class SystemErrorMessager : public Messager {
protected:
int dumpit(char *s, size_t size) ;
public:
SystemErrorMessager() {}
~SystemErrorMessager() {}
int16 getAnswer(const char *b1, const char *b2, const char fmt[], ...);
};
#endif
} // end of namespace Saga2
#endif