Show / Hide Table of Contents

Class ShellComponent

Win32 implementation of IShellComponent.

Inheritance
object
ShellComponent
Implements
IShellComponent
IPalComponent
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: OpenTK.Platform.Native.Windows
Assembly: OpenTK.Platform.dll
Syntax
public class ShellComponent : IShellComponent, IPalComponent

Properties

Logger

The logger that this component uses to log diagnostic messages.

Declaration
public ILogger? Logger { get; set; }
Property Value
Type Description
ILogger
See Also
ILogger
Logger

Name

Name of the abstraction layer component.

Declaration
public string Name { get; }
Property Value
Type Description
string

Provides

Specifies which PAL components this object provides.

Declaration
public PalComponents Provides { get; }
Property Value
Type Description
PalComponents

Methods

AllowScreenSaver(bool, string?)

Sets whether or not a screensaver is allowed to draw on top of the window. For games with long cutscenes it would be appropriate to set this to false, while tools that act like normal applications should set this to true. By default this setting is untouched.

Declaration
public void AllowScreenSaver(bool allow, string? disableReason)
Parameters
Type Name Description
bool allow

Whether to allow screensavers to appear while the application is running.

string disableReason

A reason for why the screen saver is disabled. This string should both contain the reason why the screen saver is disabed as well as the name of the application so the user knows which application is preventing the screen saver from running. If null is sent the following default message will be sent:

$"{ApplicationName} is is preventing screen saver."
See Also
IsScreenSaverAllowed()

GetBatteryInfo(out BatteryInfo)

Gets the battery status of the computer.

Declaration
public BatteryStatus GetBatteryInfo(out BatteryInfo info)
Parameters
Type Name Description
BatteryInfo info
Returns
Type Description
BatteryStatus

Whether the computer has a battery or not, or if this function failed.

GetPreferredTheme()

Gets the user preference for application theme.

Declaration
public ThemeInfo GetPreferredTheme()
Returns
Type Description
ThemeInfo

The user set preferred theme.

See Also
ThemeChangeEventArgs

GetSystemMemoryInformation()

Gets information about the memory of the device and the current status.

Declaration
public SystemMemoryInfo GetSystemMemoryInformation()
Returns
Type Description
SystemMemoryInfo

The memory info.

Initialize(ToolkitOptions)

Initialize the component.

Declaration
public void Initialize(ToolkitOptions options)
Parameters
Type Name Description
ToolkitOptions options

The options to initialize the component with.

See Also
ToolkitOptions
Init(ToolkitOptions)

IsScreenSaverAllowed()

Gets if the screen saver is allowed to run or not.

Declaration
public bool IsScreenSaverAllowed()
Returns
Type Description
bool

If the screen saver is allowed to run.

See Also
AllowScreenSaver(bool, string)

SetCaptionColor(WindowHandle, Color3<Rgb>)

Works on Windows 11 only. Sets the color of the windows caption bar.

Declaration
public void SetCaptionColor(WindowHandle handle, Color3<Rgb> color)
Parameters
Type Name Description
WindowHandle handle
Color3<Rgb> color

SetCaptionTextColor(WindowHandle, Color3<Rgb>)

Works on Windows 11 only. Sets the color of the windows caption bar text.

Declaration
public void SetCaptionTextColor(WindowHandle handle, Color3<Rgb> color)
Parameters
Type Name Description
WindowHandle handle
Color3<Rgb> color

SetImmersiveDarkMode(WindowHandle, bool)

Sets the DWMWA_USE_IMMERSIVE_DARK_MODE flag on the window causing the titlebar be rendered in dark mode colors.

Declaration
public void SetImmersiveDarkMode(WindowHandle handle, bool useImmersiveDarkMode)
Parameters
Type Name Description
WindowHandle handle

Handle to a window.

bool useImmersiveDarkMode

Whether to use immersive dark mode or not.

SetWindowCornerPreference(WindowHandle, CornerPreference)

Works on Windows 11 only. Sets if the window should have rounded corners or not.

Declaration
public void SetWindowCornerPreference(WindowHandle handle, ShellComponent.CornerPreference preference)
Parameters
Type Name Description
WindowHandle handle
ShellComponent.CornerPreference preference

Uninitialize()

Uninitialize the component. Frees any native resources used by the component.

Declaration
public void Uninitialize()
See Also
Uninit()

Implements

IShellComponent
IPalComponent
In this article
  • Properties
    • Logger
    • Name
    • Provides
  • Methods
    • AllowScreenSaver(bool, string?)
    • GetBatteryInfo(out BatteryInfo)
    • GetPreferredTheme()
    • GetSystemMemoryInformation()
    • Initialize(ToolkitOptions)
    • IsScreenSaverAllowed()
    • SetCaptionColor(WindowHandle, Color3<Rgb>)
    • SetCaptionTextColor(WindowHandle, Color3<Rgb>)
    • SetImmersiveDarkMode(WindowHandle, bool)
    • SetWindowCornerPreference(WindowHandle, CornerPreference)
    • Uninitialize()
  • Implements
Back to top Generated by DocFX