2020-06-21 17:29:27 -04:00
|
|
|
/*
|
2021-06-13 19:07:40 -04:00
|
|
|
* Copyright © 2020 Luciano Iam <oss@lucianoiam.com>
|
2020-06-21 17:29:27 -04:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
export class BaseWidget {
|
|
|
|
|
2020-07-25 11:45:39 -04:00
|
|
|
constructor (element) {
|
|
|
|
if (element) {
|
|
|
|
this.element = element;
|
|
|
|
}
|
2020-06-21 17:29:27 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
appendTo (container) {
|
|
|
|
container.appendChild(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
get id () {
|
|
|
|
return this.element.id;
|
|
|
|
}
|
|
|
|
|
|
|
|
set id (id) {
|
|
|
|
this.element.id = id;
|
|
|
|
}
|
|
|
|
|
|
|
|
get classList () {
|
|
|
|
return this.element.classList;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export class BaseContainer extends BaseWidget {
|
|
|
|
|
2020-07-25 11:45:39 -04:00
|
|
|
constructor () {
|
|
|
|
super();
|
2020-06-21 17:29:27 -04:00
|
|
|
this.children = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
appendChild (child) {
|
|
|
|
this.children.push(child);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-08-16 09:03:17 -04:00
|
|
|
export class BaseDialog extends BaseContainer {
|
|
|
|
|
|
|
|
constructor () {
|
|
|
|
super();
|
|
|
|
this.children = [];
|
|
|
|
}
|
|
|
|
|
2020-08-22 15:33:49 -04:00
|
|
|
set closeButton (button) {
|
|
|
|
// empty
|
|
|
|
}
|
|
|
|
|
2020-08-16 09:03:17 -04:00
|
|
|
show () {
|
|
|
|
// empty
|
|
|
|
}
|
|
|
|
|
2020-08-22 15:33:49 -04:00
|
|
|
close () {
|
|
|
|
// empty
|
|
|
|
}
|
|
|
|
|
|
|
|
onClose () {
|
|
|
|
// empty
|
|
|
|
}
|
|
|
|
|
2020-08-16 09:03:17 -04:00
|
|
|
}
|
|
|
|
|
2020-06-21 17:29:27 -04:00
|
|
|
export class BaseControl extends BaseWidget {
|
|
|
|
|
|
|
|
get value () {
|
|
|
|
// empty
|
|
|
|
}
|
|
|
|
|
|
|
|
set value (val) {
|
|
|
|
// empty
|
|
|
|
}
|
|
|
|
|
|
|
|
callback (val) {
|
|
|
|
// empty
|
|
|
|
}
|
|
|
|
|
|
|
|
bindTo (component, property) {
|
|
|
|
// ardour → ui
|
|
|
|
this.value = component[property];
|
|
|
|
component.on(property, (value) => this.value = value);
|
|
|
|
// ui → ardour
|
|
|
|
this.callback = (value) => component[property] = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|