message_box

A simple message box for the D programming language

It should work without requiring any 3rd party GUI toolkits. But will work with what it can find on your OS at runtime.

It tries to use the following:

* DlangUI (win32 on Windows or SDL2 on Linux)

* SDL_ShowSimpleMessageBox (Derelict SDL2)

* MessageBoxW (Windows)

* Zenity (Gtk/Gnome)

* Kdialog (KDE)

* gxmessage (X11)

Home page: https://github.com/workhorsy/d-message-box

Members

Classes

MessageBox
class MessageBox

The MessageBox class

MessageBoxBase
class MessageBoxBase
Undocumented in source.

Enums

IconType
enum IconType

The type of icon to show in the message box. Some message boxes will not show the icon.

Functions

getUseLog
bool getUseLog()

Returns if external program logging is on or off.

setUseLog
void setUseLog(bool is_logging)

If true will print output of external program to console.

Mixin templates

RUN_MAIN
mixintemplate RUN_MAIN()

This should be called once at the start of a program. It generates the proper main function for your environment (win32/posix/dmain) and boot straps the main loop for the GUI. This will call your UIAppMain function when ready.

Variables

is_sdl2_loadable
bool is_sdl2_loadable;
Undocumented in source.
use_log
bool use_log;
Undocumented in source.

Examples

import std.stdio : stdout, stderr;
import message_box : MessageBox, IconType, RUN_MAIN;

mixin RUN_MAIN;

extern (C) int UIAppMain(string[] args) {
	// Create the message box
	auto dialog = new MessageBox("Party Time", "The roof is on fire!", IconType.Warning);

	// Set the error handler
	dialog.onError((Throwable err) {
		stderr.writefln("Failed to show message box: %s", err);
	});

	// Show the message box
	dialog.show();

	return 0;
}

Meta

Version

0.3.0

License

Boost Software License - Version 1.0