Class SDLWindow
Constructors
| Name | Description |
|---|---|
this
(platform, caption, parent, flags, width, height)
|
Fields
| Name | Type | Description |
|---|---|---|
_children
|
SDLWindow[] | |
_drawbuf
|
DrawBuf | |
_keyFlags
|
uint | |
_lastRedrawEventCode
|
uint | |
_parent
|
SDLWindow | |
_platform
|
SDLPlatform | |
_renderer
|
sdl | |
_texture
|
sdl | |
_txh
|
int | |
_txw
|
int | |
_win
|
sdl | |
lastFlags
|
ushort | |
lastx
|
short | |
lasty
|
short | |
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 |
_caption
|
dstring | |
_cursorMap
|
sdl | |
_lastCursorType
|
uint | |
_lbutton
|
ButtonDetails | |
_mbutton
|
ButtonDetails | |
_rbutton
|
ButtonDetails | |
_actionsUpdateRequested
|
bool | |
_animationActive
|
bool | |
_backgroundColor
|
uint | |
_caretRect
|
Rect | |
_caretReplace
|
bool | |
_currentContentHeight
|
int | |
_currentContentWidth
|
int | |
_dx
|
int | |
_dy
|
int | |
_eventList
|
EventList | |
_firstDrawCalled
|
bool | set when first draw is called: don't handle mouse/key input until draw (layout) is called |
_flags
|
uint | |
_focusedWidget
|
Widget | |
_focusStateToApply
|
State | |
_hScrollBar
|
ScrollBar | horizontal scrollbar control |
_keyboardModifiers
|
uint | |
_mainWidget
|
Widget | |
_minContentHeight
|
int | minimal good looking content height |
_minContentWidth
|
int | minimal good looking content width |
_mouseCaptureButtons
|
ushort | |
_mouseCaptureFocusedOut
|
bool | |
_mouseCaptureFocusedOutTrackMovements
|
bool | does current capture widget want to receive move events even if pointer left it |
_mouseCaptureWidget
|
Widget | widget 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
|
CursorType | Keep overrided cursor type or NotSet to get cursor from widget |
_popups
|
PopupWidget[] | |
_showPosition
|
ShowPosition | |
_timerQueue
|
dcanvas | |
_tooltip
|
Window | |
_vScrollBar
|
ScrollBar | vertical scrollbar control |
_windowOrContentResizeMode
|
WindowOrContentResizeMode | |
_windowRect
|
Rect | |
_windowState
|
WindowState |
Properties
| Name | Type | Description |
|---|---|---|
isActive[get]
|
bool | |
parentWindow[get]
|
Window | returns parent window |
windowCaption[get]
|
dstring | returns window caption |
windowCaption[set]
|
dstring | sets window caption |
windowIcon[set]
|
Ref!(dcanvas.graphics.drawbuf.DrawBuf) | sets window icon |
windowId[get]
|
uint | |
actionsUpdateRequested[get]
|
bool | |
backgroundColor[set]
|
uint | |
backgroundColor[get]
|
uint | |
caretRect[set]
|
Rect | blinking caret position (empty rect if no blinking caret) |
caretRect[get]
|
Rect | |
caretReplace[set]
|
bool | blinking caret is in Replace mode if true, insert mode if false |
caretReplace[get]
|
bool | |
flags[get]
|
uint | |
focusedWidget[get]
|
Widget | returns current focused widget |
height[get]
|
int | |
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]
|
Window | set 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]
|
Window | set handler for closing of window |
onFilesDropped[get]
|
void delegate(string[]) | get handler for files dropped to app window |
onFilesDropped[set]
|
Window | set handler for files dropped to app window |
overrideCursorType[get]
|
CursorType | Returns current window override cursor type or NotSet if not overriding. |
overrideCursorType[set]
|
CursorType | Allow override cursor for entire window. Set to CursorType.NotSet to remove cursor type overriding. |
showPosition[get]
|
ShowPosition | returns current window show position (don't care or parent center) |
showPosition[set]
|
ShowPosition | sets window position after show (don't care or parent center) |
width[get]
|
int | |
windowOrContentResizeMode[get]
|
WindowOrContentResizeMode | |
windowOrContentResizeMode[set]
|
WindowOrContentResizeMode | |
windowRect[get]
|
Rect | returns window rectangle on screen (includes window frame and title) |
windowState[get]
|
WindowState | returns current window state |
Methods
| Name | Description |
|---|---|
close
()
|
close window |
convertKeyCode
(keyCode)
|
|
convertKeyFlags
(flags)
|
|
convertMouseButton
(button)
|
|
convertMouseFlags
(flags)
|
|
create
(flags)
|
|
doResize
(width, height)
|
|
fixSize
()
|
|
handleTimer
(timerId)
|
|
invalidate
()
|
request window redraw |
isNumLockEnabled
()
|
|
postEvent
(event)
|
post event to handle in UI thread (this method can be used from background thread) |
processExpose
()
|
|
processKeyEvent
(action, keyCodeIn, flags)
|
|
processMouseEvent
(action, button, state, x, y)
|
|
processRedrawEvent
(code)
|
|
processTextInput
(s)
|
|
redraw
()
|
|
scheduleAnimation
()
|
after drawing, call to schedule redraw if animation is active |
setWindowState
(newState, activate, newWindowRect)
|
change window state, position, or size; returns true if successful, false if not supported by platform |
show
()
|
show window |
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 |
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 |
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 |
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 |
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 |
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 |
createContext
(versionMajor, versionMinor)
|
|
handleWindowActivityChange
(isWindowActive)
|
|
handleWindowStateChange
(newState, newWindowRect)
|
update and signal window state and/or size/positon changes - for using in platform inplementations |
scheduleSystemTimer
(intervalMillis)
|
schedule timer for interval in milliseconds - call window.onTimer when finished |
setCursorType
(cursorType)
|
sets cursor type for window |
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 |
onTimer
()
|
system timer interval expired - notify queue |
removeFocus
()
|
|
sendAndCheckOverride
(widget, event)
|
|
setCaptureWidget
(w, event)
|
Inner structs
| Name | Description |
|---|---|
TooltipInfo
|
Aliases
| Name | Description |
|---|---|
~this
|