33 #ifndef TBX_DRAGABLE_H_ 34 #define TBX_DRAGABLE_H_ 37 #include "mouseclicklistener.h" 42 class DragStartedListener;
43 class DragEndedListener;
52 enum {TOOLBOX_CLASS = 640};
193 bool adjust()
const {
return (_data.word[3] & 1) != 0;}
198 bool select()
const {
return (_data.word[3] & 4) != 0;}
203 bool shift()
const {
return (_data.word[3] & 8) != 0;}
207 bool control()
const {
return (_data.word[3] & 16) != 0;}
281 int x()
const {
return _data.word[6];}
286 int y()
const {
return _data.word[7];}
306 virtual void drag_ended(
const DragEndedEvent &drag_ended_event) = 0;
Draggable()
Construct an uninitialised draggable.
Definition: draggable.h:54
std::string sprite() const
Get name of sprite.
Definition: draggable.h:133
int text_length() const
Return length of text.
Definition: draggable.h:153
Class to store and fetch information about the WIMP mouse pointer.
Definition: pointerinfo.h:43
A library for creating RISC OS toolbox applications.
Definition: abouttobeshownlistener.cc:34
Draggable & operator=(const Component &other)
Assign a draggable to refer to the same underlying toolbox component as an existing Gadget...
Definition: draggable.h:109
void remove_drag_ended_listener(DragEndedListener *listener)
Remove listener for end of drag.
Definition: draggable.cc:80
void remove_drag_started_listener(DragStartedListener *listener)
Remove listener for start of drag.
Definition: draggable.cc:58
void sprite(std::string name)
Set name of sprite.
Definition: draggable.h:128
int x() const
x coordinate of drag finish
Definition: draggable.h:281
This is the base class for all Gadgets.
Definition: gadget.h:48
ObjectId handle() const
Return the object handle for his component.
Definition: component.h:95
void check_toolbox_class(int class_id) const
Check the underlying gadget class for this object has the given class id.
Definition: gadget.cc:47
Structure holding the raw data from a call to Wimp_Poll.
Definition: pollinfo.h:71
Listener for DragStarted events.
Definition: draggable.h:214
int ComponentId
Type for underlying toolbox component id.
Definition: handles.h:33
Listener for DragStarted events.
Definition: draggable.h:297
WindowHandle window_handle() const
Returns WIMP Window handle if toolbox_ids if false.
Definition: draggable.h:271
bool control() const
return true if control is held down
Definition: draggable.h:207
DragStartedEvent(IdBlock &id_block, PollBlock &data)
Construct a drag started event from the information returned for the toolbox.
Definition: draggable.h:187
int WindowHandle
Type for WIMP windows handle.
Definition: handles.h:35
bool selected() const
Get selected state of draggable.
Definition: draggable.h:163
void add_drag_ended_listener(DragEndedListener *listener)
Add listener for end of drag.
Definition: draggable.cc:72
Object object() const
Returns toolbox object at end of drag if toolbox_ids is true.
Definition: draggable.h:259
std::string string_property(int property_id) const
Get a string property from the toolbox object.
Definition: component.cc:261
Base class for components in an object.
Definition: component.h:42
int y() const
y coordinate of drag finish
Definition: draggable.h:286
Event information for Drag started event.
Definition: draggable.h:177
unsigned int ObjectId
Type for underlying toolbox object id.
Definition: handles.h:31
void remove_mouse_click_listener(MouseClickListener *listener)
Remove listener for mouse click on the button.
Definition: draggable.cc:96
void add_drag_started_listener(DragStartedListener *listener)
Add listener for start of drag.
Definition: draggable.cc:50
bool bool_property(int property_id) const
Get a boolean property from the toolbox Component.
Definition: component.cc:214
ComponentId id() const
Get the component ID of this component.
Definition: component.h:103
Listener for mouse clicks on a Window.
Definition: mouseclicklistener.h:129
bool toolbox_ids() const
Returns true if toolbox ids are returned at end of drag.
Definition: draggable.h:252
Draggable(const Gadget &other)
Construct a draggable from another gadget.
Definition: draggable.h:78
DragEndedEvent(IdBlock &id_block, PollBlock &data)
Construct the event from the information returned by the toolbox.
Definition: draggable.h:245
int IconHandle
Type for WIMP icon handle.
Definition: handles.h:37
bool select() const
return true if select is held down
Definition: draggable.h:198
void selected(bool value)
Set selected state of draggable.
Definition: draggable.h:158
The Window object represents a toolbox window.
Definition: window.h:69
Class to provide information on a toolbox event.
Definition: eventinfo.h:48
Base class for all toolbox event listeners.
Definition: listener.h:33
A Draggable is a gadget that shows.
Definition: draggable.h:49
int sprite_length() const
Return length of sprite name.
Definition: draggable.h:138
Event information for Drag ended event.
Definition: draggable.h:236
std::string text() const
Get text.
Definition: draggable.h:148
bool operator==(const Gadget &other) const
Check if this draggable refers to the same underlying toolbox gadget as another gadget.
Definition: draggable.h:116
Component component() const
Return toolbox component at end of drag if toolbox_ids is true.
Definition: draggable.h:266
void text(std::string name)
Set text.
Definition: draggable.h:143
bool shift() const
return true if shift is held down
Definition: draggable.h:203
IconHandle icon_handle() const
Return WIMP icon handle if toolbox_ids is false.
Definition: draggable.h:276
Draggable(const Draggable &other)
Construct a draggable from another draggable.
Definition: draggable.h:67
Component()
Construct an uninitialised component.
Definition: component.h:55
ObjectId _handle
Underlying toolbox handle.
Definition: component.h:45
bool adjust() const
return true if adjust is held down
Definition: draggable.h:193
~Draggable()
Destroy a draggable gadget.
Definition: draggable.h:60
bool operator!=(const Gadget &other) const
Check if this draggable refers to the same underlying toolbox gadget as another gadget.
Definition: draggable.h:123
Draggable & operator=(const Gadget &other)
Assign a draggable to refer to the same underlying toolbox gadget as an existing Gadget.
Definition: draggable.h:100
Information passed back by the Toolbox with each toolbox event providing information on where the eve...
Definition: pollinfo.h:41
int _id
Underlying toolbox component id.
Definition: component.h:46
Class to manipulate a toolbox object.
Definition: object.h:50
void add_mouse_click_listener(MouseClickListener *listener)
Add listener for mouse click on the button.
Definition: draggable.cc:88
Draggable & operator=(const Draggable &other)
Assign a draggable to refer to the same underlying toolbox gadget as another.
Definition: draggable.h:92
int string_property_length(int property_id) const
Get a the length of a string property from the toolbox object.
Definition: component.cc:302
Draggable(const Component &other)
Construct a draggable from a component.
Definition: draggable.h:86