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.
Constructors4
Showing 4 constructors
No results match this filter.
Methods21
Showing 21 methods
public void BringToFront()
Raise the window above the others without taking focus. `Editor.PanelWindow.Focus` is the one that focuses it too.
void—public virtual sealed void Dispose()
Close the window and delete its panels.
void—public void FlashTaskbar(bool untilFocused = False)
Flash the taskbar button to get the user's attention. Briefly by default; until focused keeps going until they click the window.
| Parameter | Type | Description |
|---|---|---|
| untilFocused = False | bool | — |
void—public void Focus()
Bring the window to the front.
void—public static Editor.PanelWindow FromPanel(Sandbox.UI.Panel panel)
The window a panel is being shown in, if it's one of ours.
| Parameter | Type | Description |
|---|---|---|
| panel | Panel | — |
public void Hide()
Take the window off screen without closing it. Everything in it stays; `Editor.PanelWindow.Show` brings it back where it was.
void—public void Maximize()
Fill the display.
void—public void Minimize()
Minimize the window.
void—public void MoveToCenter()
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.
void—public System.Threading.Tasks.Task`1<string> PickFolder(string defaultPath = null)
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.
| Parameter | Type | Description |
|---|---|---|
| defaultPath = null | string | — |
Task<string>—public System.Threading.Tasks.Task`1<string> PickOpenFile(string defaultPath = null, string filters = null)
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.
| Parameter | Type | Description |
|---|---|---|
| defaultPath = null | string | — |
| filters = null | string | — |
Task<string>—public System.Threading.Tasks.Task`1<string> PickSaveFile(string defaultPath = null, string filters = null)
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.
| Parameter | Type | Description |
|---|---|---|
| defaultPath = null | string | — |
| filters = null | string | — |
Task<string>—public static Editor.PanelWindow Popup(Editor.PanelWindow parent, Vector2 position, bool ignoresInput = False)
Open a popup - a borderless window that sits above this one and can hang outside it, the way an OS menu does. The position is in this window's client pixels, which is what a panel's `Box.Rect` is already in. There is no size to pass. The popup is born hidden at the parent's size, shrinks to whatever is put in it, and only then appears - so what it ends up as is the size of its contents.
| Parameter | Type | Description |
|---|---|---|
| parent | PanelWindow | — |
| position | Vector2 | — |
| ignoresInput = False | bool | — |
public void RequestClose()
The user clicked the window's close button.
void—public void SendToBack()
Put the window behind every other window. Focus stays where it is.
void—public void SetIcon(Sandbox.Bitmap icon)
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.
| Parameter | Type | Description |
|---|---|---|
| icon | Bitmap | — |
void—public void SetOverlayIcon(Sandbox.Bitmap icon, string description = null)
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.
| Parameter | Type | Description |
|---|---|---|
| icon | Bitmap | — |
| description = null | string | — |
void—public void Show()
Put a hidden window back on screen.
void—public void SnapToDisplay()
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.
void—public void StopFlashing()
Stop a `Editor.PanelWindow.FlashTaskbar(System.Boolean)` that's still going.
void—public void ToggleMaximized()
Maximize the window, or put it back if it already is.
void—No results match this filter.
Properties51
Showing 51 properties
public static System.Collections.Generic.IReadOnlyList`1<Editor.PanelWindow> Editor.PanelWindow.All { get; set; }
Every window that's currently open.
public bool Editor.PanelWindow.AllowNestedFrame { get; set; }
Let frames run inside a frame that's already running - see IPanelWindow.
bool—public bool Editor.PanelWindow.AlwaysFullFrameRate { get; set; }
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.
bool—public System.Nullable`1<float> Editor.PanelWindow.AspectRatioLock { get; set; }
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.
Nullable<float>—public Color Editor.PanelWindow.BackgroundColor { get; set; }
What the window clears to before the UI is drawn.
public bool Editor.PanelWindow.Borderless { get; set; }
True if we're drawing the title bar and borders ourselves. Popups always are.
bool—public bool Editor.PanelWindow.CanClose { get; set; }
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.
bool—public bool Editor.PanelWindow.CanMaximize { get; set; }
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.
bool—public Sandbox.Rect Editor.PanelWindow.DisplayBounds { get; set; }
The whole of the display the window is on, in the same desktop coordinates as `Editor.PanelWindow.Position`.
public Sandbox.Rect Editor.PanelWindow.DisplayWorkArea { get; set; }
The part of the window's display that isn't under the taskbar or a dock, in desktop coordinates.
public bool Editor.PanelWindow.DropShadow { get; set; }
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.
bool—public bool Editor.PanelWindow.ExclusiveFullscreen { get; set; }
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.
bool—public static Editor.PanelWindow Editor.PanelWindow.Focused { get; set; }
The window the OS is giving keyboard input to, if it's one of ours.
public bool Editor.PanelWindow.Fullscreen { get; set; }
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.
bool—public bool Editor.PanelWindow.HideOnClose { get; set; }
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.
bool—public virtual bool Editor.PanelWindow.IgnoresInput { get; set; }
A window that never takes the keyboard or the mouse.
bool—public bool Editor.PanelWindow.IsFocused { get; set; }
Does this window have keyboard focus?
bool—public bool Editor.PanelWindow.IsFullscreen { get; set; }
Is the window fullscreen right now, either way?
bool—public bool Editor.PanelWindow.IsMaximized { get; set; }
Is the window maximized?
bool—public bool Editor.PanelWindow.IsMinimized { get; set; }
Is the window minimized to the taskbar?
bool—public bool Editor.PanelWindow.IsOpen { get; set; }
Is this window still open?
bool—public virtual bool Editor.PanelWindow.IsPopup { get; set; }
A popup - a transient window like a menu, dismissed by a click anywhere else.
bool—public bool Editor.PanelWindow.IsShown { get; set; }
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.
bool—public bool Editor.PanelWindow.IsVisible { get; set; }
Whether the native window exists and is not hidden. Minimized windows can still be visible.
bool—public bool Editor.PanelWindow.KeepOnTop { get; set; }
Keep the window above every window that isn't. Palettes, overlays, a video you want to keep watching while working in something else.
bool—public Vector2 Editor.PanelWindow.MaxSize { get; set; }
The largest the user can resize the window to. Zero means no limit.
public Vector2 Editor.PanelWindow.MinSize { get; set; }
The smallest the user can resize the window to. Zero means no limit.
public bool Editor.PanelWindow.Modal { get; set; }
Block the `Editor.PanelWindow.Owner` from taking input while this window is open, the way a dialog does. Does nothing without an owner. Cleared on close, so the owner isn't left dead.
bool—public Vector2 Editor.PanelWindow.MousePosition { get; set; }
Where the cursor is, in this window's pixels.
public System.Action Editor.PanelWindow.OnActivated { get; set; }
The window became the active one - it has the keyboard, its title bar lit up.
Action—public System.Func`1<bool> Editor.PanelWindow.OnCloseRequested { get; set; }
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.
Func<bool>—public System.Action Editor.PanelWindow.OnDeactivated { get; set; }
The window stopped being the active one: the user went to another window, ours or someone else's.
Action—public System.Action Editor.PanelWindow.OnDisplayChanged { get; set; }
The window is on a different display than it was. Its scale may have changed with it.
Action—public System.Action Editor.PanelWindow.OnMaximized { get; set; }
The window was maximized.
Action—public System.Action Editor.PanelWindow.OnMinimized { get; set; }
The window was minimized to the taskbar.
Action—public System.Action Editor.PanelWindow.OnMoved { get; set; }
The window moved, whether the user dragged it or code set `Editor.PanelWindow.Position`.
Action—public System.Action Editor.PanelWindow.OnResized { get; set; }
The window's client size changed, whether the user dragged an edge or code set `Editor.PanelWindow.Size`.
Action—public System.Action Editor.PanelWindow.OnRestored { get; set; }
The window came back from being minimized or maximized.
Action—public float Editor.PanelWindow.Opacity { get; set; }
How see-through the whole window is, contents included. 1 is opaque, 0 is invisible.
float—public Editor.PanelWindow Editor.PanelWindow.Owner { get; set; }
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.
public Vector2 Editor.PanelWindow.Position { get; set; }
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.
public bool Editor.PanelWindow.Resizable { get; set; }
Whether the user can resize the window by its edges. Off makes the size whatever code says.
bool—public float Editor.PanelWindow.ResizeBorder { get; set; }
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.
float—public Sandbox.UI.RootPanel Editor.PanelWindow.Root { get; set; }
The panel everything in this window hangs off.
public bool Editor.PanelWindow.RoundedCorners { get; set; }
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.
bool—public bool Editor.PanelWindow.ShowInTaskbar { get; set; }
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.
bool—public Vector2 Editor.PanelWindow.Size { get; set; }
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.
public bool Editor.PanelWindow.SizeToContents { get; set; }
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.
bool—public string Editor.PanelWindow.Title { get; set; }
The window's title bar text.
string—public Editor.PanelWindow Editor.PanelWindow.TooltipWindow { get; set; }
The tooltip window open over this one, if there is one.
public bool Editor.PanelWindow.VSync { get; set; }
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.
bool—No results match this filter.