« get me outta code hell

Handy functions on Dialog - tui-lib - Pure Node.js library for making visual command-line programs (ala vim, ncdu)
about summary refs log tree commit diff
path: root/ui
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-07-03 01:14:41 -0300
committerFlorrie <towerofnix@gmail.com>2018-07-03 01:14:41 -0300
commit1076bd5e65658a0e846a7892cee787ade7660bb2 (patch)
treeaa71b547f738fc3e112155a2e9963ce14a4170f1 /ui
parent9743a9fcf7b8e5e5dd98cd1c74aefa36a3f70a94 (diff)
Handy functions on Dialog
Diffstat (limited to 'ui')
-rw-r--r--ui/Dialog.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/ui/Dialog.js b/ui/Dialog.js
index 26d94d8..f2db43d 100644
--- a/ui/Dialog.js
+++ b/ui/Dialog.js
@@ -29,6 +29,22 @@ module.exports = class Dialog extends FocusElement {
     this.h = this.parent.contentH
   }
 
+  open() {
+    this.opened()
+    this.visible = true
+    this.root.select(this)
+    this.fixLayout()
+  }
+
+  close() {
+    this.closed()
+    this.visible = false
+  }
+
+  opened() {}
+
+  closed() {}
+
   keyPressed(keyBuf) {
     if (telc.isCancel(keyBuf)) {
       this.emit('cancelled')