NkGenie - Window

From Riftui Wiki

Jump to: navigation, search

The nkExtWindow widget is a basic widget for creating user interfaces. You'd probably use a window widget for things like an addon configuration. There are two widgets available in nkGenie: This and it's counterpart nkExtRiftWindow. The later will fit more into the Rift standard UI, but the nkExtWindow will allow for some more advanced features to be used and more individual colorization.

Bascially the nkExtWindow consists of up to three frame widgets which create a header, body and footer part. The footer part is optional and will only be created if the parameter 'footer' is supplied.

The nkExtWindow can be dragged around the screen (if enabled) and collapsed to only show the header (if enabled). Also you can decide to show an 'X' in the header to let the user close the window.

UI.CreateFrame('nkExtWindow', name, parent, {})

Contents

Supported parameters

Due to the nature of the checkbox widget you cannot change it as dynamically as other widgets after creation. The following parameters are supported for UI:CreateFrame(). The method :update() only supports the parameters 'visible', 'layer', 'height', and 'width'.

Parameter Description
fontsize The fontsize used to display the various text elements of the window (header, footer). The height of the header and footer will be fontsize * 2 + 2
collapsed The initial collapsed state of the window. See below.
visible The inital visibility state of the window (true or false)
width The width of the window
height The height of the window. The body's height is equal this height minus the header and footer height.
title The text to display in the header of the window
footer The text to display in the footer of the window. Supplying this parameter will trigger the creation and display of the footer frame.
color Specifies the color of the widget. See below.
anchors The position of the mask widget. See How to position widgets
closeable Specifies if the 'X' mark is shown in the header which the user can click to close the window (true or false)
closeFunc An optional function which is called if the user closes the window. Format: closeFunc = function () ... end
collapsible Specifies if the window can be collapsed to only show the header (true or false)
dragable Specifies if the window is dragable (true or false)
dragfunc Optional function which is called if the window is dragged around the screen. The function will get the new x/y coordinates as paramter. Format: dragFunc = function (x, y) ... end
layer The layer of the window versus parent

Supported Methods

getElement()

This method retrieves the underlying Rift UI element.

getHeader(flag)

This method will return the header element. That header element is a frame widget. You can specify through the parameter if you want to get the border (false) or body (true) of the header frame widget.

getBody(flag)

This method will return the body element. That body element is a frame widget. You can specify through the parameter if you want to get the border (false) or body (true) of the body frame widget.

getFooter(flag)

This method will return the footer element. That body element is a frame widget. You can specify through the parameter if you want to get the border (false) or body (true) of the footer frame widget.

getInternal(element)

This method will return any of the three frame widgets used to build the window:

'header' will return the header frame 'body' will return the body frame 'footer' will return the footer frame

collapse(flag)

You can use this method to collapse the window. This function is useable independent of the 'collapsible' parameter.

Other supported methods

Parameter Description
getHeaderTitle() Returns the text of the header
SetStrata(strata) Sets the strata of the window
SetVisible() Sets the visibility state of the widget (true / false)
IsVisible() Returns the visibility status of the widget. Actually inconsistent and will eventually be changed to GetVisible()

Setting the color of the window

You'll have to supply a LUA table with a lot of properties:

color = { border = 'hex code', body = 'hex code', header = 'hex code', title = 'hex code', alpha = int, message = 'hex code', footer = 'hex code' }

The window is build using a couple of nkExtFrame which allow for much more colorization options than the standard UI window.

option Description
border The color used for all borders of the frames (header, footer and body both have a border which gets the same color)
header The color used to fill the header frame
footer The color used to fill the footer frame
title The color used for the text display in the header and footer
body The color used to fill the body frame
message The color used for the message text displayed within body
alpha This optional parameter allows for setting an alpha level of the window
Personal tools
Namespaces
Variants
Actions
Menu
Wiki
Toolbox