Sha256: 5119412b42b0ddc11add30fe3fa363b57af1716f399052289d11eec5842c4f09
Contents?: true
Size: 1.54 KB
Versions: 2
Compression:
Stored size: 1.54 KB
Contents
require_relative '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 data() values = [] @actions.each do |action| values.push(action.data()) end return values end def createWindow() super() # Assign window to actions unless @actions.nil? @actions.each do |action| action.setWindow(@win) end end end def execute() createWindow() echo @win.setpos(@win.cury,xPadding()) self.beforeActions() @actions.each do |action| action.execute end self.afterActions() noecho @win.clear @win.refresh @win.close end def printLine(string) @win.setpos(@win.cury(), winPadding()) @win.addstr(string) @win.setpos(@win.cury() + 1, winPadding()) end def printSuccessLine(string) init_pair(1, COLOR_GREEN, COLOR_BLACK) @win.attron(color_pair(1)) self.printLine(string) @win.attroff(color_pair(1)) end def printErrorLine(string) init_pair(1, COLOR_RED, COLOR_BLACK) @win.attron(color_pair(1)) self.printLine(string) @win.attroff(color_pair(1)) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ppcurses-0.0.20 | lib/ppcurses/actions/GetDataAction.rb |
ppcurses-0.0.19 | lib/ppcurses/actions/GetDataAction.rb |