uses GraphicsObject
uses Rect
uses MouseButtons
/* {"description" : "Data type describing an individual context menu item."} */
data MenuItem {
/* {"@description" : "The text name of this menu item."} */
char name[]
/* {"@description" : "The hot key help displayed on the menu."} */
char hotkey[]
}
/* {"description" : "Data type describing the items in a context menu, and the relative position at which to render that menu."} */
data ContextMenuSpec {
/* {"@description" : "The x-position of the top-left of this context menu, relative to the graphics object which has requested the menu."} */
int xAnchor
/* {"@description" : "The y-position of the top-left of this context menu, relative to the graphics object which has requested the menu."} */
int yAnchor
/* {"@description" : "The list of menu items to display on the context menu."} */
MenuItem items[]
/* {"@description" : "The object to which the menu belongs (this does not need to be set by the originating object, it is set as appropriate by the windowing framework)."} */
ClickableObject owner
}
/* {"description" : "Data type describing the details of a multi-click (such as a double-click) event."} */
data MultiClickData {
/* {"@description" : "The number of clicks that occurred."} */
int clicks
}
/* {"description" : "Data type describing a hot key which is active when a graphics object has focus."} */
data HotKey {
/* {"@description" : "The key modifier for the hot key, which is a bitwise-or of values from KeyState."} */
byte modifier
/* {"@description" : "The hardware-independent key code for this hot key, from os.KeyCode."} */
int keyCode
}
/*
{"description" : "A graphical entity that can be clicked on (e.g. with a mouse) triggering click events to any registered listeners."}
*/
interface ClickableObject extends GraphicsObject{
transfer bool disabled
/* {"@description" : "This application-level event is fired when a user clicks on this object."} */
event click()
/* {"@description" : "This application-level event is fired when a user clicks on this object."} */
event clickMulti(MultiClickData d)
/* {"@description" : "This event is intended for the windowing system only, and is fired when the object requests a context menu to be displayed."} */
event contextMenuOn(ContextMenuSpec menu)
/* {"@description" : "This event is intended for the windowing system only, and is fired when the object requests a context menu to be hidden."} */
event contextMenuOff()
/* {"@description" : "This event is intended for the windowing system only, and is fired when the object is changing its hot key list."} */
event setHotKeys()
/* {"@description" : "This event is intended for the windowing system only, and is fired when the object requests focus."} */
event requestFocus()
/* {"@description" : "Set whether this interact-able graphics entity is disabled (graphics entities are enabled by default)."} */
void setDisabled(bool d){disabled = d}
/* {"@description" : "Get the bounding rectangle for mouse click hit detection by the windowing system."} */
Rect getBounds()
/* {"@description" : "This function is called when the object receives a mouse click from the windowing system."} */
void click(int x, int y, int button)
/* {"@description" : "This function is called when the object receives a mouse click from the windowing system."} */
void clickMulti(int x, int y, int button, int clicks){}
/* {"@description" : "This function is called by the windowing system when a context menu item is clicked on."} */
void contextClick(MenuItem item){}
/* {"@description" : "This function can be called by an application to set this object as the one with focus."} */
void setFocus()
/* {"@description" : "This function is called by the windowing system when the object is being given focus. The function returns true or false depending on whether it not it is focusable."} */
bool recvFocus(){return false}
/* {"@description" : "This function is called by the windowing system to check which hotkeys the object has. It is always called immediately after recvFocus(), and may be called at other times."} */
HotKey[] getHotKeys(){return null}
/* {"@description" : "This function is called by the windowing system when the object is no longer given focus."} */
void loseFocus(){}
/* {"@description" : "This function is called by the windowing system when a hot key returned by recvFocus() is pressed."} */
void hotKeyClick(HotKey k){}
}
To propose a new revision to this entity, use dana source put -ut your/new/version.dn -n ui.ClickableObject -m "reason for update" -u yourUsername
Version 2 (this version) by barry
Notes for this version: Updates to documentation strings.