Window

Window abstraction layer. Widgets can be shown only inside window.

class Window : CustomEventTarget {}

Constructors

this
this()
Undocumented in source.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

activateWindow
bool activateWindow()

just activate window

adjustPositionDuringShow
void adjustPositionDuringShow()

adjust window position during show()

adjustWindowOrContentSize
void adjustWindowOrContentSize(int minContentWidth, int minContentHeight)

Sets the minimal content size and adjust window or content should be called from window show

applyFocus
Widget applyFocus()
Undocumented in source. Be warned that the author may not have intended to support it.
cancelEvent
void cancelEvent(uint uniqueId)

remove event from queue by unique id if not yet dispatched (this method can be used from background thread)

cancelTimer
void cancelTimer(ulong timerId)

cancel previously scheduled widget timer (for timerId pass value returned from setTimer)

centerOnParentWindow
void centerOnParentWindow()

centers window on parent window, do nothing if there is no parent window

checkUpdateNeeded
bool checkUpdateNeeded(bool needDraw, bool needLayout, bool animationActive)

checks content widgets for necessary redraw and/or layout

checkUpdateNeeded
void checkUpdateNeeded(Widget root, bool needDraw, bool needLayout, bool animationActive)

checks content widgets for necessary redraw and/or layout

clearMouseCapture
void clearMouseCapture()
Undocumented in source. Be warned that the author may not have intended to support it.
close
void close()

close window

correctWindowPositionOnScreen
bool correctWindowPositionOnScreen(Rect rect)

check if window position inside screen bounds; try to correct if needed; returns true if position is ok.

createAsyncSocket
AsyncSocket createAsyncSocket(AsyncSocketCallback callback)

Creates async socket

dispatchAction
bool dispatchAction(Action action, Widget sourceWidget)

dispatch action to main widget

dispatchActionStateRequest
bool dispatchActionStateRequest(Action action, Widget sourceWidget)

dispatch action to main widget

dispatchCancel
bool dispatchCancel(MouseEvent event)
Undocumented in source. Be warned that the author may not have intended to support it.
dispatchCustomEvent
bool dispatchCustomEvent(CustomEvent event)

dispatch custom event

dispatchKeyEvent
bool dispatchKeyEvent(Widget root, KeyEvent event)

dispatch key event to widgets which have wantsKeyTracking == true

dispatchKeyEvent
bool dispatchKeyEvent(KeyEvent event)

dispatch keyboard event

dispatchMouseEvent
bool dispatchMouseEvent(MouseEvent event)

dispatch mouse event to window content widgets

dispatchMouseEvent
bool dispatchMouseEvent(Widget root, MouseEvent event, bool cursorIsSet)
Undocumented in source. Be warned that the author may not have intended to support it.
dispatchThemeChanged
void dispatchThemeChanged()

handle theme change: e.g. reload some themed resources

dispatchWidgetUpdateActionStateRecursive
void dispatchWidgetUpdateActionStateRecursive()

update action states

dispatchWidgetUpdateActionStateRecursive
void dispatchWidgetUpdateActionStateRecursive(Widget root)

calls update actions recursively

executeInUiThread
void executeInUiThread(void delegate() runnable)

post task to execute in UI thread (this method can be used from background thread)

handleCanClose
bool handleCanClose()

calls onCanClose handler if set to check if system may close window

handleDroppedFiles
void handleDroppedFiles(string[] filenames)

called when user dragged file(s) to application window

handlePostedEvent
void handlePostedEvent(uint uniqueId)

remove event from queue by unique id if not yet dispatched and dispatch it

handlePostedEvents
void handlePostedEvents()

handle all events from queue, if any (call from UI thread only)

handleWindowActivityChange
void handleWindowActivityChange(bool isWindowActive)
Undocumented in source. Be warned that the author may not have intended to support it.
handleWindowStateChange
void handleWindowStateChange(WindowState newState, Rect newWindowRect)

update and signal window state and/or size/positon changes - for using in platform inplementations

hasModalWindowsAbove
bool hasModalWindowsAbove()

returns true if there is some modal window opened above this window, and this window should not process mouse/key input and should not allow closing

hideTooltip
void hideTooltip()

hide tooltip if shown and cancel tooltip timer if set

hideWindow
bool hideWindow()

restore window if maximized/minimized/hidden

invalidate
void invalidate()

request window redraw

isChild
bool isChild(Widget w)

returns true if widget is child of either main widget, one of popups or window scrollbar

isMouseCaptured
bool isMouseCaptured()

returns true if mouse is currently captured

layout
void layout()
Undocumented in source. Be warned that the author may not have intended to support it.
maximizeWindow
bool maximizeWindow(bool activate)

maximize window

measure
void measure()
Undocumented in source. Be warned that the author may not have intended to support it.
minimizeWindow
bool minimizeWindow()

minimize window

modalPopup
PopupWidget modalPopup()

returns last modal popup widget, or null if no modal popups opened

moveAndResizeWindow
bool moveAndResizeWindow(Rect rc, bool activate)

set window rectangle

moveWindow
bool moveWindow(Point topLeft, bool activate)

change window position only

onDraw
void onDraw(DrawBuf buf)
Undocumented in source. Be warned that the author may not have intended to support it.
onResize
void onResize(int width, int height)
Undocumented in source. Be warned that the author may not have intended to support it.
onTimer
void onTimer()

system timer interval expired - notify queue

pollTimers
bool pollTimers()

poll expired timers; returns true if update is needed

postEvent
void postEvent(CustomEvent event)

post event to handle in UI thread (this method can be used from background thread)

queueWidgetDestroy
void queueWidgetDestroy(Widget widgetToDestroy)

Allows queue destroy of widget.

removeFocus
Widget removeFocus()
Undocumented in source. Be warned that the author may not have intended to support it.
removePopup
bool removePopup(PopupWidget popup)

remove popup

requestActionsUpdate
void requestActionsUpdate(bool immediateUpdate)

set action update request flag, will be cleared after redraw

requestLayout
void requestLayout()

requests layout for main widget and popups

resizeWindow
bool resizeWindow(Point sz, bool activate)

change window size only

restoreWindow
bool restoreWindow(bool activate)

restore window if maximized/minimized/hidden

restoreWindowState
bool restoreWindowState(Setting setting)

restore window state from setting object

saveWindowState
void saveWindowState(Setting setting)

save window state to setting object

scheduleAnimation
void scheduleAnimation()

after drawing, call to schedule redraw if animation is active

scheduleSystemTimer
void scheduleSystemTimer(long intervalMillis)

schedule timer for interval in milliseconds - call window.onTimer when finished

scheduleTooltip
void scheduleTooltip(Widget ownerWidget, long delay, uint alignment, int x, int y)

schedule tooltip for widget be shown with specified delay

sendAndCheckOverride
bool sendAndCheckOverride(Widget widget, MouseEvent event)
Undocumented in source. Be warned that the author may not have intended to support it.
setCaptureWidget
void setCaptureWidget(Widget w, MouseEvent event)
Undocumented in source. Be warned that the author may not have intended to support it.
setCursorType
void setCursorType(uint cursorType)

sets cursor type for window

setFocus
Widget setFocus(Widget newFocus, FocusReason reason)

change focus to widget

setTimer
ulong setTimer(Widget destination, long intervalMillis)

set timer for destination widget - destination.onTimer() will be called after interval expiration; returns timer id

setWindowState
bool setWindowState(WindowState newState, bool activate, Rect newWindowRect)

change window state, position, or size; returns true if successful, false if not supported by platform

show
void show()

show window

showInputBox
void showInputBox(dstring title, dstring message, dstring initialText, void delegate(dstring result) handler)
Undocumented in source. Be warned that the author may not have intended to support it.
showInputBox
void showInputBox(UIString title, UIString message, dstring initialText, void delegate(dstring result) handler)
Undocumented in source. Be warned that the author may not have intended to support it.
showMessageBox
void showMessageBox(dstring title, dstring message, const(Action)[] actions, int defaultActionIndex, bool delegate(const Action result) handler)

Show message box with specified title and message (title and message as dstring)

showMessageBox
void showMessageBox(UIString title, UIString message, const(Action)[] actions, int defaultActionIndex, bool delegate(const Action result) handler)

Show message box with specified title and message (title and message as UIString)

showPopup
PopupWidget showPopup(Widget content, Widget anchor, uint alignment, int x, int y)

show new popup

showTooltip
PopupWidget showTooltip(Widget content, Widget anchor, uint alignment, int x, int y)

show tooltip immediately

update
void update(bool force)

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

updateWindowOrContentSize
void updateWindowOrContentSize()

update current content size based on windowOrContentResizeMode flag, usually used when window is resized

Properties

actionsUpdateRequested
bool actionsUpdateRequested [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
backgroundColor
uint backgroundColor [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
backgroundColor
uint backgroundColor [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
caretRect
Rect caretRect [@property setter]

blinking caret position (empty rect if no blinking caret)

caretRect
Rect caretRect [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
caretReplace
bool caretReplace [@property setter]

blinking caret is in Replace mode if true, insert mode if false

caretReplace
bool caretReplace [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
flags
uint flags [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
focusedWidget
Widget focusedWidget [@property getter]

returns current focused widget

height
int height [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
isActive
bool isActive [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
isAnimationActive
bool isAnimationActive [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
keyboardModifiers
uint keyboardModifiers [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
mainWidget
inout(Widget) mainWidget [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
mainWidget
Widget mainWidget [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
onCanClose
bool delegate() onCanClose [@property getter]

get handler for closing of app (it must return true to allow immediate close, false to cancel close or close window later)

onCanClose
bool delegate() onCanClose [@property setter]

set handler for closing of app (it must return true to allow immediate close, false to cancel close or close window later)

onClose
void delegate() onClose [@property getter]

get handler for closing of window

onClose
void delegate() onClose [@property setter]

set handler for closing of window

onFilesDropped
void delegate(string[]) onFilesDropped [@property getter]

get handler for files dropped to app window

onFilesDropped
void delegate(string[]) onFilesDropped [@property setter]

set handler for files dropped to app window

overrideCursorType
CursorType overrideCursorType [@property setter]

Allow override cursor for entire window. Set to CursorType.NotSet to remove cursor type overriding.

overrideCursorType
CursorType overrideCursorType [@property getter]

Returns current window override cursor type or NotSet if not overriding.

parentWindow
Window parentWindow [@property getter]

returns parent window

showPosition
ShowPosition showPosition [@property getter]

returns current window show position (don't care or parent center)

showPosition
ShowPosition showPosition [@property setter]

sets window position after show (don't care or parent center)

width
int width [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
windowCaption
dstring windowCaption [@property getter]

returns window caption

windowCaption
dstring windowCaption [@property setter]

sets window caption

windowIcon
DrawBufRef windowIcon [@property setter]

sets window icon

windowOrContentResizeMode
WindowOrContentResizeMode windowOrContentResizeMode [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
windowOrContentResizeMode
WindowOrContentResizeMode windowOrContentResizeMode [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
windowRect
Rect windowRect [@property getter]

returns window rectangle on screen (includes window frame and title)

windowState
WindowState windowState [@property getter]

returns current window state

Static variables

PERFORMANCE_LOGGING_THRESHOLD_MS
int PERFORMANCE_LOGGING_THRESHOLD_MS;
Undocumented in source.

Structs

TooltipInfo
struct TooltipInfo
Undocumented in source.

Variables

_actionsUpdateRequested
bool _actionsUpdateRequested;
Undocumented in source.
_animationActive
bool _animationActive;
Undocumented in source.
_backgroundColor
uint _backgroundColor;
Undocumented in source.
_caretRect
Rect _caretRect;
Undocumented in source.
_caretReplace
bool _caretReplace;
Undocumented in source.
_currentContentHeight
int _currentContentHeight;
Undocumented in source.
_currentContentWidth
int _currentContentWidth;
Undocumented in source.
_dx
int _dx;
Undocumented in source.
_dy
int _dy;
Undocumented in source.
_eventList
EventList _eventList;
Undocumented in source.
_firstDrawCalled
bool _firstDrawCalled;

set when first draw is called: don't handle mouse/key input until draw (layout) is called

_flags
uint _flags;
Undocumented in source.
_focusStateToApply
auto _focusStateToApply;
Undocumented in source.
_focusedWidget
Widget _focusedWidget;
Undocumented in source.
_hScrollBar
ScrollBar _hScrollBar;

horizontal scrollbar control

_keyboardModifiers
uint _keyboardModifiers;
Undocumented in source.
_mainWidget
Widget _mainWidget;
Undocumented in source.
_minContentHeight
int _minContentHeight;

minimal good looking content height

_minContentWidth
int _minContentWidth;

minimal good looking content width

_mouseCaptureButtons
ushort _mouseCaptureButtons;
Undocumented in source.
_mouseCaptureFocusedOut
bool _mouseCaptureFocusedOut;
Undocumented in source.
_mouseCaptureFocusedOutTrackMovements
bool _mouseCaptureFocusedOutTrackMovements;

does current capture widget want to receive move events even if pointer left it

_mouseCaptureWidget
Widget _mouseCaptureWidget;

widget which tracks all events after processed ButtonDown

_mouseTrackingWidgets
Widget[] _mouseTrackingWidgets;

widget which tracks Move events

_onCanClose
bool delegate() _onCanClose;
Undocumented in source.
_onClose
void delegate() _onClose;
Undocumented in source.
_onFilesDropped
void delegate(string[]) _onFilesDropped;
Undocumented in source.
_overrideCursorType
CursorType _overrideCursorType;

Keep overrided cursor type or NotSet to get cursor from widget

_popups
PopupWidget[] _popups;
Undocumented in source.
_showPosition
ShowPosition _showPosition;
Undocumented in source.
_timerQueue
TimerQueue _timerQueue;
Undocumented in source.
_tooltip
TooltipInfo _tooltip;
Undocumented in source.
_vScrollBar
ScrollBar _vScrollBar;

vertical scrollbar control

_windowOrContentResizeMode
WindowOrContentResizeMode _windowOrContentResizeMode;
Undocumented in source.
_windowRect
Rect _windowRect;
Undocumented in source.
_windowState
WindowState _windowState;
Undocumented in source.
mainWidgetChange
Signal!OnMainWidgetChange mainWidgetChange;
Undocumented in source.
windowActivityChanged
Signal!OnWindowActivityHandler windowActivityChanged;

window state change signal

windowStateChanged
Signal!OnWindowStateHandler windowStateChanged;

window state change signal

Inherited Members

From CustomEventTarget

postEvent
void postEvent(CustomEvent event)

post event to handle in UI thread (this method can be used from background thread)

executeInUiThread
void executeInUiThread(void delegate() runnable)

post task to execute in UI thread (this method can be used from background thread)

Meta