DlangUI

Cross Platform GUI for D programming language

Home API Docs Screenshots Download .zip View on GitHub

dlangui.platforms.common.platform

This module contains common Plaform definitions.

Platform is abstraction layer for application.



Synopsis:
import dlangui.platforms.common.platform;



License:
Boost License 1.0

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

enum WindowFlag: uint;
window creation flags

Resizable
window can be resized

Fullscreen
window should be shown in fullscreen mode

Modal
modal window - grabs input focus

abstract class Window;
Window abstraction layer. Widgets can be shown only inside window.

abstract @property dstring windowCaption();
returns window caption

abstract @property void windowCaption(dstring caption);
sets window caption

abstract @property void windowIcon(DrawBufRef icon);
sets window icon

void requestLayout();
requests layout for main widget and popups

PopupWidget showPopup(Widget content, Widget anchor = null, uint alignment = PopupAlign.Center, int x = 0, int y = 0);
show new popup

bool removePopup(PopupWidget popup);
remove popup

bool isChild(Widget w);
returns true if widget is child of either main widget or one of popups

void scheduleAnimation();
after drawing, call to schedule redraw if animation is active

@property Widget focusedWidget();
returns current focused widget

Widget setFocus(Widget newFocus);
change focus to widget

bool dispatchKeyEvent(KeyEvent event);
dispatch keyboard event

protected Widget[] _mouseTrackingWidgets;
widget which tracks Move events

protected Widget _mouseCaptureWidget;
widget which tracks all events after processed ButtonDown

protected bool _mouseCaptureFocusedOutTrackMovements;
does current capture widget want to receive move events even if pointer left it

bool isMouseCaptured();
returns true if mouse is currently captured

bool dispatchMouseEvent(MouseEvent event);
dispatch mouse event to window content widgets

protected void checkUpdateNeeded(Widget root, ref bool needDraw, ref bool needLayout, ref bool animationActive);
checks content widgets for necessary redraw and/or layout

protected void setCursorType(uint cursorType);
sets cursor type for window

bool checkUpdateNeeded(ref bool needDraw, ref bool needLayout, ref bool animationActive);
checks content widgets for necessary redraw and/or layout

void update(bool force = false);
requests update for window (unless force is true, update will be performed only if layout, redraw or animation is required).

abstract void invalidate();
request window redraw

abstract void close();
close window

abstract class Platform;
Platform abstraction layer.

Represents application.

abstract Window createWindow(dstring windowCaption, Window parent, uint flags = WindowFlag.Resizable);
create window

Args:
windowCaption = window caption text parent = parent Window, or null if no parent flags = WindowFlag bit set, combination of Resizable, Modal, Fullscreen

Window w/o Resizable nor Fullscreen will be created with size based on measurement of its content widget

abstract void closeWindow(Window w);
close window

Closes window earlier created with createWindow()

abstract int enterMessageLoop();
Starts application message loop.

When returned from this method, application is shutting down.

abstract dstring getClipboardText(bool mouseBuffer = false);
retrieves text from clipboard (when mouseBuffer == true, use mouse selection clipboard - under linux)

abstract void setClipboardText(dstring text, bool mouseBuffer = false);
sets text to clipboard (when mouseBuffer == true, use mouse selection clipboard - under linux)

abstract void requestLayout();
calls request layout for all windows

@property string uiLanguage();
returns currently selected UI language code

@property Platform uiLanguage(string langCode);
set UI language (e.g. "en", "fr", "ru") - will relayout content of all windows if language has been changed

@property Platform uiTheme(string themeResourceId);
sets application UI theme - will relayout content of all windows if theme has been changed

@property string[] resourceDirs();
returns list of resource directories

@property Platform resourceDirs(string[] dirs);
set list of directories to load resources from

@property Platform platform();
get current platform object instance

template APP_ENTRY_POINT()
put "mixin APP_ENTRY_POINT;" to main module of your dlangui based app

int WinMain(void* hInstance, void* hPrevInstance, char* lpCmdLine, int nCmdShow);
workaround for link issue when WinMain is located in library