diff --git a/Merger.js b/Merger.js index f8a1c84..3073070 100644 --- a/Merger.js +++ b/Merger.js @@ -809,6 +809,8 @@ c.merge(core.mkDefinition({ style: { position: "absolute", + userSelect: "none", + outline: "0", }, anchor: "TL", bringToFront: function () { @@ -990,13 +992,26 @@ def.left = document.body ? (document.body.clientWidth - def.width) / 2 : undefined; if (!def.content) def.content = []; - var w, dw = def.width, dh = def.height; + var w, dw = def.width, dh = def.height, ft; delete (def.width); delete (def.height); if (dw == undefined) dw = 300; if (dh == undefined) dh = 200; + // Frame controls + if (def.frameTools) { + var fx = 30; + ft = def.frameTools; + for (var i in ft) { + var fc = ft[i]; + fc.anchor = "TL"; + fc.setTop(1); + fc.setLeft(fx); + fc.setHeight(18); + fx += fc._width + 1; + } + } else ft = []; // Window Title var wt = control("titlebar", "windowtitle", { visible: !def.hideTitle, @@ -1036,7 +1051,7 @@ }, text: "X", }, document.createElement("button")) - ], + ].concat(ft), setTitle: function (title) { if (!this._textNode) { this._textNode = document.createTextNode(""); @@ -1045,11 +1060,15 @@ this._textNode.textContent = title; }, onmousedown: function (e) { + if (e.srcElement != wt) + return; if (e.offsetY < 1) return; DragNDrop.drag(this.parentControl, e.offsetX, e.offsetY); }, onmouseup: function (e) { + if (e.srcElement != wt) + return; DragNDrop.drop(this.parentControl); } }); @@ -1191,6 +1210,9 @@ */ function label(id, def) { var c = control("label", id, core.mkDefinition({ + style: { + userSelect: "text", + }, setText: function (text) { this.innerText = text; } @@ -1262,7 +1284,7 @@ }, style: { border: "0", - borderRadius: "7px", + borderRadius: "3px", background: sys.color.frame, color: sys.color.framecontrast, height: "20px", @@ -1304,7 +1326,7 @@ }, style: { border: "0", - borderRadius: "7px", + borderRadius: "3px", background: sys.color.frame, color: sys.color.framecontrast, height: "20px", @@ -1328,7 +1350,7 @@ }) }, getGroupButtons: function () { - var group = [], bros = this.getWindow().content, i; + var group = [], bros = (this.parentControl || {}).content, i; for (i in bros) { var b = bros[i]; if (b._type == "toggleButton" && b.group == this.group) @@ -1356,6 +1378,8 @@ if (this.onClick) this.onClick.apply(this, arguments) }, false); + if (def.selected) + c.click(); return c; } diff --git a/MergerTester.js b/MergerTester.js index 8d5da5c..c7bb85c 100644 --- a/MergerTester.js +++ b/MergerTester.js @@ -125,6 +125,27 @@ } }), ], + frameTools: [ + merger.ui.toggleButton("sample_frame_tbuttonG1", { + width: 60, + height: 20, + text: "Frame A", + selected: true, + group: "TL" + }), + merger.ui.toggleButton("sample_frame_tbuttonG2", { + width: 60, + height: 20, + text: "Frame B", + group: "TL" + }), + merger.ui.dropdown("sample_frame_dropdown", { + top: 95, + left: 0, + width: 70, + items: [{ key: "ma", value: "Mode A" }, { key: "mb", value: "Mode B" }, { key: "mc", value: "Mode C" }], + }), + ], onClose: function () { this.hide(); //merger.leave();