lib/ppcurses/actions/GetDataAction.rb in ppcurses-0.0.13 vs lib/ppcurses/actions/GetDataAction.rb in ppcurses-0.0.14

- old
+ new

@@ -1,66 +1,62 @@ -require "curses" +require 'ppcurses/actions/BaseAction.rb' +module PPCurses + + +# An action that contains an array of prompt actions. +# It can be used to group together multiple prompt actions. +# class GetDataAction < BaseAction def initialize( actions ) @actions = actions unless @actions.nil? @actions.each do |action| action.setParentAction(self) end end - end def beforeActions() # Stub for classes that extend end def afterActions() # Stub for classes that extend end - def winPadding() - return 2 - end - def winWidth() - Curses.cols - winPadding() + def data() + values = [] + @actions.each do |action| + values.push(action.data()) + end + return values end - def winHeight() - Curses.lines - winPadding() - end - def createWindow() - @win = Window.new( winHeight(), winWidth(), - winPadding()/2, winPadding()/2) - + super() # Assign window to actions unless @actions.nil? @actions.each do |action| action.setWindow(@win) end end - @win.clear - @win.box("|", "-") end def execute() createWindow() echo y = @win.cury + 1 - @win.setpos(y,winPadding()) + @win.setpos(y,xPadding()) self.beforeActions() @actions.each do |action| action.execute - #y = @win.cury + 1 - #@win.setpos(y,winPadding()) end self.afterActions() noecho @@ -115,6 +111,8 @@ end end + +end