Window

Native window.

Modulerequire("yue.gui")
TypeClass

Class methods

create(options)

Create a new window with options.

Parameters

Return

Button

Methods

close()

Request to close the window.

hasframe()

Return whether window has a native frame.

Return

boolean

istransparent()

Return whether window is transparent.

Return

boolean

sethasshadow(has)

Set whether window should have shadow.

Depending on platform, this may not work.

Parameters

hasshadow()

Return whether window has shadow.

Return

boolean

setcontentview(view)

Set the content view of the window.

The content view will always be resized to fill window's client area.

Parameters

getcontentview()

Return the content view of the window.

Return

View

center()

Move the window to the center of the screen.

setcontentsize(size)

Resize window to make the content view fit size.

Parameters

getcontentsize()

Return the size of content view.

Return

SizeF

setbounds(bounds)

Change the position and size of the window.

Parameters

getbounds()

Return the position and size of the window.

Return

RectF

setsizeconstraints(minsize, maxsize)

Set the minimum and maximum sizes of the window.

Passing an empty size means no constraint.

Parameters

getsizeconstraints()

Return minimum and maximum sizes of the window.

Return

SizeF, SizeF

setcontentsizeconstraints(minsize, maxsize)

Set the minimum and maximum content sizes of the window.

Passing an empty size means no constraint.

Parameters

getcontentsizeconstraints()

Return minimum and maximum content sizes of the window.

Return

SizeF, SizeF

activate()

Show the window and activate it.

deactivate()

Move the focus away from the window.

isactive()

Return whether window has focus.

Return

boolean

setvisible(visible)

Show/hide the window.

Parameters

isvisible()

Return whether window is visible.

Return

boolean

setalwaysontop(top)

Make the window always show above other normal windows.

Parameters

isalwaysontop()

Return whether window is always above other normal windows.

Return

boolean

setfullscreen(fullscreen)

Enter/leave fullscreen state.

Parameters

isfullscreen()

Return whether window is in fullscreen.

Return

boolean

maximize()

Maximize the window.

unmaximize()

Unmaximize the window.

ismaximized()

Return whether window is maximized.

Return

boolean

minimize()

Minimize the window.

restore()

Restore the minimized window.

isminimized()

Return whether window is minimized.

Return

boolean

setresizable(resizable)

Set whether window can be resized.

Parameters

isresizable()

Return whether window can be resized.

Return

boolean

setmaximizable(maximizable)

Set whether window can be maximize.

Parameters

ismaximizable()

Return whether window can be maximize.

Return

boolean

setminimizable(minimizable)

Set whether window can be minimized.

Parameters

isminimizable()

Return whether window can be minimized.

Return

boolean

setmovable(movable)

Set whether window can be moved.

Parameters

ismovable()

Return whether window can be moved.

Return

boolean

settitle(title)

Set window title.

Parameters

gettitle()

Get window title.

Return

string

setbackgroundcolor(color)

Set the background color of the window.

Parameters

settoolbar(toolbar) macOS

Set the window toolbar.

Parameters

gettoolbar() macOS

Return the window toolbar.

Return

Toolbar

settitlevisible(visible) macOS

Set whether the title is visible, when title was hidden the toolber would be moved into the area previously occupied by the title.

Parameters

istitlevisible() macOS

Return whether title is visible.

Return

boolean

setfullsizecontentview(full) macOS

Set the NSFullSizeContentViewWindowMask style on the window.

Parameters

isfullsizecontentview() macOS

Return whether the window has NSFullSizeContentViewWindowMask style.

Return

boolean

setmenubar(menubar) Windows Linux

Set the window menu bar.

Parameters

getmenubar() Windows Linux

Return the window menu bar.

Return

MenuBar

Events

onclose(self)

Emitted when the window is going to be closed.

Parameters

Preventable

No.

Delegates

shouldclose(self)

Called when user requests to close the window, should return whether the window can be closed.

Parameters

Return

boolean