HomeForumSourceResearchGuide
Sign in to contribute to source. how it works
Type definition file ui.IOWindow by barry
expand copy to clipboardexpand
uses Rect2D
uses Line2D
uses Color
uses Point2D
uses media.PixelMap
uses media.WH
uses Font
uses Rect
uses Point
uses Cursor

/* {"description" : "Data type to describe a mouse event. This event is emitted for application-level windows to notify them of mouse events."} */
data MouseEvent	{
	/* {"@description" : "The sub-type of mouse event."} */
	int type
	
	/* {"@description" : "The mouse button (if any)."} */
	int button
	/* {"@description" : "The x-position of the mouse pointer."} */
	int x
	/* {"@description" : "The y-position of the mouse pointer."} */
	int y

	/* {"@description" : "Additional event data."} */
	int exd1
	/* {"@description" : "Additional event data."} */
	int exd2
	}

/* {"description" : "Data type to describe a key event. This event is emitted for application-level windows to notify them of keyboard events."} */
data KeyEvent {
	/* {"@description" : "The key code of the key associated with this event."} */
	int keyCode
	}

/* {"description" : "Data type to describe a file-drop event. This event is emitted for application-level windows to notify them of drop events."} */
data DropEvent {
	/* {"@description" : "The x-position of the mouse pointer at the moment the drop event occurred."} */
	int x
	/* {"@description" : "The y-position of the mouse pointer at the moment the drop event occurred."} */
	int y
	/* {"@description" : "The file path associated with the drop event."} */
	char path[]
	}

/* {"description" : "IOLayer is the system API to control an OS-level window and interpret its events. This API is not normally used directly by the programmer. To create graphical windows, you would usually use an application-level wrapper of this API such as ui.Window."} */
interface IOWindow extends Canvas {

	/* {"@description" : "A value for setCursor() to select the system-default mouse cursor."} */
	const byte CURSOR_DEFAULT = 0
	/* {"@description" : "A value for setCursor() to hide the mouse cursor."} */
	const byte CURSOR_HIDDEN = 1
	/* {"@description" : "A value for setCursor() to select a custom mouse cursor, alongside a pixel map."} */
	const byte CURSOR_CUSTOM = 2
	/* {"@description" : "A value for setCursor() to select an I-beam (often used in text areas)."} */
	const byte CURSOR_IBEAM = 3
	/* {"@description" : "A value for setCursor() to select a hand."} */
	const byte CURSOR_HAND = 4
	/* {"@description" : "A value for setCursor() to select a 'wait for something' cursor."} */
	const byte CURSOR_WAIT = 5
	/* {"@description" : "A value for setCursor() to select a north-south arrow."} */
	const byte CURSOR_SIZENS = 6
	/* {"@description" : "A value for setCursor() to select a west-east arrow."} */
	const byte CURSOR_SIZEWE = 7
	/* {"@description" : "A value for setCursor() to select a north-west-south-east arrow."} */
	const byte CURSOR_SIZENWSE = 8
	/* {"@description" : "A value for setCursor() to select a north-east-south-west arrow."} */
	const byte CURSOR_SIZENESW = 9
	/* {"@description" : "A value for setCursor() to select an every-direction arrow."} */
	const byte CURSOR_SIZEALL = 10
	
	/* {"@description" : "A mouse up event, emitted for application-level windows."} */
	event mouseUp(MouseEvent m)
	/* {"@description" : "A mouse down event, emitted for application-level windows."} */
	event mouseDown(MouseEvent m)
	/* {"@description" : "A mouse move event, emitted for application-level windows."} */
	event mouseMove(MouseEvent m)
	/* {"@description" : "A mouse wheel event, emitted for application-level windows."} */
	event mouseWheel(MouseEvent m)
	/* {"@description" : "A key up event, emitted for application-level windows."} */
	event keyUp(KeyEvent k)
	/* {"@description" : "A key down event, emitted for application-level windows."} */
	event keyDown(KeyEvent k)
	/* {"@description" : "A file drop event, emitted for application-level windows."} */
	event fileDrop(DropEvent d)
	/* {"@description" : "A window resize event, emitted for application-level windows."} */
	event resizeWindow(WH size)
	/* {"@description" : "A window move event, emitted for application-level windows."} */
	event moveWindow(Point position)
	/* {"@description" : "A window close event, emitted for application-level windows."} */
	event closeWindow()
	
	/* {"@description" : "Initialise a new OS-level window."} */
	IOWindow()
	
	/* {"@description" : "Hide/show the window."} */
	void setVisible(bool v)
	
	/* {"@description" : "Set the window as user-resizeable or not."} */
	void setResizable(bool v)
	
	/* {"@description" : "Set the window as full-screen or not."} */
	void setFullScreen(bool v)
	
	/* {"@description" : "Set the title of the window."} */
	void setTitle(char title[])
	
	/* {"@description" : "Set the image used for the icon of the window."} */
	void setIcon(store PixelMap p)
	
	/* {"@description" : "Set the x/y position of the window on the screen."} */
	void setPosition(int x, int y)
	
	/* {"@description" : "Set the width and height of the window."} */
	void setSize(int w, int h)
	
	/* {"@description" : "Set the background color of the window."} */
	void setBackground(store Color c)

	/* {"@description" : "Set the current mouse cursor of the window, using one of the CURSOR_ constants."} */
	void setCursor(byte cursorType, opt Cursor c)
	
	/* {"@description" : "Get the screen resolution of the display on which the window resides."} */
	WH getResolution()
	
	/* {"@description" : "Repaint the window and its contents."} */
	void paint()

	/* {"@description" : "Get the window's rendered content as a pixel map."} */
	PixelMap getPixels()
	
	/* {"@description" : "Close the window (other functions on this API will not work after this)."} */
	void close()
	}
Revision history
To propose a new revision to this entity, use dana source put -ut your/new/version.dn -n ui.IOWindow -m "reason for update" -u yourUsername
Version 2 (this version) by barry
Notes for this version: Updates to documentation strings.
Version 1 by barry