24 #ifndef NUVIE_GUI_GUI_WIDGET_H 25 #define NUVIE_GUI_GUI_WIDGET_H 27 #include "ultima/nuvie/gui/gui_status.h" 28 #include "ultima/nuvie/gui/gui_drag_area.h" 29 #include "ultima/nuvie/gui/gui_drag_manager.h" 30 #include "ultima/nuvie/screen/screen.h" 31 #include "ultima/nuvie/core/events.h" 36 typedef GUI_status(*GUI_CallbackProc)(
void *data);
49 int offset_x, offset_y;
72 unsigned int mouseup[3];
73 unsigned int mousedown[3];
74 bool accept_mouseclick[3];
75 Shared::MouseButton delayed_button;
76 Shared::MouseButton held_button;
86 GUI_Widget(
void *data,
int x,
int y,
int w,
int h);
92 virtual void Show(
void);
95 virtual void Hide(
void);
98 virtual void Delete(
void);
100 virtual void MoveRelative(
int dx,
int dy);
101 virtual void Move(int32 new_x, int32 new_y);
102 void MoveRelativeToParent(
int dx,
int dy);
103 bool has_focus()
const {
107 virtual void release_focus();
111 virtual WIDGET_status Status(
void)
const;
116 virtual void SetRect(
int x,
int y,
int w,
int h);
125 virtual int X()
const {
128 virtual int Y()
const {
131 virtual int W()
const {
134 virtual int H()
const {
140 virtual int HitRect(
int x,
int y);
141 virtual int HitRect(
int x,
int y,
const Common::Rect &rect);
144 virtual void SetDisplay(
Screen *s);
150 virtual void Display(
bool full_redraw =
false);
151 void DisplayChildren(
bool full_redraw =
false);
154 virtual void Redraw(
void);
157 inline bool needs_redraw()
const {
158 return update_display;
161 bool widget_has_focus();
164 virtual GUI_status Idle(
void);
173 virtual GUI_status MouseDown(
int x,
int y, Shared::MouseButton button);
174 virtual GUI_status MouseUp(
int x,
int y, Shared::MouseButton button);
175 virtual GUI_status MouseMotion(
int x,
int y, uint8 state);
176 virtual GUI_status MouseWheel(sint32 x, sint32 y);
178 virtual GUI_status MouseEnter(uint8 state);
179 virtual GUI_status MouseLeave(uint8 state);
180 virtual GUI_status MouseClick(
int x,
int y, Shared::MouseButton button);
181 virtual GUI_status MouseDouble(
int x,
int y, Shared::MouseButton button);
182 virtual GUI_status MouseDelayed(
int x,
int y, Shared::MouseButton button);
183 virtual GUI_status MouseHeld(
int x,
int y, Shared::MouseButton button);
186 bool drag_accept_drop(
int x,
int y,
int message,
void *data)
override;
187 void drag_perform_drop(
int x,
int y,
int message,
void *data)
override;
200 inline virtual int ClickState(
int button) {
201 return pressed[button - 1];
205 inline virtual void SetClickState(
int button,
int value) {
206 if ((button > 0) && (button <= 3)) pressed[button - 1] = value;
211 void Init(
void *data,
int x,
int y,
int w,
int h);
216 void SetError(
char *fmt, ...) {
226 void set_accept_mouseclick(
bool set,
int button = 0);
227 void set_mouseup(
int set,
int button = 0);
228 void set_mousedown(
int set,
int button = 0);
229 int get_mouseup(
int button)
const {
230 if (button > 0 && button < 4)
return (mouseup[button - 1]);
233 int get_mousedown(
int button)
const {
234 if (button > 0 && button < 4)
return (mousedown[button - 1]);
237 void wait_for_mouseclick(
int button) {
238 if (button >= Shared::BUTTON_NONE && button < Shared::BUTTON_MIDDLE)
241 void wait_for_mousedown(
int button) {
242 if (button >= Shared::BUTTON_NONE && button <= Shared::BUTTON_MIDDLE)
245 virtual GUI_status try_mouse_delayed();
Definition: managed_surface.h:51
Definition: gui_drag_area.h:30
Definition: detection.h:27
MouseButton
Definition: events.h:183
int16 width() const
Definition: rect.h:191
int vsprintf_s(char *dst, size_t size, const char *format, va_list ap) GCC_PRINTF(3
int16 left
Definition: rect.h:145
Definition: containers.h:200
Definition: gui_drag_manager.h:36
Definition: keyboard.h:294
int16 height() const
Definition: rect.h:192