31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# File 'lib/mytouchwindow.rb', line 31
def initialize
super()
fullscreen
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) @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
end
|