Module: CDK::WindowInput
- Included in:
- CDKOBJS
- Defined in:
- lib/cdk/mixins/window_input.rb
Instance Method Summary collapse
- #getc ⇒ Object
- #getch(function_key) ⇒ Object
- #inject(a) ⇒ Object
-
#setPostProcess(fn, data) ⇒ Object
Set data for postprocessing.
-
#setPreProcess(fn, data) ⇒ Object
Set data for preprocessing.
Instance Method Details
#getc ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/cdk/mixins/window_input.rb', line 18 def getc cdktype = self.object_type test = self.bindableObject(cdktype) result = @input_window.wgetch if result >= 0 && !(test.nil?) && test.binding_list.include?(result) && test.binding_list[result][0] == :getc result = test.binding_list[result][1] elsif test.nil? || !(test.binding_list.include?(result)) || test.binding_list[result][0].nil? case result when "\r".ord, "\n".ord result = Ncurses::KEY_ENTER when "\t".ord result = CDK::KEY_TAB when CDK::DELETE result = Ncurses::KEY_DC when "\b".ord result = Ncurses::KEY_BACKSPACE when CDK::BEGOFLINE result = Ncurses::KEY_HOME when CDK::ENDOFLINE result = Ncurses::KEY_END when CDK::FORCHAR result = Ncurses::KEY_RIGHT when CDK::BACKCHAR result = Ncurses::KEY_LEFT when CDK::NEXT result = CDK::KEY_TAB when CDK::PREV result = Ncurses::KEY_BTAB end end return result end |
#getch(function_key) ⇒ Object
55 56 57 58 59 |
# File 'lib/cdk/mixins/window_input.rb', line 55 def getch(function_key) key = self.getc function_key << (key >= Ncurses::KEY_MIN && key <= Ncurses::KEY_MAX) return key end |
#inject(a) ⇒ Object
3 4 |
# File 'lib/cdk/mixins/window_input.rb', line 3 def inject(a) end |
#setPostProcess(fn, data) ⇒ Object
Set data for postprocessing
13 14 15 16 |
# File 'lib/cdk/mixins/window_input.rb', line 13 def setPostProcess (fn, data) @post_process_func = fn @post_process_data = data end |
#setPreProcess(fn, data) ⇒ Object
Set data for preprocessing
7 8 9 10 |
# File 'lib/cdk/mixins/window_input.rb', line 7 def setPreProcess (fn, data) @pre_process_func = fn @pre_process_data = data end |