Create and control windows.
var libui = require('libui');
var win = new libui.UiWindow("Example window", 640, 480, true);
win.onClosing(function () {
libui.stopLoop();
});
libui.startLoop();
win.show();
The UiWindow class is responsible to show and manage native windows. UiWindow instance could contains only one control. If you need more, you have to use Containers.
new libui.UiWindow()
Create a new UiWindow object.
- title: String - text to show in window title bar.
- width: Number - width of window in pixels
- height: Number - height of window in pixels
- hasMenubar: Boolean - specify that this window has a menu bar. See Menu
See properties implementation for generic details on how properties are implemented.
This property specify if the window content should have a margin or not. It defaults to false.
A window with margined: false
Same window with margined: true
Set or return the text to show in window title bar.
position: Point
Set or return the position in pixel relative to the top-left window angle.
contentSize: Size
Set or return the size in pixel of the content area of the window. Window decoration size are excluded. This mean that if you set window size to 0,0 you still see title bar and OS window buttons.
Whether the window should show in fullscreen or not.
Allow to specify that the window is a frameless one, without borders, title bar and OS window control widgets.
A window with borderless: true
Show the window.
Close the window.
Allow to specify the control to show in window content area. UiWindow instances can contain only one control. If you need more, you have to use Containers.
- control: UiControl - the control to use in window content area.
Center the window on screen, both horizontally and vertically.
See events implementation for generic details on how events are implemented.
Emitted when the OS window close button is clicked. You are responsible to close window in response to this event.
win.onClosing(function() {
win.close();
});
Emitted when the window position on screen changed, on when fullscreen state change.
Emitted when window content size change.