lib/ppcurses/actions/BaseAction.rb in ppcurses-0.0.9 vs lib/ppcurses/actions/BaseAction.rb in ppcurses-0.0.10
- old
+ new
@@ -1,7 +1,39 @@
require "curses"
module PPCurses
class BaseAction
+ def setWindow(win)
+ @win = win
+ end
+
+ def winPadding()
+ return 2
+ end
+
+ def winWidth()
+ Curses.cols - winPadding()
+ end
+
+ def winHeight()
+ Curses.lines - winPadding()
+ end
+
+ def createWindow()
+ @win = Window.new( winHeight(), winWidth(),
+ winPadding()/2, winPadding()/2)
+ @win.clear
+ @win.box("|", "-")
+ end
+
+ def show()
+ if @win.nil?
+ self.createWindow()
+ end
+
+ @win.refresh
+ end
+
end
+
end