UNPKG

openfl

Version:

A fast, productive library for 2D cross-platform development.

314 lines (297 loc) 11.5 kB
// Class: lime.ui.Window var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this $global.Object.defineProperty(exports, "__esModule", {value: true}); var __map_reserved = {}; // Imports var $hxClasses = require("./../../hxClasses_stub").default; var $hxEnums = require("./../../hxEnums_stub").default; var $import = require("./../../import_stub").default; function lime_app__$Event_$String_$Void() {return require("./../../lime/app/_Event_String_Void");} function lime_app__$Event_$String_$Int_$Int_$Void() {return require("./../../lime/app/_Event_String_Int_Int_Void");} function lime_app__$Event_$Void_$Void() {return require("./../../lime/app/_Event_Void_Void");} function lime_app__$Event_$Int_$Int_$Void() {return require("./../../lime/app/_Event_Int_Int_Void");} function lime_app__$Event_$lime_$graphics_$RenderContext_$Void() {return require("./../../lime/app/_Event_lime_graphics_RenderContext_Void");} function lime_app__$Event_$Float_$Float_$Void() {return require("./../../lime/app/_Event_Float_Float_Void");} function lime_app__$Event_$Float_$Float_$lime_$ui_$MouseWheelMode_$Void() {return require("./../../lime/app/_Event_Float_Float_lime_ui_MouseWheelMode_Void");} function lime_app__$Event_$Float_$Float_$Int_$Void() {return require("./../../lime/app/_Event_Float_Float_Int_Void");} function lime_app__$Event_$Float_$Float_$lime_$ui_$MouseButton_$Void() {return require("./../../lime/app/_Event_Float_Float_lime_ui_MouseButton_Void");} function lime_app__$Event_$lime_$ui_$KeyCode_$lime_$ui_$KeyModifier_$Void() {return require("./../../lime/app/_Event_lime_ui_KeyCode_lime_ui_KeyModifier_Void");} function Reflect() {return require("./../../Reflect");} function lime__$internal_backend_html5_HTML5Window() {return require("./../../lime/_internal/backend/html5/HTML5Window");} // Constructor var Window = function(application,attributes) { this.__maxHeight = 2147483647; this.__maxWidth = 2147483647; this.__minHeight = 0; this.__minWidth = 0; this.clickCount = 0; this.onTextInput = new (lime_app__$Event_$String_$Void().default)(); this.onTextEdit = new (lime_app__$Event_$String_$Int_$Int_$Void().default)(); this.onShow = new (lime_app__$Event_$Void_$Void().default)(); this.onRestore = new (lime_app__$Event_$Void_$Void().default)(); this.onResize = new (lime_app__$Event_$Int_$Int_$Void().default)(); this.onRenderContextRestored = new (lime_app__$Event_$lime_$graphics_$RenderContext_$Void().default)(); this.onRenderContextLost = new (lime_app__$Event_$Void_$Void().default)(); this.onRender = new (lime_app__$Event_$lime_$graphics_$RenderContext_$Void().default)(); this.onMove = new (lime_app__$Event_$Float_$Float_$Void().default)(); this.onMouseWheel = new (lime_app__$Event_$Float_$Float_$lime_$ui_$MouseWheelMode_$Void().default)(); this.onMouseUp = new (lime_app__$Event_$Float_$Float_$Int_$Void().default)(); this.onMouseMoveRelative = new (lime_app__$Event_$Float_$Float_$Void().default)(); this.onMouseMove = new (lime_app__$Event_$Float_$Float_$Void().default)(); this.onMouseDown = new (lime_app__$Event_$Float_$Float_$lime_$ui_$MouseButton_$Void().default)(); this.onMinimize = new (lime_app__$Event_$Void_$Void().default)(); this.onMaximize = new (lime_app__$Event_$Void_$Void().default)(); this.onLeave = new (lime_app__$Event_$Void_$Void().default)(); this.onKeyUp = new (lime_app__$Event_$lime_$ui_$KeyCode_$lime_$ui_$KeyModifier_$Void().default)(); this.onKeyDown = new (lime_app__$Event_$lime_$ui_$KeyCode_$lime_$ui_$KeyModifier_$Void().default)(); this.onHide = new (lime_app__$Event_$Void_$Void().default)(); this.onFullscreen = new (lime_app__$Event_$Void_$Void().default)(); this.onFocusOut = new (lime_app__$Event_$Void_$Void().default)(); this.onFocusIn = new (lime_app__$Event_$Void_$Void().default)(); this.onExpose = new (lime_app__$Event_$Void_$Void().default)(); this.onEnter = new (lime_app__$Event_$Void_$Void().default)(); this.onDropFile = new (lime_app__$Event_$String_$Void().default)(); this.onDeactivate = new (lime_app__$Event_$Void_$Void().default)(); this.onClose = new (lime_app__$Event_$Void_$Void().default)(); this.onActivate = new (lime_app__$Event_$Void_$Void().default)(); this.application = application; this.__attributes = attributes != null ? attributes : { }; if((Reflect().default).hasField(this.__attributes,"parameters")) { this.parameters = this.__attributes.parameters; } this.__width = 0; this.__height = 0; this.__fullscreen = false; this.__scale = 1; this.__x = 0; this.__y = 0; this.__title = (Reflect().default).hasField(this.__attributes,"title") ? this.__attributes.title : ""; this.id = -1; this.__backend = new (lime__$internal_backend_html5_HTML5Window().default)(this); } // Meta Window.__name__ = "lime.ui.Window"; Window.__isInterface__ = false; Window.prototype = { alert: function(message,title) { this.__backend.alert(message,title); }, close: function() { this.__backend.close(); }, focus: function() { this.__backend.focus(); }, move: function(x,y) { this.__backend.move(x,y); this.__x = x; this.__y = y; }, readPixels: function(rect) { return this.__backend.readPixels(rect); }, resize: function(width,height) { if(width < this.__minWidth) { width = this.__minWidth; } else if(width > this.__maxWidth) { width = this.__maxWidth; } if(height < this.__minHeight) { height = this.__minHeight; } else if(height > this.__maxHeight) { height = this.__maxHeight; } this.__backend.resize(width,height); this.__width = width; this.__height = height; }, setMinSize: function(width,height) { this.__backend.setMinSize(width,height); this.__minWidth = width; this.__minHeight = height; if(this.__width < this.__minWidth || this.__height < this.__minHeight) { this.resize(this.__width,this.__height); } }, setMaxSize: function(width,height) { this.__backend.setMaxSize(width,height); this.__maxWidth = width; this.__maxHeight = height; if(this.__width > this.__maxWidth || this.__height > this.__maxHeight) { this.resize(this.__width,this.__height); } }, setIcon: function(image) { if(image == null) { return; } this.__backend.setIcon(image); }, toString: function() { return "[object Window]"; }, warpMouse: function(x,y) { this.__backend.warpMouse(x,y); }, get_cursor: function() { return this.__backend.getCursor(); }, set_cursor: function(value) { return this.__backend.setCursor(value); }, get_display: function() { return this.__backend.getDisplay(); }, get_displayMode: function() { return this.__backend.getDisplayMode(); }, set_displayMode: function(value) { return this.__backend.setDisplayMode(value); }, get_borderless: function() { return this.__borderless; }, set_borderless: function(value) { return this.__borderless = this.__backend.setBorderless(value); }, get_frameRate: function() { return this.__backend.getFrameRate(); }, set_frameRate: function(value) { return this.__backend.setFrameRate(value); }, get_fullscreen: function() { return this.__fullscreen; }, set_fullscreen: function(value) { return this.__fullscreen = this.__backend.setFullscreen(value); }, get_height: function() { return this.__height; }, set_height: function(value) { this.resize(this.__width,value); return this.__height; }, get_hidden: function() { return this.__hidden; }, get_maxHeight: function() { return this.__maxHeight; }, set_maxHeight: function(value) { this.setMaxSize(this.__maxWidth,value); return this.__maxHeight; }, get_maximized: function() { return this.__maximized; }, set_maximized: function(value) { this.__minimized = false; return this.__maximized = this.__backend.setMaximized(value); }, get_maxWidth: function() { return this.__maxWidth; }, set_maxWidth: function(value) { this.setMinSize(value,this.__maxHeight); return this.__maxWidth; }, get_minHeight: function() { return this.__minHeight; }, set_minHeight: function(value) { this.setMinSize(this.__minWidth,value); return this.__minHeight; }, get_minimized: function() { return this.__minimized; }, set_minimized: function(value) { this.__maximized = false; return this.__minimized = this.__backend.setMinimized(value); }, get_minWidth: function() { return this.__minWidth; }, set_minWidth: function(value) { this.setMinSize(value,this.__minHeight); return this.__minWidth; }, get_mouseLock: function() { return this.__backend.getMouseLock(); }, set_mouseLock: function(value) { this.__backend.setMouseLock(value); return value; }, get_opacity: function() { return this.__backend.getOpacity(); }, set_opacity: function(value) { this.__backend.setOpacity(value); return value; }, get_resizable: function() { return this.__resizable; }, set_resizable: function(value) { this.__resizable = this.__backend.setResizable(value); return this.__resizable; }, get_scale: function() { return this.__scale; }, get_textInputEnabled: function() { return this.__backend.getTextInputEnabled(); }, set_textInputEnabled: function(value) { return this.__backend.setTextInputEnabled(value); }, setTextInputRect: function(value) { return this.__backend.setTextInputRect(value); }, get_title: function() { return this.__title; }, set_title: function(value) { return this.__title = this.__backend.setTitle(value); }, get_visible: function() { return this.__visible; }, set_visible: function(value) { this.__visible = this.__backend.setVisible(value); return this.__visible; }, get_width: function() { return this.__width; }, set_width: function(value) { this.resize(value,this.__height); return this.__width; }, get_x: function() { return this.__x; }, set_x: function(value) { this.move(value,this.__y); return this.__x; }, get_y: function() { return this.__y; }, set_y: function(value) { this.move(this.__x,value); return this.__y; } }; Window.prototype.__class__ = Window.prototype.constructor = $hxClasses["lime.ui.Window"] = Window; // Init { var p = Window.prototype; Object.defineProperties(p,{ borderless : { get : p.get_borderless, set : p.set_borderless}, cursor : { get : p.get_cursor, set : p.set_cursor}, display : { get : p.get_display}, displayMode : { get : p.get_displayMode, set : p.set_displayMode}, frameRate : { get : p.get_frameRate, set : p.set_frameRate}, fullscreen : { get : p.get_fullscreen, set : p.set_fullscreen}, height : { get : p.get_height, set : p.set_height}, maxHeight : { get : p.get_maxHeight, set : p.set_maxHeight}, maximized : { get : p.get_maximized, set : p.set_maximized}, maxWidth : { get : p.get_maxWidth, set : p.set_maxWidth}, minHeight : { get : p.get_minHeight, set : p.set_minHeight}, minimized : { get : p.get_minimized, set : p.set_minimized}, minWidth : { get : p.get_minWidth, set : p.set_minWidth}, mouseLock : { get : p.get_mouseLock, set : p.set_mouseLock}, resizable : { get : p.get_resizable, set : p.set_resizable}, scale : { get : p.get_scale}, textInputEnabled : { get : p.get_textInputEnabled, set : p.set_textInputEnabled}, title : { get : p.get_title, set : p.set_title}, visible : { get : p.get_visible, set : p.set_visible}, width : { get : p.get_width, set : p.set_width}, x : { get : p.get_x, set : p.set_y}, y : { get : p.get_x, set : p.set_y}}); }; // Statics // Export exports.default = Window;