class MyTouchWindow
Attributes
keypad_is_visible[RW]
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/mytouchwindow.rb, line 31 def initialize super() fullscreen # set_icon('e.png') # set_window_position(Gtk::Window::POS_CENTER_ALWAYS) self.title='manqod Touch' agg=Gtk::AccelGroup.new agg.connect(Gdk::Keyval.to_upper(81),nil,Gtk::ACCEL_VISIBLE){ Gtk.main_quit } add_accel_group(agg) rc=" style 'keypadbutton' { bg[NORMAL]='#e09028' bg[PRELIGHT]='#eed60b' bg[ACTIVE]='#c1ee0b' xthickness=10 ythickness=10 font='Helvetica' } style 'button' { bg[NORMAL]='#0c6db1' bg[PRELIGHT]='#0cb1ab' bg[ACTIVE]='#0b41db' xthickness=10 ythickness=10 } style 'all' { bg[NORMAL] = '#fff3a4' bg[PRELIGHT] = '#ebff62' bg[ACTIVE] = '#dcfb08' xthickness = 10 ythickness = 10 GtkRange::stepper-size = 100 GtkRange::slider-width = 100 font_name = 'Serif 30' } widget '*' style 'all' widget '*Button*' style 'button' widget '*TouchButton*' style 'keypadbutton' " Gtk::RC.parse_string(rc) signal_connect("destroy") {|me| edebug("normal shutdown\n","touch","normal") Gtk.main_quit } signal_connect('key-press-event') {|me,key| edebug("key: "+key.to_s,"touch","info") } @holder=Gtk::Table.new(1,2,false) add(Gtk::Frame.new.add(@holder)) @touchcontrol=Gtk::Table.new(5,3,true) @touchcontrol.set_column_spacings(10).set_row_spacings(10) @b1=TouchButton.new('1',0,1,0,1,@touchcontrol)#.set_size_request(100, 100) @b2=TouchButton.new('2',1,2,0,1,@touchcontrol) @b3=TouchButton.new('3',2,3,0,1,@touchcontrol) @b4=TouchButton.new('4',0,1,1,2,@touchcontrol) @b5=TouchButton.new('5',1,2,1,2,@touchcontrol) @b6=TouchButton.new('6',2,3,1,2,@touchcontrol) @b7=TouchButton.new('7',0,1,2,3,@touchcontrol) @b8=TouchButton.new('8',1,2,2,3,@touchcontrol) @b9=TouchButton.new('9',2,3,2,3,@touchcontrol) @b0=TouchButton.new('0',0,1,3,4,@touchcontrol) @b000=TouchButton.new('000',1,2,3,4,@touchcontrol).modify_font(Pango::FontDescription.new.set_size(24).set_family('Helvetica').set_weight(30)) @bp=TouchButton.new('.',2,3,3,4,@touchcontrol) @back=TouchButton.new('<-',0,1,4,5,@touchcontrol) @touchcontrol.resize(5,3) @keypad=Gtk::Frame.new.add(@touchcontrol) @keypad_is_visible=false # @touchcontrol.set_no_show_all(true) end
Public Instance Methods
hide_keypad()
click to toggle source
# File lib/mytouchwindow.rb, line 157 def hide_keypad keypad(false) end
keypad(vis)
click to toggle source
# File lib/mytouchwindow.rb, line 133 def keypad(vis) if vis if !keypad_is_visible @holder.attach(@keypad,1,2,0,1,Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0) @keypad.show_all keypad_is_visible=true edebug("keypad visible set: "+vis.to_s,"touch","debug") else edebug("keypad allready visible","touch","debug") end else if keypad_is_visible @holder.remove(@keypad) keypad_is_visible=false edebug("keypad visible set: "+vis.to_s,"touch","debug") else edebug("keypad allready hidden","touch","debug") end end end
run()
click to toggle source
# File lib/mytouchwindow.rb, line 125 def run @formholder=Myform::MyFormHolder.new("touchscreen",self) @holder.attach(@formholder.holder,0,1,0,1,Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0) show_all @formholder.form.set_id("59") @formholder.form.update(self) end
show_keypad()
click to toggle source
# File lib/mytouchwindow.rb, line 154 def show_keypad keypad(true) end