22 #ifndef AGS_SHARED_GUI_GUI_OBJECT_H 23 #define AGS_SHARED_GUI_GUI_OBJECT_H 25 #include "ags/shared/core/types.h" 26 #include "ags/shared/gfx/bitmap.h" 27 #include "ags/shared/gui/gui_defines.h" 28 #include "ags/shared/util/string.h" 29 #include "ags/globals.h" 38 enum LegacyGUIAlignment {
39 kLegacyGUIAlign_Left = 0,
40 kLegacyGUIAlign_Right = 1,
41 kLegacyGUIAlign_Center = 2
49 String GetScriptName()
const;
51 String GetEventArgs(
int event)
const;
52 int GetEventCount()
const;
53 String GetEventName(
int event)
const;
54 bool IsClickable()
const {
return (Flags & kGUICtrl_Clickable) != 0; }
55 bool IsDeleted()
const {
return (Flags & kGUICtrl_Deleted) != 0; }
56 bool IsEnabled()
const {
return (Flags & kGUICtrl_Enabled) != 0; }
57 bool IsTranslated()
const {
return (Flags & kGUICtrl_Translated) != 0; }
58 bool IsVisible()
const {
return (Flags & kGUICtrl_Visible) != 0; }
60 virtual bool IsOverControl(
int x,
int y,
int leeway)
const;
61 Size GetSize()
const {
return Size(_width, _height); }
62 int GetWidth()
const {
return _width; }
63 int GetHeight()
const {
return _height; }
64 int GetTransparency()
const {
return _transparency; }
66 virtual bool IsContentClipped()
const {
return true; }
68 virtual bool HasAlphaChannel()
const {
return false; }
73 virtual Rect CalcGraphicRect(
bool ) {
74 return RectWH(0, 0, _width, _height);
76 virtual void Draw(
Bitmap *ds,
int x = 0,
int y = 0) {
77 (void)ds; (void)x; (void)y;
79 void SetClickable(
bool on);
80 void SetEnabled(
bool on);
81 void SetSize(
int width,
int height);
82 inline void SetWidth(
int width) { SetSize(width, _height); }
83 inline void SetHeight(
int height) { SetSize(_width, height); }
84 void SetTranslated(
bool on);
85 void SetVisible(
bool on);
86 void SetTransparency(
int trans);
90 virtual void OnKeyPress(
const KeyInput &) {}
92 virtual bool OnMouseDown() {
96 virtual void OnMouseEnter() {
99 virtual void OnMouseLeave() {
102 virtual void OnMouseMove(
int ,
int ) {
105 virtual void OnMouseUp() {
108 virtual void OnResized() { MarkPositionChanged(
true); }
111 virtual void ReadFromFile(
Shared::Stream *in, GuiVersion gui_version);
113 virtual void ReadFromSavegame(
Shared::Stream *in, GuiSvgVersion svg_ver);
123 void MarkParentChanged();
125 void MarkPositionChanged(
bool self_changed);
127 void MarkStateChanged(
bool self_changed,
bool parent_changed);
128 bool HasChanged()
const {
return _hasChanged; };
140 String EventHandlers[MAX_GUIOBJ_EVENTS];
146 int32_t _transparency;
151 int32_t _scEventCount;
152 String _scEventNames[MAX_GUIOBJ_EVENTS];
153 String _scEventArgs[MAX_GUIOBJ_EVENTS];
157 HorAlignment ConvertLegacyGUIAlignment(LegacyGUIAlignment align);
158 LegacyGUIAlignment GetLegacyGUIAlignment(HorAlignment align);
167 return (_G(all_buttons_disabled) < 0) && g->IsEnabled();
Definition: achievements_tables.h:27
Definition: allegro_bitmap.h:44
Definition: gui_object.h:44
Definition: geometry.h:219
Definition: geometry.h:148