DlangUI

Cross Platform GUI for D programming language

Home API Docs Screenshots Download .zip View on GitHub

dlangui.core.events

This module contains dlangui event types declarations.

Synopsis:
import dlangui.core.events;



License:
Boost License 1.0

Authors:
Vadim Lopatin, coolreader.org@gmail.com

struct Accelerator;
keyboard accelerator (key + modifiers)

@property dstring label();
returns accelerator text description

class Action;
UI action

@property string stringParam();
additional string parameter

@property long longParam();
additional long parameter

@property Object objectParam();
additional custom (Object) parameter

this(Action a);
deep copy constructor

@property Action clone();
deep copy

this(int id);
create action only with ID

this(int id, uint keyCode, uint keyFlags = 0);
action with accelerator, w/o label

this(int id, dstring label, string iconResourceId = null, uint keyCode = 0, uint keyFlags = 0);
action with label, icon, and accelerator

@property Accelerator[] accelerators();
returs array of accelerators

@property dstring acceleratorText();
returns text description for first accelerator of action; null if no accelerators

bool checkAccelerator(uint keyCode, uint keyFlags);
returns true if accelerator matches provided key code and flags

enum MouseAction: ubyte;
mouse action

Cancel
button down handling is cancelled

ButtonDown
button is down

ButtonUp
button is up

Move
mouse pointer is moving

FocusIn
pointer is back inside widget while button is down after FocusOut

FocusOut
pointer moved outside of widget while button was down (if handler returns true, Move events will be sent even while pointer is outside widget)

Wheel
scroll wheel movement

Leave
pointer left widget which has before processed Move message, while button was not down

enum MouseFlag: ushort;
mouse flag bits

LButton
Left mouse button is down

MButton
Middle mouse button is down

RButton
Right mouse button is down

XButton1
X1 mouse button is down

XButton2
X2 mouse button is down

Control
Ctrl key is down

Shift
Shift key is down

Alt
Alt key is down

enum MouseButton: ubyte;
mouse button

None
no button

Left
left mouse button

Right
right mouse button

Middle
right mouse button

XButton1
additional mouse button 1

XButton2
additional mouse button 2

struct ButtonDetails;
mouse button state details

long _downTs;
Clock.currStdTime() for down event of this button (0 if button is up).

long _upTs;
Clock.currStdTime() for up event of this button (0 if button is still down).

short _downX;
x coordinates of down event

short _downY;
y coordinates of down event

ushort _downFlags;
mouse button flags when down event occured

void down(short x, short y, ushort flags);
update for button down

void up(short x, short y, ushort flags);
update for button up

@property int downDuration();
returns button down state duration in hnsecs (1/10000 of second).

class MouseEvent;
mouse event

@property MouseButton button();
button which caused ButtonUp or ButtonDown action

@property MouseAction action();
action

@property ushort flags();
flags (buttons and keys state)

@property short wheelDelta();
delta for Wheel event

@property short x();
x coordinate of mouse pointer (relative to window client area)

@property short y();
y coordinate of mouse pointer (relative to window client area)

@property Widget trackingWidget();
get event tracking widget to override

void track(Widget w);
override mouse tracking widget

enum KeyAction: uint;
KeyEvent action

KeyDown
key is pressed

KeyUp
key is released

Text
text is entered

Repeat
repeated key down

enum KeyFlag: uint;
KeyEvent flags

Control
Ctrl key is down

Shift
Shift key is down

Alt
Alt key is down

RControl
Right Ctrl key is down

RShift
Right Shift key is down

RAlt
Right Alt key is down

LControl
Left Ctrl key is down

LShift
Left Shift key is down

LAlt
Left Alt key is down

enum KeyCode: uint;
Key code constants

class KeyEvent;
keyboard event

@property KeyAction action();
key action (KeyDown, KeyUp, Text, Repeat)

@property uint keyCode();
key code

@property uint flags();
flags (shift, ctrl, alt...)

@property dstring text();
entered text, for Text action

this(KeyAction action, uint keyCode, uint flags, dstring text = null);
create key event

enum ScrollAction: ubyte;
scroll bar / slider action

PageUp
space above indicator pressed

PageDown
space below indicator pressed

LineUp
up/left button pressed

LineDown
down/right button pressed

SliderPressed
slider pressed

SliderMoved
dragging in progress

SliderReleased
dragging finished

class ScrollEvent;
slider/scrollbar event

@property void position(int newPosition);
change position in event handler to update slider position

int defaultUpdatePosition();
default update position for actions like PageUp/PageDown, LineUp/LineDown

string keyName(uint keyCode);
converts key code to key name