scummvm/engines/buried/window.h

131 lines
3.9 KiB
C
Raw Normal View History

/* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef BURIED_WINDOW_H
#define BURIED_WINDOW_H
#include "common/rect.h"
2021-03-17 07:54:33 +00:00
#include "common/list.h"
namespace Common {
struct KeyState;
}
namespace Buried {
class BuriedEngine;
2021-03-16 16:56:56 +00:00
class Message;
class Window {
public:
Window(BuriedEngine *vm, Window *parent, bool visible = false);
virtual ~Window();
// 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) {}
virtual bool onSetCursor(uint message);
virtual void onEnable(bool enable) {}
void invalidateRect(const Common::Rect &rect, bool erase = true);
void invalidateWindow(bool erase = true) { invalidateRect(_rect, erase); }
Window *getParent() const { return _parent; }
const Common::Rect &getRect() const { return _rect; }
Common::Rect getClientRect() const;
Common::Rect getAbsoluteRect() const;
void updateWindow();
2013-08-04 20:39:46 +00:00
void enableWindow(bool enable);
bool isWindowEnabled() const;
void setWindowPos(const Window *insertAfter, int x, int y, int width, int height, uint flags);
// 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)
};
Window *setFocus();
Window *setCapture();
void sendMessage(Message *message);
void postMessage(Message *message);
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
protected:
BuriedEngine *_vm;
Window *_parent;
Common::Rect _rect;
2013-09-02 03:37:09 +00:00
uint setTimer(uint elapse);
bool killTimer(uint timer);
Common::Rect makeAbsoluteRect(const Common::Rect &rect) const;
private:
bool _enabled, _visible;
typedef Common::List<Window *> WindowList;
WindowList _children, _topMostChildren;
};
// A subset of the special insert after Window handles
// (Values declared in window.cpp)
extern const Window *kWindowPosTop;
extern const Window *kWindowPosTopMost;
} // End of namespace Buried
#endif