window class added, not functional
This commit is contained in:
parent
176ff52041
commit
02270091eb
@ -28,9 +28,67 @@ class buiButton {
|
|||||||
constructor (name, myFunction) {
|
constructor (name, myFunction) {
|
||||||
this.root = document.createElement("span");
|
this.root = document.createElement("span");
|
||||||
this.lable = document.createElement("span");
|
this.lable = document.createElement("span");
|
||||||
this.root.setAttribute("class","bui_button_root");
|
this.root.setAttribute("class","bui_button_root"+("string" == typeof name ? " "+name+"_button" : ""));
|
||||||
this.lable.setAttribute("class","bui_button_lable");
|
this.lable.setAttribute("class","bui_button_lable");
|
||||||
|
this.lable.innerText = "string" == typeof name ? name : "";
|
||||||
this.root.appendChild(this.lable);
|
this.root.appendChild(this.lable);
|
||||||
this.root.addEventListener("click", "function" == typeof myFunction ? myFunction : () => {});
|
this.root.addEventListener("click", "function" == typeof myFunction ? myFunction : () => {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function makeDraggable (targetNode, handleNode) {}
|
||||||
|
|
||||||
|
function makeResizeable (targetNode, handleNode) {}
|
||||||
|
|
||||||
|
|
||||||
|
class buiWindow {
|
||||||
|
constructor (title="", height=100, width=100, min=false, close=true, dragable=true, sizeable=true) {
|
||||||
|
this.root = document.createElement("div");
|
||||||
|
this.root.setAttribute("class","bui_window_root");
|
||||||
|
this.titlebar = document.createElement("div");
|
||||||
|
this.titlebar.setAttribute("class","bui_window_titlebar");
|
||||||
|
this.title = document.createElement("span");
|
||||||
|
this.title.setAttribute("class","bui_window_title");
|
||||||
|
this.title.innerText = "string" == title ? title : "";
|
||||||
|
this.titlebar.appendChild(this.title);
|
||||||
|
draggable = "boolean" == typeof draggable ? draggable : true;
|
||||||
|
if (draggable) {
|
||||||
|
makeDraggable(this.root, this.titlebar);
|
||||||
|
}
|
||||||
|
min = "boolean" == typeof min ? min : false;
|
||||||
|
close = "boolean" == typeof close ? close : false;
|
||||||
|
if (min || close) {
|
||||||
|
this.controls = document.createElement("span");
|
||||||
|
this.controls.setAttribute("class","bui_window_controls");
|
||||||
|
if (min) {
|
||||||
|
this.minimizeButton = new buiButton("_",this.minimize);
|
||||||
|
this.controls.appendChild(this.minimizeButton.root);
|
||||||
|
}
|
||||||
|
if (close) {
|
||||||
|
this.closeButton = new buiButton("X",this.close);
|
||||||
|
this.controls.appendChild(this.closeButton.root)
|
||||||
|
}
|
||||||
|
this.titlebar.appendChild(this.controls);
|
||||||
|
}
|
||||||
|
this.main = document.createElement("div");
|
||||||
|
this.main.setAttribute("class","bui_window_main");
|
||||||
|
this.content = document.createElement("div");
|
||||||
|
this.content.setAttribute("class","bui_window_content");
|
||||||
|
this.main.appendChild(this.content);
|
||||||
|
sizeable = "boolean" == typeof sizeable ? sizeable : true;
|
||||||
|
if (sizeable) {
|
||||||
|
this.resizeHandle = document.createElement("div");
|
||||||
|
this.resizeHandle.setAttribute("class","bui_window_resize_handle");
|
||||||
|
makeResizeable(this.content, this.resizeHandle);
|
||||||
|
this.main.appendChild(this.resizeHandle);
|
||||||
|
}
|
||||||
|
this.root.appendChild(this.titlebar);
|
||||||
|
this.root.appendChild(this.content);
|
||||||
|
}
|
||||||
|
|
||||||
|
function minimize () {
|
||||||
|
}
|
||||||
|
|
||||||
|
function close () {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user