diff --git a/Inquirer.js b/Inquirer.js
index 2165393..9bf6408 100644
--- a/Inquirer.js
+++ b/Inquirer.js
@@ -61,6 +61,7 @@
title: "Error",
width: 400,
height: 250,
+ visible:false,
content: [merger.ui.picture("Iico", {
src: bugico,
top: 0,
@@ -111,7 +112,6 @@
}
})],
onLoad: function () {
- this.windows.Wmain.hide();
},
onAbout: function () {
alert("Pos claro");
diff --git a/Merger.js b/Merger.js
index 0c9abbe..c36a206 100644
--- a/Merger.js
+++ b/Merger.js
@@ -234,6 +234,9 @@
if (!a)
return false;
}
+ if (selectedApp)
+ for (i in selectedApp.windows)
+ core.getDesktop().removeChild(selectedApp.windows[i]);
selectedApp = a;
menu.sysMenu.setIcon(a.icon ? a.icon : sys.icon);
menu.sysMenu.setText(a.title ? a.title : a.id);
@@ -282,6 +285,15 @@
menu.client.removeChild(menu.client.lastChild);
for (i in a.menu)
menu.client.appendChild(a.menu[i]);
+ for (i in a.windows) {
+ core.getDesktop().appendChild(a.windows[i]);
+ a.windows[i].setVisible(a.windows[i].getVisible());
+ }
+ }
+
+ /** get focused application */
+ function getSelectedAppId() {
+ return selectedApp ? selectedApp.getId() : undefined;
}
/** Focus application */
@@ -313,6 +325,7 @@
create: createApplication,
switch: switchApplication,
focus: focusApplication,
+ getFocused: getSelectedAppId,
},
menu: {
showMenu: showMenu,
@@ -385,15 +398,16 @@
this.onEnter();
}
- /** Add window to applicaiton */
+ /** Add window to application */
MergerApplication.prototype.addWindow = function (win) {
this.windows[win.getId()] = win;
win.application = win.parentControl = this;
win.setAttribute("id", this.getId() + "::" + win.getId());
- core.getDesktop().appendChild(win);
+ if (core.app.getFocused(this.getId()))
+ core.getDesktop().appendChild(win);
}
- /** Remove window from applicaiton */
+ /** Remove window from application */
MergerApplication.prototype.removeWindow = function (win) {
if (!this.windows[win.getId()])
return;
@@ -480,24 +494,23 @@
return id;
}
c.setTop = function (val) {
- def.top = val;
+ this.top = val;
this.style.top = val + "px";
}
c.setLeft = function (val) {
- def.left = val;
+ this.left = val;
this.style.left = val + "px";
}
c.setWidth = function (val) {
- def.width = val;
+ this.width = val;
this.style.width = val + "px";
}
c.setHeight = function (val) {
- def.height = val;
+ this.height = val;
this.style.height = val + "px";
}
c.setVisible = function (val) {
this.style.display = val ? "" : "none";
- _visible = val;
if (val && this.onShow)
this.onShow();
if (val && this.onHide)
@@ -532,8 +545,15 @@
win = win.parentControl;
return win;
}
- c.getApp = function () {
- return this.getWindow().parent;
+ c.getApplication = c.getApp = function () {
+ if (this.application)
+ return this.application;
+ var w = this.getWindow(),a=this;
+ if (w)
+ return w.application;
+ while (a && a._type != "app")
+ a = win.parentControl;
+ return a;
}
c.merge = function (def) {
var settings = {};
@@ -643,7 +663,7 @@
client.removeChild(client.lastChild);
for (i in this.items) {
var m = this.items[i];
- m.application = this.applicaiton;
+ m.application = this.application;
m.parentControl = this;
if (m.items)
m.showMoreMark();
@@ -714,9 +734,9 @@
if (def.width == undefined)
def.width = 450;
if (def.top == undefined)
- def.top = (document.body.clientHeight - def.height) / 2;
+ def.top = document.body ? (document.body.clientHeight - def.height) / 2 : undefined;
if (def.left == undefined)
- def.left = (document.body.clientWidth - def.width) / 2;
+ def.left = document.body ? (document.body.clientWidth - def.width) / 2 : undefined;
if (!def.content)
def.content = [];
var w, dw = def.width, dh = def.height;
@@ -810,10 +830,18 @@
var close = true;
if (this.onClose)
close = this.onClose();
- if (close)
+ if (close === undefined || close)
this.hide();
},
}, def));
+ w._setVisible = w.setVisible;
+ w.setVisible = function (vis) {
+ this._setVisible(vis);
+ if (this.top === undefined)
+ this.setTop((document.body.clientHeight - this.height) / 2);
+ if (this.left === undefined)
+ this.setLeft((document.body.clientWidth - this.width) / 2);
+ }
w.client = w.content.client;
w.titlebar = w.content.titlebar;
w.content = w.client.content;
@@ -854,6 +882,9 @@
setText: function (value) {
this.value = value;
},
+ getText: function () {
+ return this.value;
+ },
style: {
fontSize: "10px",
border: "1px solid " + sys.framecolor,
@@ -863,6 +894,22 @@
}
/**
+ * CheckBox control creation
+ */
+ function checkbox(id, def) {
+ var c = control("checkbox", id, core.mkDefinition({
+ setChecked: function (value) {
+ this.checked = value;
+ },
+ getChecked: function () {
+ return this.checked;
+ },
+ }, def), core.mkTag("input"));
+ c.type = "checkbox";
+ return c;
+ }
+
+ /**
* Button control creation
*/
function button(id, def) {
@@ -928,6 +975,7 @@
list: list,
label: label,
textbox: textbox,
+ checkbox: checkbox,
button: button,
picture: picture,
menuItem: menuItem,
diff --git a/MergerTester.js b/MergerTester.js
new file mode 100644
index 0000000..60fa3af
--- /dev/null
+++ b/MergerTester.js
@@ -0,0 +1,88 @@
+/*
+ * Merger Tester Applicaion V 0.2
+ * Copyright 2016 XWolfOVerride@gmail.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this
+ * software and associated documentation files (the "Software"), to deal in the Software
+ * without restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies
+ * or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+var mTester = merger.app("mTester", {
+ title: "Merger Tester Application",
+ appMenu: [
+ merger.ui.menuItem("app_close", {
+ text: "Close Merger Desktop",
+ icon: merger.media.closeIcon(),
+ onClick: function () {
+ merger.leave();
+ }
+ }),
+ ],
+ menu: [
+ merger.ui.menuItem("m_test", {
+ text: "Test",
+ items: [merger.ui.menuItem("mt_controls", {
+ text: "Test Controls Dialog",
+ onClick:function(){
+ this.getApplication().windows.controls.show();
+ }
+ })
+ ]
+ }),
+ ],
+ windows: [merger.ui.window("controls", {
+ title: "Control Dialog",
+ width: 200,
+ height: 200,
+ content: [merger.ui.picture("Iico", {
+ src: "https://cdn1.iconfinder.com/static/e9bcefc0c5591114fcd0b4b0aff67962/assets/img/extended-library/icon.svg",
+ top: 0,
+ left: 0,
+ width: 32,
+ height: 32,
+ }),
+ merger.ui.label("Linfo", {
+ top: 20,
+ left: 40,
+ width: 400 - 37,
+ height: 32,
+ text: "Control samples dialog.",
+ }),
+ merger.ui.button("Bok", {
+ top: 200 - 20,
+ left: 200 - 35,
+ width: 35,
+ height: 20,
+ text: "Ok",
+ onClick: function (e) {
+ this.getWindow().close();
+ }
+ }),
+ ],
+ onClose: function () {
+ this.hide();
+ //merger.leave();
+ },
+ setError: function (message, data) {
+ this.content.Lerror.setText(message);
+ this.content.Tinfo.setText(JSON.stringify(data, null, 2));
+ }
+ })],
+ onLoad: function () {
+ },
+ onAbout: function () {
+ },
+});
diff --git a/WebInquirer.html b/WebInquirer.html
index f1b54ec..23577ce 100644
--- a/WebInquirer.html
+++ b/WebInquirer.html
@@ -5,6 +5,7 @@
+