(API) Window

  • plamzi
  • plamzi's Avatar Topic Author
  • Offline
  • Administrator
More
09 Nov 2013 20:40 - 01 Dec 2014 13:49 #1 by plamzi
(API) Window was created by plamzi
A helper module that creates a separate UI window based on the options passed to it. Usually, this module is used by a full featured module to create the window that will contain it.

OPTIONS

idRequired. The DOM id attribute for the resulting window.
titleOptional. This will be displayed as the title in the window toolbar.
closeableIf set to 1, the window will be closeable by the user. Default is 0 for non-closeable.
onCloseA function to be called right before a closeable Window is destroyed.
maxIf set to 1, the window will be maximizeable by the user. Default is 0 for non-maximizeable.
transparentThe window itself will be completely transparent and only its contents will be visible.
noresizeIf set to 1 (true), the user will not be able to resize this window. Default is 0 for resizable.
nofrontIf set to 1, the window will not move to front when the user clicks on it (and will not cause other windows to fade). Default is 0 for front-able.
nofadeIf set to 1, the window will not become semi-transparent when another window is in focus. Default is 0 for fade-able.
nodragIf set to 1, the window will not be assigned the default draggable behaviors (which you can see in Window.js). This is useful if you want to freeze all app windows for all users (ack!) or to override the draggable behavior with your own.
masterIf set to 1, other windows will follow this window whenever it is re-positioned. This is the default behavior of the ScrollView, for example.
cssAn object containing any CSS attributes to be applied to the window.


METHODS

WIndow.title('My Window')Sets the window title to 'My Window'.
Window.button({
title: 'Open my module.',
icon: 'icon-bars',
click: function() {
do_stuff()
}
});
Adds a button to the window toolbar. Sets the HTML title (tooltip), sets the button icon to any Font Awesome icon. Assigns an on-click function.
Window.front()Brings the window to front.
Window.minimize()Minimizes the window (if maximized).
Window.maximize()Maximizes the window.
Window.maximized()Returns 1 if the window is maximized.

EXAMPLE:

var win = new Window({
        id: '#my-window',
        title: 'My Window'
});
Last edit: 01 Dec 2014 13:49 by plamzi.
The topic has been locked.