Class Window

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

class Window
  : CustomEventTarget;

Constructors

NameDescription
this ()

Fields

NameTypeDescription
mainWidgetChange Signal!(dcanvas.platforms.common.platform.OnMainWidgetChange)
PERFORMANCE_LOGGING_THRESHOLD_MS immutable(int)
windowActivityChanged Signal!(dcanvas.platforms.common.platform.OnWindowActivityHandler)window state change signal
windowStateChanged Signal!(dcanvas.platforms.common.platform.OnWindowStateHandler)window state change signal
_actionsUpdateRequested bool
_animationActive bool
_backgroundColor uint
_caretRect Rect
_caretReplace bool
_currentContentHeight int
_currentContentWidth int
_dx int
_dy int
_eventList EventList
_firstDrawCalled boolset when first draw is called: don't handle mouse/key input until draw (layout) is called
_flags uint
_focusedWidget Widget
_focusStateToApply State
_hScrollBar ScrollBarhorizontal scrollbar control
_keyboardModifiers uint
_mainWidget Widget
_minContentHeight intminimal good looking content height
_minContentWidth intminimal good looking content width
_mouseCaptureButtons ushort
_mouseCaptureFocusedOut bool
_mouseCaptureFocusedOutTrackMovements booldoes current capture widget want to receive move events even if pointer left it
_mouseCaptureWidget Widgetwidget which tracks all events after processed ButtonDown
_mouseTrackingWidgets Widget[]widget which tracks Move events
_onCanClose bool delegate()
_onClose void delegate()
_onFilesDropped void delegate(string[])
_overrideCursorType CursorTypeKeep overrided cursor type or NotSet to get cursor from widget
_popups PopupWidget[]
_showPosition ShowPosition
_timerQueue dcanvas.platforms.common.platform.Window.TimerQueue
_tooltip Window.TooltipInfo
_vScrollBar ScrollBarvertical scrollbar control
_windowOrContentResizeMode WindowOrContentResizeMode
_windowRect Rect
_windowState WindowState

Properties

NameTypeDescription
actionsUpdateRequested[get] bool
backgroundColor[get] uint
backgroundColor[set] uint
caretRect[set] Rectblinking caret position (empty rect if no blinking caret)
caretRect[get] Rect
caretReplace[set] boolblinking caret is in Replace mode if true, insert mode if false
caretReplace[get] bool
flags[get] uint
focusedWidget[get] Widgetreturns current focused widget
height[get] int
isActive[get] bool
isAnimationActive[get] bool
keyboardModifiers[get] uint
mainWidget[get] inout(Widget)
mainWidget[set] Widget
onCanClose[get] bool delegate()get handler for closing of app (it must return true to allow immediate close, false to cancel close or close window later)
onCanClose[set] Windowset handler for closing of app (it must return true to allow immediate close, false to cancel close or close window later)
onClose[get] void delegate()get handler for closing of window
onClose[set] Windowset handler for closing of window
onFilesDropped[get] void delegate(string[])get handler for files dropped to app window
onFilesDropped[set] Windowset handler for files dropped to app window
overrideCursorType[get] CursorTypeReturns current window override cursor type or NotSet if not overriding.
overrideCursorType[set] CursorTypeAllow override cursor for entire window. Set to CursorType.NotSet to remove cursor type overriding.
parentWindow[get] Windowreturns parent window
showPosition[get] ShowPositionreturns current window show position (don't care or parent center)
showPosition[set] ShowPositionsets window position after show (don't care or parent center)
width[get] int
windowCaption[get] dstringreturns window caption
windowCaption[set] dstringsets window caption
windowIcon[set] Ref!(dcanvas.graphics.drawbuf.DrawBuf)sets window icon
windowOrContentResizeMode[get] WindowOrContentResizeMode
windowOrContentResizeMode[set] WindowOrContentResizeMode
windowRect[get] Rectreturns window rectangle on screen (includes window frame and title)
windowState[get] WindowStatereturns current window state

Methods

NameDescription
activateWindow () just activate window
adjustWindowOrContentSize (minContentWidth, minContentHeight) Sets the minimal content size and adjust window or content should be called from window show
cancelEvent (uniqueId) remove event from queue by unique id if not yet dispatched (this method can be used from background thread)
cancelTimer (timerId) cancel previously scheduled widget timer (for timerId pass value returned from setTimer)
centerOnParentWindow () centers window on parent window, do nothing if there is no parent window
checkUpdateNeeded (needDraw, needLayout, animationActive) checks content widgets for necessary redraw and/or layout
close () close window
correctWindowPositionOnScreen (rect) check if window position inside screen bounds; try to correct if needed; returns true if position is ok.
createAsyncSocket (callback) Creates async socket
dispatchAction (action, sourceWidget) dispatch action to main widget
dispatchActionStateRequest (action, sourceWidget) dispatch action to main widget
dispatchCustomEvent (event) dispatch custom event
dispatchKeyEvent (event) dispatch keyboard event
dispatchMouseEvent (event) dispatch mouse event to window content widgets
dispatchThemeChanged () handle theme change: e.g. reload some themed resources
executeInUiThread (runnable) Schedule a delegate to run on the UI thread from a background thread.
handleCanClose () calls onCanClose handler if set to check if system may close window
handleDroppedFiles (filenames) called when user dragged file(s) to application window
handlePostedEvent (uniqueId) remove event from queue by unique id if not yet dispatched and dispatch it
handlePostedEvents () handle all events from queue, if any (call from UI thread only)
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 () hide tooltip if shown and cancel tooltip timer if set
hideWindow () restore window if maximized/minimized/hidden
invalidate () request window redraw
isChild (w) returns true if widget is child of either main widget, one of popups or window scrollbar
isMouseCaptured () returns true if mouse is currently captured
layout ()
maximizeWindow (activate) maximize window
measure ()
minimizeWindow () minimize window
modalPopup () returns last modal popup widget, or null if no modal popups opened
moveAndResizeWindow (rc, activate) set window rectangle
moveWindow (topLeft, activate) change window position only
onDraw (buf)
onResize (width, height)
pollTimers () poll expired timers; returns true if update is needed
postEvent (event) post event to handle in UI thread (this method can be used from background thread)
queueWidgetDestroy (widgetToDestroy) Allows queue destroy of widget.
removePopup (popup) remove popup
requestActionsUpdate (immediateUpdate) set action update request flag, will be cleared after redraw
requestLayout () requests layout for main widget and popups
resizeWindow (sz, activate) change window size only
restoreWindow (activate) restore window if maximized/minimized/hidden
restoreWindowState (setting) restore window state from setting object
saveWindowState (setting) save window state to setting object
scheduleAnimation () after drawing, call to schedule redraw if animation is active
scheduleTooltip (ownerWidget, delay, alignment, x, y) schedule tooltip for widget be shown with specified delay
setFocus (newFocus, reason) change focus to widget
setTimer (destination, intervalMillis) set timer for destination widget - destination.onTimer() will be called after interval expiration; returns timer id
setWindowState (newState, activate, newWindowRect) change window state, position, or size; returns true if successful, false if not supported by platform
show () show window
showInputBox (title, message, initialText, handler)
showInputBox (title, message, initialText, handler)
showMessageBox (title, message, actions, defaultActionIndex, handler) Show message box with specified title and message (title and message as dstring)
showMessageBox (title, message, actions, defaultActionIndex, handler) Show message box with specified title and message (title and message as UIString)
showPopup (content, anchor, alignment, x, y) show new popup
showTooltip (content, anchor, alignment, x, y) show tooltip immediately
update (force) requests update for window (unless force is true, update will be performed only if layout, redraw or animation is required).
updateWindowOrContentSize () update current content size based on windowOrContentResizeMode flag, usually used when window is resized
adjustPositionDuringShow () adjust window position during show()
applyFocus ()
checkUpdateNeeded (root, needDraw, needLayout, animationActive) checks content widgets for necessary redraw and/or layout
clearMouseCapture ()
dispatchCancel (event)
dispatchKeyEvent (root, event) dispatch key event to widgets which have wantsKeyTracking == true
dispatchMouseEvent (root, event, cursorIsSet)
dispatchWidgetUpdateActionStateRecursive (root) calls update actions recursively
dispatchWidgetUpdateActionStateRecursive () update action states
handleWindowActivityChange (isWindowActive)
handleWindowStateChange (newState, newWindowRect) update and signal window state and/or size/positon changes - for using in platform inplementations
onTimer () system timer interval expired - notify queue
removeFocus ()
scheduleSystemTimer (intervalMillis) schedule timer for interval in milliseconds - call window.onTimer when finished
sendAndCheckOverride (widget, event)
setCaptureWidget (w, event)
setCursorType (cursorType) sets cursor type for window

Inner structs

NameDescription
TooltipInfo

Aliases

NameDescription
~this