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

data MouseEvent	{
	int type
	
	int button
	int x
	int y

	int exd1
	int exd2
	}

data KeyEvent {
	int keyCode
	}

data DropEvent {
	int x
	int y
	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 {

	const byte CURSOR_DEFAULT = 0
	const byte CURSOR_HIDDEN = 1
	const byte CURSOR_CUSTOM = 2
	const byte CURSOR_IBEAM = 3
	const byte CURSOR_HAND = 4
	const byte CURSOR_WAIT = 5
	const byte CURSOR_SIZENS = 6
	const byte CURSOR_SIZEWE = 7
	const byte CURSOR_SIZENWSE = 8
	const byte CURSOR_SIZENESW = 9
	const byte CURSOR_SIZEALL = 10
	
	event mouseUp(MouseEvent m)
	event mouseDown(MouseEvent m)
	event mouseMove(MouseEvent m)
	event mouseWheel(MouseEvent m)
	event keyUp(KeyEvent k)
	event keyDown(KeyEvent k)
	event fileDrop(DropEvent d)
	event resizeWindow(WH size)
	event moveWindow(Point position)
	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."} */
	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 by barry
Version 1 (this version) by barry
Notes for this version: Standard Library Initialisation