Rayerd/dfl — pull request #18 by shoo (2012-05-18 14:37:13+00:00)
Title: Add Hotkey API

Add Hotkey to Application

usage:
```d
import dfl.all;
pragma(lib, "dfl");

void main()
{
Application.enableVisualStyles();
auto form = new Form;
form.dockPadding.all = 5;

form.text = "Hotkey";

// ALT + SHIFT + A
Application.hotkeys[Keys.A | Keys.SHIFT | Keys.ALT] ~= (Object o, KeyEventArgs e)
{
form.text = "aaa";
form.backColor = Color.fromRgb(0x00ffffff);
};
// ALT + SHIFT + B
// using lambda
Application.hotkeys[Keys.B | Keys.SHIFT | Keys.ALT] ~= (o, e) => form.text = "bbb";
// 2nd closure
void changeColor(Object o, KeyEventArgs e)
{
form.backColor = Color.fromRgb(0x00ffff00);
};
Application.hotkeys[Keys.B | Keys.SHIFT | Keys.ALT] ~= &changeColor;
// CTRL + WIN + C
Application.hotkeys[Keys.C | Keys.CONTROL | Keys.WINDOWS] ~= (Object o, KeyEventArgs e)
{
form.text = "ccc";
// remove 2nd closure of "ALT + SHIFT + B"
Application.hotkeys.removeHandler(Keys.B | Keys.SHIFT | Keys.ALT, &changeColor);
};

Application.run(form);
}
```