TkdApplication

Base class of all Tkd gui applications.

Constructors

this
this()

constructor.

Members

Functions

addVirtualEvent
void addVirtualEvent(string virtualEvent, string binding)

Associates the virtual event with the binding, so that the virtual event will trigger whenever the binding occurs. Virtual events may be any string value and binding may have any of the values allowed for the binding argument of the bind method. If the virtual event is already defined, the new binding adds to the existing bindings for the event.

deleteVirtualEvent
void deleteVirtualEvent(string virtualEvent, string binding)

Deletes each of the bindings from those associated with the virtual event. Virtual events may be any string value and binding may have any of the values allowed for the binding argument of the bind method. Any bindings not currently associated with virtual events are ignored. If no binding argument is provided, all bindings are removed for the virtual event, so that the virtual event will not trigger anymore.

exit
void exit()

Exit the application.

initInterface
void initInterface()

All element creation and layout should take place within this method. This method is called by the constructor to create the initial GUI.

run
void run()

Run the application.

setTheme
void setTheme(string theme)

Set the overall theme of the user interface.

update
auto update()

This method is used to bring the application 'up to date' by entering the event loop repeatedly until all pending events (including idle callbacks) have been processed.

Properties

mainWindow
Window mainWindow [@property getter]

Get the main window of the application.

Examples

import tkd.tkdapplication;

class Application : TkdApplication
{
	private void exitCommand(CommandArgs args)
	{
		this.exit();
	}

	override protected void initInterface()
	{
		auto frame = new Frame(2, ReliefStyle.groove)
			.pack(10);

		auto label = new Label(frame, "Hello World!")
			.pack(10);

		auto exitButton = new Button(frame, "Exit")
			.setCommand(&this.exitCommand)
			.pack(10);
	}
}

void main(string[] args)
{
	auto app = new Application();
	app.run();
}

Meta