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 
35 namespace Wintermute {
36 
37 class UITiledImage;
38 class BaseFont;
39 class UIObject : public BaseObject {
40 public:
41 
42  bool getTotalOffset(int *offsetX, int *offsetY);
43  bool focus();
44  bool handleMouse(TMouseEvent event, TMouseButton button) override;
45  bool isFocused();
46 
47  DECLARE_PERSISTENT(UIObject, BaseObject)
48  UIObject *_parent;
49  bool display() override { return display(0, 0); }
50  virtual bool display(int offsetX) { return display(offsetX, 0); }
51  virtual bool display(int offsetX, int offsetY);
52  virtual void correctSize();
53  void setText(const char *text);
54 
55  UIObject(BaseGame *inGame = nullptr);
56  ~UIObject() override;
57  void setListener(BaseScriptHolder *object, BaseScriptHolder *listenerObject, uint32 listenerParam);
58  BaseScriptHolder *getListener() const;
59 
60  UIObject *_focusedWidget;
61  bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
62 
63  // scripting interface
64  ScValue *scGetProperty(const Common::String &name) override;
65  bool scSetProperty(const char *name, ScValue *value) override;
66  bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
67  const char *scToString() override;
68  TUIObjectType _type;
69 
70  int32 getWidth() const;
71  int32 getHeight() override;
72  void setHeight(int32 height);
73  void setWidth(int32 width);
74  bool isDisabled() const;
75  void setDisabled(bool disable);
76  bool isVisible() const;
77  void setVisible(bool visible);
78  bool hasSharedFonts() const;
79  void setSharedFonts(bool shared);
80  bool hasSharedImages() const;
81  void setSharedImages(bool shared);
82  BaseSprite *getImage() const;
83  void setImage(BaseSprite *image);
84  void setFont(BaseFont *font);
85  BaseFont *getFont();
86  bool canFocus() const;
87 
88 protected:
89  BaseScriptHolder *_listenerParamObject;
90  uint32 _listenerParamDWORD;
91  BaseScriptHolder *_listenerObject;
92  BaseSprite *_image;
93  BaseFont *_font;
94  bool _sharedFonts;
95  bool _sharedImages;
96  char *_text;
97  bool _visible;
98  bool _disable;
99  int32 _width;
100  int32 _height;
101  bool _canFocus;
102  bool _parentNotify;
103  UITiledImage *_back;
104 };
105 
106 } // End of namespace Wintermute
107 
108 #endif
Definition: script.h:44
Definition: base_game.h:75
Definition: script_value.h:42
Definition: str.h:59
Definition: base_dynamic_buffer.h:35
Definition: script_stack.h:41
Definition: base_script_holder.h:37
Definition: base_font.h:37
Definition: ui_tiled_image.h:37
Definition: base_sprite.h:40
Definition: base_object.h:57
Definition: achievements_tables.h:27
Definition: ui_object.h:39