2013-06-13 00:51:47 +00: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.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BURIED_WINDOW_H
|
|
|
|
#define BURIED_WINDOW_H
|
|
|
|
|
2013-08-04 19:26:09 +00:00
|
|
|
#include "common/rect.h"
|
2021-03-17 07:54:33 +00:00
|
|
|
#include "common/list.h"
|
2013-06-13 00:51:47 +00:00
|
|
|
|
|
|
|
namespace Common {
|
|
|
|
struct KeyState;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Buried {
|
|
|
|
|
2013-08-04 19:26:09 +00:00
|
|
|
class BuriedEngine;
|
2021-03-16 16:56:56 +00:00
|
|
|
class Message;
|
2013-06-13 00:51:47 +00:00
|
|
|
|
|
|
|
class Window {
|
|
|
|
public:
|
2013-09-12 02:49:47 +00:00
|
|
|
Window(BuriedEngine *vm, Window *parent, bool visible = false);
|
2013-08-04 19:26:09 +00:00
|
|
|
virtual ~Window();
|
2013-06-13 00:51:47 +00:00
|
|
|
|
|
|
|
// The message types used by Buried in Time's windows
|
|
|
|
virtual bool onEraseBackground() { return false; }
|
|
|
|
virtual void onKeyDown(const Common::KeyState &key, uint flags) {}
|
|
|
|
virtual void onKeyUp(const Common::KeyState &key, uint flags) {}
|
|
|
|
virtual void onTimer(uint timer) {}
|
|
|
|
virtual void onKillFocus(Window *newWindow) {}
|
|
|
|
virtual void onSetFocus(Window *oldWindow) {}
|
|
|
|
virtual void onPaint() {}
|
|
|
|
virtual void onLButtonUp(const Common::Point &point, uint flags) {}
|
|
|
|
virtual void onLButtonDown(const Common::Point &point, uint flags) {}
|
|
|
|
virtual void onMouseMove(const Common::Point &point, uint flags) {}
|
|
|
|
virtual void onMButtonUp(const Common::Point &point, uint flags) {}
|
|
|
|
virtual void onRButtonUp(const Common::Point &point, uint flags) {}
|
|
|
|
virtual void onRButtonDown(const Common::Point &point, uint flags) {}
|
2013-09-17 01:33:30 +00:00
|
|
|
virtual bool onSetCursor(uint message);
|
2013-06-13 00:51:47 +00:00
|
|
|
virtual void onEnable(bool enable) {}
|
|
|
|
|
2013-08-04 19:26:09 +00:00
|
|
|
void invalidateRect(const Common::Rect &rect, bool erase = true);
|
2013-09-01 21:03:39 +00:00
|
|
|
void invalidateWindow(bool erase = true) { invalidateRect(_rect, erase); }
|
2013-08-04 19:26:09 +00:00
|
|
|
Window *getParent() const { return _parent; }
|
|
|
|
const Common::Rect &getRect() const { return _rect; }
|
|
|
|
Common::Rect getClientRect() const;
|
2013-09-04 01:44:34 +00:00
|
|
|
Common::Rect getAbsoluteRect() const;
|
|
|
|
void updateWindow();
|
2013-08-04 20:39:46 +00:00
|
|
|
void enableWindow(bool enable);
|
|
|
|
bool isWindowEnabled() const;
|
2013-09-18 23:06:30 +00:00
|
|
|
void setWindowPos(const Window *insertAfter, int x, int y, int width, int height, uint flags);
|
2013-09-04 01:44:34 +00:00
|
|
|
|
|
|
|
// The subset of show modes we'll accept
|
|
|
|
enum WindowShowMode {
|
|
|
|
kWindowShow,
|
|
|
|
kWindowHide,
|
|
|
|
kWindowShowNormal
|
|
|
|
};
|
|
|
|
|
|
|
|
void showWindow(WindowShowMode showMode);
|
|
|
|
bool isWindowVisible() const { return _visible; }
|
|
|
|
|
|
|
|
// The subset of flags we'll accept
|
|
|
|
enum WindowPosFlags {
|
|
|
|
kWindowPosNoFlags = 0,
|
|
|
|
|
|
|
|
kWindowPosNoSize = (1 << 0),
|
|
|
|
kWindowPosNoZOrder = (1 << 1),
|
|
|
|
kWindowPosHideWindow = (1 << 2),
|
|
|
|
kWindowPosShowWindow = (1 << 3),
|
|
|
|
kWindowPosNoMove = (1 << 4),
|
|
|
|
kWindowPosNoActivate = (1 << 5)
|
|
|
|
};
|
2013-08-04 19:26:09 +00:00
|
|
|
|
2013-09-06 02:18:55 +00:00
|
|
|
Window *setFocus();
|
2013-09-16 00:39:37 +00:00
|
|
|
Window *setCapture();
|
2013-06-13 00:51:47 +00:00
|
|
|
|
2013-09-07 01:11:46 +00:00
|
|
|
void sendMessage(Message *message);
|
|
|
|
void postMessage(Message *message);
|
2013-06-13 00:51:47 +00:00
|
|
|
|
2013-09-16 00:39:37 +00:00
|
|
|
Window *childWindowAtPoint(const Common::Point &point);
|
|
|
|
|
|
|
|
// Helper functions
|
|
|
|
Common::Point convertPointToGlobal(const Common::Point &point);
|
|
|
|
Common::Point convertPointToLocal(const Common::Point &point);
|
|
|
|
Common::Point convertPointToWindow(const Common::Point &point, Window *dest);
|
2013-09-06 02:53:12 +00:00
|
|
|
|
2013-08-05 00:42:45 +00:00
|
|
|
protected:
|
2013-08-04 19:26:09 +00:00
|
|
|
BuriedEngine *_vm;
|
2013-06-13 00:51:47 +00:00
|
|
|
|
2013-08-04 19:26:09 +00:00
|
|
|
Window *_parent;
|
|
|
|
Common::Rect _rect;
|
2013-08-05 00:42:45 +00:00
|
|
|
|
2013-09-02 03:37:09 +00:00
|
|
|
uint setTimer(uint elapse);
|
|
|
|
bool killTimer(uint timer);
|
|
|
|
|
2013-09-04 01:44:34 +00:00
|
|
|
Common::Rect makeAbsoluteRect(const Common::Rect &rect) const;
|
|
|
|
|
2013-08-05 00:42:45 +00:00
|
|
|
private:
|
2013-09-04 01:44:34 +00:00
|
|
|
bool _enabled, _visible;
|
|
|
|
|
|
|
|
typedef Common::List<Window *> WindowList;
|
|
|
|
WindowList _children, _topMostChildren;
|
2013-06-13 00:51:47 +00:00
|
|
|
};
|
|
|
|
|
2013-09-04 01:44:34 +00:00
|
|
|
// A subset of the special insert after Window handles
|
|
|
|
// (Values declared in window.cpp)
|
|
|
|
extern const Window *kWindowPosTop;
|
|
|
|
extern const Window *kWindowPosTopMost;
|
|
|
|
|
2013-06-13 00:51:47 +00:00
|
|
|
} // End of namespace Buried
|
|
|
|
|
|
|
|
#endif
|