PanelWindowclass

An OS window whose entire contents are panel UI. It owns the window, its swap chain and the UI inside it. Its input comes straight from SDL and never touches the engine's input system - there's no widget toolkit involved anywhere. A popup is one that hangs off another, the way a menu does - see `Editor.PanelWindow.Popup(Editor.PanelWindow,Vector2,System.Boolean)`. Editor only. A game has one window and draws its UI into that. The window itself is the engine's internal `SurfaceWindow`; this is the public face of it for tools, and lives in Sandbox.Tools so game code can't open windows.

object→PanelWindow
Namespace
Editor
Assembly
Sandbox.Tools
Declaration
public class Editor.PanelWindow

Constructors4

Showing 4 constructors

Methods21

Showing 21 methods

public void BringToFront()PUBLIC

Raise the window above the others without taking focus. `Editor.PanelWindow.Focus` is the one that focuses it too.

Returns:void—

public virtual sealed void Dispose()PUBLICVIRTUAL

Close the window and delete its panels.

Returns:void—

public void FlashTaskbar(bool untilFocused = False)PUBLIC

Flash the taskbar button to get the user's attention. Briefly by default; until focused keeps going until they click the window.

ParameterTypeDescription
untilFocused = Falsebool—
Returns:void—

public void Focus()PUBLIC

Bring the window to the front.

Returns:void—

public static Editor.PanelWindow FromPanel(Sandbox.UI.Panel panel)PUBLICSTATIC

The window a panel is being shown in, if it's one of ours.

ParameterTypeDescription
panelPanel—
Returns:PanelWindow—

public void Hide()PUBLIC

Take the window off screen without closing it. Everything in it stays; `Editor.PanelWindow.Show` brings it back where it was.

Returns:void—

public void Maximize()PUBLIC

Fill the display.

Returns:void—

public void Minimize()PUBLIC

Minimize the window.

Returns:void—

public void MoveToCenter()PUBLIC

Centre the window on its `Editor.PanelWindow.Owner`, or on the usable part of its display when it has none. Either way it ends up on screen.

Returns:void—

public System.Threading.Tasks.Task`1<string> PickFolder(string defaultPath = null)PUBLIC

Ask the OS to pick a folder, starting at `defaultPath`. Null when the user cancels or the dialog fails. Call on the main thread. Any pending dialog is joined, including requests from other windows or for a different dialog kind.

ParameterTypeDescription
defaultPath = nullstring—
Returns:Task<string>—

public System.Threading.Tasks.Task`1<string> PickOpenFile(string defaultPath = null, string filters = null)PUBLIC

Ask the OS for a file to open. The filter is name and extension list pairs, like "Scene files|scene;prefab|All files|*". Null on cancellation or error. Call on the main thread. Joins any pending dialog, including another window or dialog kind.

ParameterTypeDescription
defaultPath = nullstring—
filters = nullstring—
Returns:Task<string>—

public System.Threading.Tasks.Task`1<string> PickSaveFile(string defaultPath = null, string filters = null)PUBLIC

Ask the OS where to save a file. `defaultPath` can end in a suggested file name. Filters as in `Editor.PanelWindow.PickOpenFile(System.String,System.String)`. Null on cancellation or error. Call on the main thread. Joins any pending dialog, including another window or dialog kind.

ParameterTypeDescription
defaultPath = nullstring—
filters = nullstring—
Returns:Task<string>—

public void RequestClose()PUBLIC

The user clicked the window's close button.

Returns:void—

public void SendToBack()PUBLIC

Put the window behind every other window. Focus stays where it is.

Returns:void—

public void SetIcon(Sandbox.Bitmap icon)PUBLIC

The icon in the title bar and on the taskbar button. The OS scales it, so 32 or 64 pixels square is plenty; it's copied, so the bitmap can go afterwards.

ParameterTypeDescription
iconBitmap—
Returns:void—

public void SetOverlayIcon(Sandbox.Bitmap icon, string description = null)PUBLIC

A small icon over the corner of the window's taskbar button - a badge for a count, a status. 16 pixels square is what the taskbar shows. Null clears it. The description is what a screen reader says for it.

ParameterTypeDescription
iconBitmap—
description = nullstring—
Returns:void—

public void Show()PUBLIC

Put a hidden window back on screen.

Returns:void—

public void SnapToDisplay()PUBLIC

Move the window the least distance that puts all of it on the usable part of its display. A window taller or wider than the display keeps its top left on screen.

Returns:void—

public void StopFlashing()PUBLIC

Stop a `Editor.PanelWindow.FlashTaskbar(System.Boolean)` that's still going.

Returns:void—

public void ToggleMaximized()PUBLIC

Maximize the window, or put it back if it already is.

Returns:void—

Properties51

Showing 51 properties

public static System.Collections.Generic.IReadOnlyList`1<Editor.PanelWindow> Editor.PanelWindow.All { get; set; }PUBLICSTATICGETSET

Every window that's currently open.

Returns:IReadOnlyList<PanelWindow>—

public bool Editor.PanelWindow.AllowNestedFrame { get; set; }PUBLICGETSET

Let frames run inside a frame that's already running - see IPanelWindow.

Returns:bool—

public bool Editor.PanelWindow.AlwaysFullFrameRate { get; set; }PUBLICGETSET

Keep drawing at the display's frame rate even when nobody is looking at this window. Idle windows are paced right down - set this for one with something moving in it that has to keep moving, like a video or a live preview.

Returns:bool—

public System.Nullable`1<float> Editor.PanelWindow.AspectRatioLock { get; set; }PUBLICGETSET

Hold the window at this width to height ratio while the user resizes it - 16f / 9 keeps a video window the shape of its video. Null lets it be any shape.

Returns:Nullable<float>—

public Color Editor.PanelWindow.BackgroundColor { get; set; }PUBLICGETSET

What the window clears to before the UI is drawn.

Returns:Color—

public bool Editor.PanelWindow.Borderless { get; set; }PUBLICGETSET

True if we're drawing the title bar and borders ourselves. Popups always are.

Returns:bool—

public bool Editor.PanelWindow.CanClose { get; set; }PUBLICGETSET

Whether the user can close the window: the caption button greys out and Alt+F4 does nothing. Code can still close it. Windows drawing their own chrome check this for their close button too.

Returns:bool—

public bool Editor.PanelWindow.CanMaximize { get; set; }PUBLICGETSET

Whether the OS is allowed to maximize the window - the caption button, double clicking the title bar, Win+Up, snap. Windows drawing their own chrome check this for their maximize button too.

Returns:bool—

public Sandbox.Rect Editor.PanelWindow.DisplayBounds { get; set; }PUBLICGETSET

The whole of the display the window is on, in the same desktop coordinates as `Editor.PanelWindow.Position`.

Returns:Rect—

public Sandbox.Rect Editor.PanelWindow.DisplayWorkArea { get; set; }PUBLICGETSET

The part of the window's display that isn't under the taskbar or a dock, in desktop coordinates.

Returns:Rect—

public bool Editor.PanelWindow.DropShadow { get; set; }PUBLICGETSET

Whether the compositor draws its shadow around the window. A decorated window has one from its frame; a borderless window or a popup has to ask, and both do by default.

Returns:bool—

public bool Editor.PanelWindow.ExclusiveFullscreen { get; set; }PUBLICGETSET

Whether `Editor.PanelWindow.Fullscreen` takes the display over with a real display mode, the way a game does, instead of a borderless window over the desktop. Off by default: borderless switches instantly and plays well with other windows and displays.

Returns:bool—

public static Editor.PanelWindow Editor.PanelWindow.Focused { get; set; }PUBLICSTATICGETSET

The window the OS is giving keyboard input to, if it's one of ours.

Returns:PanelWindow—

public bool Editor.PanelWindow.Fullscreen { get; set; }PUBLICGETSET

Fill the window's display. Borderless over the desktop unless `Editor.PanelWindow.ExclusiveFullscreen` is set. Turning it off puts the window back where it was.

Returns:bool—

public bool Editor.PanelWindow.HideOnClose { get; set; }PUBLICGETSET

When the user closes the window, hide it instead of disposing it, so it can be shown again with everything still in it. Off by default: closing disposes.

Returns:bool—

public virtual bool Editor.PanelWindow.IgnoresInput { get; set; }PUBLICVIRTUALGETSETINGEST

A window that never takes the keyboard or the mouse.

Returns:bool—

public bool Editor.PanelWindow.IsFocused { get; set; }PUBLICGETSET

Does this window have keyboard focus?

Returns:bool—

public bool Editor.PanelWindow.IsFullscreen { get; set; }PUBLICGETSET

Is the window fullscreen right now, either way?

Returns:bool—

public bool Editor.PanelWindow.IsMaximized { get; set; }PUBLICGETSET

Is the window maximized?

Returns:bool—

public bool Editor.PanelWindow.IsMinimized { get; set; }PUBLICGETSET

Is the window minimized to the taskbar?

Returns:bool—

public bool Editor.PanelWindow.IsOpen { get; set; }PUBLICGETSET

Is this window still open?

Returns:bool—

public virtual bool Editor.PanelWindow.IsPopup { get; set; }PUBLICVIRTUALGETSET

A popup - a transient window like a menu, dismissed by a click anywhere else.

Returns:bool—

public bool Editor.PanelWindow.IsShown { get; set; }PUBLICGETSET

Whether the OS window is on screen. A window is born hidden and appears once it has drawn its contents, so this is false for its first frame or two.

Returns:bool—

public bool Editor.PanelWindow.IsVisible { get; set; }PUBLICGETSET

Whether the native window exists and is not hidden. Minimized windows can still be visible.

Returns:bool—

public bool Editor.PanelWindow.KeepOnTop { get; set; }PUBLICGETSET

Keep the window above every window that isn't. Palettes, overlays, a video you want to keep watching while working in something else.

Returns:bool—

public Vector2 Editor.PanelWindow.MaxSize { get; set; }PUBLICGETSET

The largest the user can resize the window to. Zero means no limit.

Returns:Vector2—

public Vector2 Editor.PanelWindow.MinSize { get; set; }PUBLICGETSET

The smallest the user can resize the window to. Zero means no limit.

Returns:Vector2—

public Vector2 Editor.PanelWindow.MousePosition { get; set; }PUBLICGETSET

Where the cursor is, in this window's pixels.

Returns:Vector2—

public System.Action Editor.PanelWindow.OnActivated { get; set; }PUBLICGETSET

The window became the active one - it has the keyboard, its title bar lit up.

Returns:Action—

public System.Func`1<bool> Editor.PanelWindow.OnCloseRequested { get; set; }PUBLICGETSET

The user asked to close the window. Return false to keep it open - an unsaved changes prompt, say. Otherwise it's disposed, or hidden when `Editor.PanelWindow.HideOnClose` is set.

Returns:Func<bool>—

public System.Action Editor.PanelWindow.OnDeactivated { get; set; }PUBLICGETSET

The window stopped being the active one: the user went to another window, ours or someone else's.

Returns:Action—

public System.Action Editor.PanelWindow.OnDisplayChanged { get; set; }PUBLICGETSET

The window is on a different display than it was. Its scale may have changed with it.

Returns:Action—

public System.Action Editor.PanelWindow.OnMaximized { get; set; }PUBLICGETSET

The window was maximized.

Returns:Action—

public System.Action Editor.PanelWindow.OnMinimized { get; set; }PUBLICGETSET

The window was minimized to the taskbar.

Returns:Action—

public System.Action Editor.PanelWindow.OnMoved { get; set; }PUBLICGETSET

The window moved, whether the user dragged it or code set `Editor.PanelWindow.Position`.

Returns:Action—

public System.Action Editor.PanelWindow.OnResized { get; set; }PUBLICGETSET

The window's client size changed, whether the user dragged an edge or code set `Editor.PanelWindow.Size`.

Returns:Action—

public System.Action Editor.PanelWindow.OnRestored { get; set; }PUBLICGETSET

The window came back from being minimized or maximized.

Returns:Action—

public float Editor.PanelWindow.Opacity { get; set; }PUBLICGETSET

How see-through the whole window is, contents included. 1 is opaque, 0 is invisible.

Returns:float—

public Editor.PanelWindow Editor.PanelWindow.Owner { get; set; }PUBLICGETSET

The window this one belongs to. An owned window stays above its owner, minimizes with it, and is closed with it - a tool palette, a dialog. Null makes it a top level window again.

Returns:PanelWindow—

public Vector2 Editor.PanelWindow.Position { get; set; }PUBLICGETSET

Position of the window on the desktop, in the OS's own coordinates - desktop pixels on Windows. Deliberately not the units `Editor.PanelWindow.Size` is in: a desktop spanning displays that scale differently has no single UI unit to measure it in.

Returns:Vector2—

public bool Editor.PanelWindow.Resizable { get; set; }PUBLICGETSET

Whether the user can resize the window by its edges. Off makes the size whatever code says.

Returns:bool—

public float Editor.PanelWindow.ResizeBorder { get; set; }PUBLICGETSET

How far from the edge of a borderless window counts as a resize handle, in the same units the UI is authored in - it grows with the display scale so the grab stays the same size.

Returns:float—

public bool Editor.PanelWindow.RoundedCorners { get; set; }PUBLICGETSET

Whether the compositor rounds the window's corners, the way it rounds the OS's own menus. Popups ask for it. Windows 10 and earlier stay square.

Returns:bool—

public bool Editor.PanelWindow.ShowInTaskbar { get; set; }PUBLICGETSET

Whether the window gets a button in the taskbar. On by default; a palette or a floating panel that belongs to another window usually turns it off.

Returns:bool—

public Vector2 Editor.PanelWindow.Size { get; set; }PUBLICGETSET

Size of the window's client area, in the units the UI inside it is authored in. The window on the desktop is this much again bigger on a display that scales.

Returns:Vector2—

public bool Editor.PanelWindow.SizeToContents { get; set; }PUBLICGETSET

Resize the window to fit the first thing on the surface. Popups use this so a menu is exactly as big as its contents, however far outside the parent window that ends up.

Returns:bool—

public string Editor.PanelWindow.Title { get; set; }PUBLICGETSET

The window's title bar text.

Returns:string—

public bool Editor.PanelWindow.VSync { get; set; }PUBLICGETSET

Does this window's present wait for the display? Changing it takes effect at the start of the window's next frame, when the swap chain is matched to the window.

Returns:bool—

On this page

Constructorspublic PanelWindow(System.String title, Vector2 size, System.Nullable`1<Vector2> position, System.Boolean borderless, System.Boolean vsync)public PanelWindow(System.String title, Vector2 size, System.Nullable`1<Vector2> position, System.Boolean borderless)public PanelWindow(System.String title, Vector2 size, System.Nullable`1<Vector2> position)public PanelWindow(System.String title, Vector2 size)Methodspublic System.Void BringToFront()public virtual sealed System.Void Dispose()public System.Void FlashTaskbar(System.Boolean untilFocused = False)public System.Void Focus()public static Editor.PanelWindow FromPanel(Sandbox.UI.Panel panel)public System.Void Hide()public System.Void Maximize()public System.Void Minimize()public System.Void MoveToCenter()public System.Threading.Tasks.Task`1<System.String> PickFolder(System.String defaultPath = null)public System.Threading.Tasks.Task`1<System.String> PickOpenFile(System.String defaultPath = null, System.String filters = null)public System.Threading.Tasks.Task`1<System.String> PickSaveFile(System.String defaultPath = null, System.String filters = null)public static Editor.PanelWindow Popup(Editor.PanelWindow parent, Vector2 position, System.Boolean ignoresInput = False)public System.Void RequestClose()public System.Void SendToBack()public System.Void SetIcon(Sandbox.Bitmap icon)public System.Void SetOverlayIcon(Sandbox.Bitmap icon, System.String description = null)public System.Void Show()public System.Void SnapToDisplay()public System.Void StopFlashing()public System.Void ToggleMaximized()Propertiespublic static System.Collections.Generic.IReadOnlyList`1<Editor.PanelWindow> Editor.PanelWindow.All { get; set; }public System.Boolean Editor.PanelWindow.AllowNestedFrame { get; set; }public System.Boolean Editor.PanelWindow.AlwaysFullFrameRate { get; set; }public System.Nullable`1<System.Single> Editor.PanelWindow.AspectRatioLock { get; set; }public Color Editor.PanelWindow.BackgroundColor { get; set; }public System.Boolean Editor.PanelWindow.Borderless { get; set; }public System.Boolean Editor.PanelWindow.CanClose { get; set; }public System.Boolean Editor.PanelWindow.CanMaximize { get; set; }public Sandbox.Rect Editor.PanelWindow.DisplayBounds { get; set; }public Sandbox.Rect Editor.PanelWindow.DisplayWorkArea { get; set; }public System.Boolean Editor.PanelWindow.DropShadow { get; set; }public System.Boolean Editor.PanelWindow.ExclusiveFullscreen { get; set; }public static Editor.PanelWindow Editor.PanelWindow.Focused { get; set; }public System.Boolean Editor.PanelWindow.Fullscreen { get; set; }public System.Boolean Editor.PanelWindow.HideOnClose { get; set; }public virtual System.Boolean Editor.PanelWindow.IgnoresInput { get; set; }public System.Boolean Editor.PanelWindow.IsFocused { get; set; }public System.Boolean Editor.PanelWindow.IsFullscreen { get; set; }public System.Boolean Editor.PanelWindow.IsMaximized { get; set; }public System.Boolean Editor.PanelWindow.IsMinimized { get; set; }public System.Boolean Editor.PanelWindow.IsOpen { get; set; }public virtual System.Boolean Editor.PanelWindow.IsPopup { get; set; }public System.Boolean Editor.PanelWindow.IsShown { get; set; }public System.Boolean Editor.PanelWindow.IsVisible { get; set; }public System.Boolean Editor.PanelWindow.KeepOnTop { get; set; }public Vector2 Editor.PanelWindow.MaxSize { get; set; }public Vector2 Editor.PanelWindow.MinSize { get; set; }public System.Boolean Editor.PanelWindow.Modal { get; set; }public Vector2 Editor.PanelWindow.MousePosition { get; set; }public System.Action Editor.PanelWindow.OnActivated { get; set; }public System.Func`1<System.Boolean> Editor.PanelWindow.OnCloseRequested { get; set; }public System.Action Editor.PanelWindow.OnDeactivated { get; set; }public System.Action Editor.PanelWindow.OnDisplayChanged { get; set; }public System.Action Editor.PanelWindow.OnMaximized { get; set; }public System.Action Editor.PanelWindow.OnMinimized { get; set; }public System.Action Editor.PanelWindow.OnMoved { get; set; }public System.Action Editor.PanelWindow.OnResized { get; set; }public System.Action Editor.PanelWindow.OnRestored { get; set; }public System.Single Editor.PanelWindow.Opacity { get; set; }public Editor.PanelWindow Editor.PanelWindow.Owner { get; set; }public Vector2 Editor.PanelWindow.Position { get; set; }public System.Boolean Editor.PanelWindow.Resizable { get; set; }public System.Single Editor.PanelWindow.ResizeBorder { get; set; }public Sandbox.UI.RootPanel Editor.PanelWindow.Root { get; set; }public System.Boolean Editor.PanelWindow.RoundedCorners { get; set; }public System.Boolean Editor.PanelWindow.ShowInTaskbar { get; set; }public Vector2 Editor.PanelWindow.Size { get; set; }public System.Boolean Editor.PanelWindow.SizeToContents { get; set; }public System.String Editor.PanelWindow.Title { get; set; }public Editor.PanelWindow Editor.PanelWindow.TooltipWindow { get; set; }public System.Boolean Editor.PanelWindow.VSync { get; set; }Metadata