ScummVM API documentation
ui_object.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 */
21
22/*
23 * This file is based on WME Lite.
24 * http://dead-code.org/redir.php?target=wmelite
25 * Copyright (c) 2011 Jan Nedoma
26 */
27
28#ifndef WINTERMUTE_UIOBJECT_H
29#define WINTERMUTE_UIOBJECT_H
30
31
32#include "engines/wintermute/base/base_object.h"
33#include "engines/wintermute/dctypes.h" // Added by ClassView
34
35namespace Wintermute {
36
37class UITiledImage;
38class BaseFont;
39class UIObject : public BaseObject {
40public:
41 const char *getAccessCaption() override;
42
43 bool getTotalOffset(int *offsetX, int *offsetY);
44 bool _canFocus;
45 bool focus();
46 bool handleMouse(TMouseEvent event, TMouseButton button) override;
47 bool isFocused();
48 bool _parentNotify;
49 DECLARE_PERSISTENT(UIObject, BaseObject)
50 UIObject *_parent;
51 bool display() override { return display(0, 0); }
52 virtual bool display(int offsetX) { return display(offsetX, 0); }
53 virtual bool display(int offsetX, int offsetY);
54 virtual void correctSize();
55 bool _sharedFonts;
56 bool _sharedImages;
57 void setText(const char *text);
58 char *_text;
59 BaseFont *_font;
60 bool _visible;
61 UITiledImage *_back;
62 bool _disable;
63 UIObject(BaseGame *inGame = nullptr);
64 ~UIObject() override;
65 int32 _width;
66 int32 _height;
67 TUIObjectType _type;
68 BaseSprite *_image;
69 void setListener(BaseScriptHolder *object, BaseScriptHolder *listenerObject, uint32 listenerParam);
70 BaseScriptHolder *_listenerParamObject;
71 uint32 _listenerParamDWORD;
72 BaseScriptHolder *_listenerObject;
73 UIObject *_focusedWidget;
74 bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
75
76 // scripting interface
77 ScValue *scGetProperty(const char *name) override;
78 bool scSetProperty(const char *name, ScValue *value) override;
79 bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
80 const char *scToString() override;
81};
82
83} // End of namespace Wintermute
84
85#endif
Definition: base_dynamic_buffer.h:35
Definition: base_font.h:37
Definition: base_game.h:79
Definition: base_object.h:49
Definition: base_script_holder.h:37
Definition: base_sprite.h:40
Definition: script.h:44
Definition: script_stack.h:41
Definition: script_value.h:42
Definition: ui_object.h:39
Definition: ui_tiled_image.h:37