2020-01-15 21:36:01 +01:00
|
|
|
import Component from "./component.js";
|
2020-01-20 22:35:52 +01:00
|
|
|
import keyboardActionsService from "../services/keyboard_actions.js";
|
2020-01-15 21:36:01 +01:00
|
|
|
|
|
|
|
class BasicWidget extends Component {
|
2020-01-11 21:19:56 +01:00
|
|
|
render() {
|
2020-01-20 22:35:52 +01:00
|
|
|
const $widget = this.doRender();
|
|
|
|
|
|
|
|
keyboardActionsService.updateDisplayedShortcuts($widget);
|
|
|
|
|
2020-02-08 21:54:39 +01:00
|
|
|
this.toggle(this.isEnabled());
|
|
|
|
|
2020-01-20 22:35:52 +01:00
|
|
|
return $widget;
|
2020-01-11 21:19:56 +01:00
|
|
|
}
|
|
|
|
|
2020-02-08 21:54:39 +01:00
|
|
|
isEnabled() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-01-11 21:19:56 +01:00
|
|
|
/**
|
|
|
|
* for overriding
|
|
|
|
*/
|
2020-01-19 09:02:18 +01:00
|
|
|
doRender() {}
|
2020-01-11 21:19:56 +01:00
|
|
|
|
2020-01-14 20:27:40 +01:00
|
|
|
toggle(show) {
|
|
|
|
this.$widget.toggle(show);
|
|
|
|
}
|
|
|
|
|
2020-02-04 22:46:17 +01:00
|
|
|
isVisible() {
|
|
|
|
return this.$widget.is(":visible");
|
|
|
|
}
|
|
|
|
|
2020-01-19 21:12:53 +01:00
|
|
|
remove() {
|
|
|
|
if (this.$widget) {
|
|
|
|
this.$widget.remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-11 21:19:56 +01:00
|
|
|
cleanup() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default BasicWidget;
|