xdo 0.0.1-x86-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +46 -0
- data/bin/xinfo.rb +136 -0
- data/lib/README.rdoc +55 -0
- data/lib/xdo.rb +28 -0
- data/lib/xdo/clipboard.rb +109 -0
- data/lib/xdo/drive.rb +66 -0
- data/lib/xdo/keyboard.rb +274 -0
- data/lib/xdo/mouse.rb +143 -0
- data/lib/xdo/wxaliases.rb +57 -0
- data/lib/xdo/xwindow.rb +416 -0
- data/samples/full_demo.rb +189 -0
- data/samples/mouse.rb +27 -0
- data/test/test_clipboard.rb +49 -0
- data/test/test_drive.rb +23 -0
- data/test/test_keyboard.rb +60 -0
- data/test/test_mouse.rb +28 -0
- data/test/test_xwindow.rb +104 -0
- metadata +94 -0
data/lib/xdo/keyboard.rb
ADDED
@@ -0,0 +1,274 @@
|
|
1
|
+
#Encoding: UTF-8
|
2
|
+
#This file is part of Xdo.
|
3
|
+
#Copyright © 2009 Marvin Gülker
|
4
|
+
# Initia in potestate nostra sunt, de eventu fortuna iudicat.
|
5
|
+
require_relative("../xdo")
|
6
|
+
require "pp"
|
7
|
+
|
8
|
+
module XDo
|
9
|
+
|
10
|
+
#A namespace encabsulating methods to simulate keyboard input. You can
|
11
|
+
#send input to special windows, use the +w_id+ parameter of many methods
|
12
|
+
#for that purpose.
|
13
|
+
#NOTE: xdotool seams to reject the <tt>--window</tt> option even if you try
|
14
|
+
#to run it directly. This command fails (where 60817411 is a window id):
|
15
|
+
# xdotool key --window 60817411 a
|
16
|
+
#So don't be surprised if it does not work with this library. Hopefully this will be
|
17
|
+
#fixed, so I leave this in.
|
18
|
+
module Keyboard
|
19
|
+
|
20
|
+
#Für jede Escape-Sequenz eine Klasse mit Befehlen erzeugen
|
21
|
+
[
|
22
|
+
[:BS, ["#{XDOTOOL} key%s BackSpace"]],
|
23
|
+
[:BACKSPACE, ["#{XDOTOOL} key%s BackSpace"]],
|
24
|
+
[:DEL, ["#{XDOTOOL} key%s Delete"]],
|
25
|
+
[:UP, ["#{XDOTOOL} key%s Up"]],
|
26
|
+
[:DOWN, ["#{XDOTOOL} key%s Down"]],
|
27
|
+
[:RIGHT, ["#{XDOTOOL} key%s Right"]],
|
28
|
+
[:LEFT, ["#{XDOTOOL} key%s Left"]],
|
29
|
+
[:HOME, ["#{XDOTOOL} key%s Home"]],
|
30
|
+
[:END, ["#{XDOTOOL} key%s End"]],
|
31
|
+
[:ESC, ["#{XDOTOOL} key%s Escape"]],
|
32
|
+
[:INS, ["#{XDOTOOL} key%s Insert"]],
|
33
|
+
[:PGUP, ["#{XDOTOOL} key%s Prior"]],
|
34
|
+
[:PGDN, ["#{XDOTOOL} key%s Next", "#{XDOTOOL} key%s Next"]],
|
35
|
+
[:F1, ["#{XDOTOOL} key%s F1"]],
|
36
|
+
[:F2, ["#{XDOTOOL} key%s F2"]],
|
37
|
+
[:F3, ["#{XDOTOOL} key%s F3"]],
|
38
|
+
[:F4, ["#{XDOTOOL} key%s F4"]],
|
39
|
+
[:F5, ["#{XDOTOOL} key%s F5"]],
|
40
|
+
[:F6, ["#{XDOTOOL} key%s F6"]],
|
41
|
+
[:F7, ["#{XDOTOOL} key%s F7"]],
|
42
|
+
[:F8, ["#{XDOTOOL} key%s F8"]],
|
43
|
+
[:F9, ["#{XDOTOOL} key%s F9"]],
|
44
|
+
[:F10, ["#{XDOTOOL} key%s F10"]],
|
45
|
+
[:F11, ["#{XDOTOOL} key%s F11"]],
|
46
|
+
[:F12, ["#{XDOTOOL} key%s F12"]],
|
47
|
+
[:TAB, ["#{XDOTOOL} key%s Tab"]],
|
48
|
+
[:PRINT, ["#{XDOTOOL} key%s Print"]],
|
49
|
+
[:NUM_LOCK, ["#{XDOTOOL} key%s Num_Lock"]],
|
50
|
+
[:PAUSE, ["#{XDOTOOL} key%s Pause"]],
|
51
|
+
[:CAPS_LOCK, ["#{XDOTOOL} key%s Caps_Lock"]],
|
52
|
+
[:NUM1, ["#{XDOTOOL} key%s KP_End"]],
|
53
|
+
[:NUM2, ["#{XDOTOOL} key%s KP_Down"]],
|
54
|
+
[:NUM3, ["#{XDOTOOL} key%s KP_Next"]],
|
55
|
+
[:NUM4, ["#{XDOTOOL} key%s KP_Left"]],
|
56
|
+
[:NUM5, ["#{XDOTOOL} key%s KP_Begin"]],
|
57
|
+
[:NUM6, ["#{XDOTOOL} key%s KP_Right"]],
|
58
|
+
[:NUM7, ["#{XDOTOOL} key%s KP_Home"]],
|
59
|
+
[:NUM8, ["#{XDOTOOL} key%s KP_Up"]],
|
60
|
+
[:NUM9, ["#{XDOTOOL} key%s KP_Prior"]],
|
61
|
+
[:NUM_DIV, ["#{XDOTOOL} key%s KP_Divide"]],
|
62
|
+
[:NUM_MUL, ["#{XDOTOOL} key%s KP_Multiply"]],
|
63
|
+
[:NUM_SUB, ["#{XDOTOOL} key%s KP_Subtract"]],
|
64
|
+
[:NUM_ADD, ["#{XDOTOOL} key%s KP_Add"]],
|
65
|
+
[:NUM_ENTER, ["#{XDOTOOL} key%s KP_Enter"]],
|
66
|
+
[:NUM_DEL, ["#{XDOTOOL} key%s KP_Delete"]],
|
67
|
+
[:NUM_COMMA, ["#{XDOTOOL} key%s KP_Separator"]],
|
68
|
+
[:NUM_INS, ["#{XDOTOOL} key%s KP_Insert"]],
|
69
|
+
[:NUM0, ["#{XDOTOOL} key%s KP_0"]],
|
70
|
+
[:SCROLL_LOCK, ["#{XDOTOOL} key%s Scroll_Lock"]],
|
71
|
+
|
72
|
+
[:REV_TAB, ["#{XDOTOOL} key%s shift+Tab"]]
|
73
|
+
].each do |name, commands|
|
74
|
+
$commands = commands
|
75
|
+
XDo::Keyboard.const_set(name, Class.new do
|
76
|
+
COMMANDS = $commands.dup
|
77
|
+
def initialize(w_id = nil) #:nodoc:
|
78
|
+
@w_id = w_id
|
79
|
+
end
|
80
|
+
def actual_commands # :nodoc:
|
81
|
+
cmds = self.class.const_get(:COMMANDS).collect do |command|
|
82
|
+
command % (@w_id.nil? ? "" : " --window #{@w_id}")
|
83
|
+
end
|
84
|
+
cmds
|
85
|
+
end
|
86
|
+
end)
|
87
|
+
end
|
88
|
+
|
89
|
+
#Special escape chars. The list is fairly uncomplete, so feel free to add chars not noted.
|
90
|
+
#Use the program +xev+ to determine how a sequence is escaped and map the char
|
91
|
+
#to the escape sequence.
|
92
|
+
SPECIAL_CHARS = {
|
93
|
+
"\n" => "Return",
|
94
|
+
" " => "space",
|
95
|
+
"?" => "shift+question",
|
96
|
+
"!" => "shift+exclam",
|
97
|
+
"," => "comma",
|
98
|
+
"." => "period",
|
99
|
+
";" => "shift+semicolon",
|
100
|
+
":" => "shift+colon",
|
101
|
+
'"' => "shift+2",
|
102
|
+
"§" => "shift+3",
|
103
|
+
"$" => "shift+4",
|
104
|
+
"%" => "shift+5",
|
105
|
+
"&" => "shift+6",
|
106
|
+
"/" => "shift+7",
|
107
|
+
"(" => "shift+8",
|
108
|
+
")" => "shift+9",
|
109
|
+
"=" => "shift+0",
|
110
|
+
"´" => "dead_acute+dead_acute",
|
111
|
+
"`" => "shift+dead_grave+shift+dead_grave",
|
112
|
+
"^" => "dead_circumflex+dead_circumflex",
|
113
|
+
"°" => "shift+degree",
|
114
|
+
"+" => "plus",
|
115
|
+
"*" => "shift+asterisk",
|
116
|
+
"#" => "numbersign",
|
117
|
+
"'" => "shift+apostrophe",
|
118
|
+
"-" => "minus",
|
119
|
+
"_" => "shift+underscore",
|
120
|
+
"<" => "less",
|
121
|
+
">" => "shift+greater",
|
122
|
+
"\t" => "Tab",
|
123
|
+
"\b" => "BackSpace",
|
124
|
+
"ä" => "adiaeresis",
|
125
|
+
"Ä" => "shift+adiaeresis",
|
126
|
+
"ö" => "odiaeresis",
|
127
|
+
"Ö" => "shift+odiaeresis",
|
128
|
+
"ü" => "udiaeresis",
|
129
|
+
"Ü" => "shift+udiaeresis",
|
130
|
+
"ß" => "ssharp",
|
131
|
+
"¹" => "ISO_Level3_Shift+1",
|
132
|
+
"²" => "ISO_Level3_Shift+2",
|
133
|
+
"³" => "ISO_Level3_Shift+3",
|
134
|
+
"¼" => "ISO_Level3_Shift+4",
|
135
|
+
"½" => "ISO_Level3_Shift+5",
|
136
|
+
"¬" => "ISO_Level3_Shift+6",
|
137
|
+
"{" => "ISO_Level3_Shift+7",
|
138
|
+
"[" => "ISO_Level3_Shift+8",
|
139
|
+
"]" => "ISO_Level3_Shift+9",
|
140
|
+
"}" => "ISO_Level3_Shift+0",
|
141
|
+
"\\" => "ISO_Level3_Shift+backslash",
|
142
|
+
"@" => "ISO_Level3_Shift+at",
|
143
|
+
"€" => "ISO_Level3_Shift+EuroSign",
|
144
|
+
"~" => "ISO_Level3_Shift+dead_tilde+IS_Level3_Shift+dead_tilde+Left+BackSpace", #xdotool seems to have a bug here, so I need to delete the extra plus sign.
|
145
|
+
"|" => "ISO_Level3_Shift+bar"
|
146
|
+
}
|
147
|
+
|
148
|
+
class << self
|
149
|
+
|
150
|
+
#Types a character sequence, but without any special chars.
|
151
|
+
#This function is a bit faster then #simulate.
|
152
|
+
def type(str, w_id = nil)
|
153
|
+
out = `#{XDOTOOL} type #{w_id ? "--window #{w_id}" : ""}"#{str}"`
|
154
|
+
nil
|
155
|
+
end
|
156
|
+
|
157
|
+
#Types a character sequence. You can use the escape sequence {...} to send special
|
158
|
+
#keystrokes, a full list of supported keystrokes is printed out by:
|
159
|
+
# puts (XDo::Keyboard.constants - [:SPECIAL_CHARS])
|
160
|
+
#This method recognizes many special chars like ? and ä, even if you disable
|
161
|
+
#the escape syntax {..} via setting the +raw+ parameter to true (that's the only way to send the { and } chars).
|
162
|
+
#It's a bit slower than the #type method.
|
163
|
+
def simulate(str, raw = false, w_id = nil)
|
164
|
+
if raw
|
165
|
+
commands = []
|
166
|
+
str.each_char do |char|
|
167
|
+
commands << "#{XDOTOOL} key #{w_id ? "--window #{w_id}" : ""}#{check_for_special_key(char)}"
|
168
|
+
end
|
169
|
+
|
170
|
+
commands.each do |cmd|
|
171
|
+
out = `#{cmd}`
|
172
|
+
end
|
173
|
+
return nil
|
174
|
+
else
|
175
|
+
raise(XDo::XError, "Invalid number of open and close braces!") unless str.scan(/{/).size == str.scan(/}/).size
|
176
|
+
tokens = []
|
177
|
+
if str =~ /{/
|
178
|
+
str.scan(/(.*?){(\w+)}/){|normal, escape| tokens << normal << escape}
|
179
|
+
#Wenn noch Text übrig ist, diesen noch dranhängen.
|
180
|
+
tokens << $' unless $'.empty?
|
181
|
+
else
|
182
|
+
#Keine Escape-Sequenz drin, also ist eine Spezialbehandlung überflüssig.
|
183
|
+
#Rekursiver Aufruf von simulate, aber als reiner Text.
|
184
|
+
simulate(str, true, w_id)
|
185
|
+
return
|
186
|
+
end
|
187
|
+
commands = []
|
188
|
+
tokens.each_with_index do |token, index|
|
189
|
+
#Jeder zweite Token muss eine Escape-Sequenz sein; selbst wenn der
|
190
|
+
#String mit einer Escape-Sequenz anfängt, wird der Reguläre Ausdruck
|
191
|
+
#einen Leerstring extrahieren.
|
192
|
+
if index.odd? #Ein Array fängt bei Null an, das zweite Element ist Eins.
|
193
|
+
#Escape-Sequenz in eine Befehlsfolge umwandeln
|
194
|
+
commands << sequence_escape(token, w_id)
|
195
|
+
#Die eingefügten Arrays plätten, damit ein einziger Befehlsstack übrig bleibt
|
196
|
+
commands.flatten!
|
197
|
+
else
|
198
|
+
#Ab hier ist der Token sicherlich normaler Text; entsprechend wird damit verfahren.
|
199
|
+
token.each_char do |char|
|
200
|
+
commands << "#{XDOTOOL} key #{w_id ? "--window #{w_id}" : ""}#{check_for_special_key(char)}"
|
201
|
+
end
|
202
|
+
commands.flatten! #Zur Sicherheit
|
203
|
+
end
|
204
|
+
end
|
205
|
+
#Ausführen aller Befehle
|
206
|
+
commands.each do |cmd|
|
207
|
+
out = `#{cmd}`
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
#Simulate a single char directly via the +key+ function of +xdotool+.
|
213
|
+
#+c+ is a single char like "a" or a combination like "shift+a".
|
214
|
+
def char(c, w_id = nil)
|
215
|
+
`#{XDOTOOL} key #{w_id ? "--window #{w_id}" : ""}#{c}`
|
216
|
+
end
|
217
|
+
alias key char
|
218
|
+
|
219
|
+
#Holds a key down. Please call #key_up after a call to this method.
|
220
|
+
def key_down(key, w_id = nil)
|
221
|
+
`#{XDOTOOL} keydown #{w_id ? "--window #{w_id}" : "" }#{check_for_special_key(key)}`
|
222
|
+
end
|
223
|
+
|
224
|
+
#Releases a key hold down by #key_down.
|
225
|
+
def key_up(key, w_id = nil)
|
226
|
+
`#{XDOTOOL} keyup #{w_id ? "--window #{w_id}" : "" }#{check_for_special_key(key)}`
|
227
|
+
end
|
228
|
+
|
229
|
+
#Deletes a char. If +right+ is true, +del_char+ uses
|
230
|
+
#the DEL key for deletion, otherwise the BackSpace key.
|
231
|
+
def delete(right = false)
|
232
|
+
Keyboard.simulate(right ? "\b" : "{DEL}")
|
233
|
+
end
|
234
|
+
|
235
|
+
#Allows you to things like this:
|
236
|
+
# XDo::Keyboard.ctrl_c
|
237
|
+
#The string will be capitalized and every _ will be replaced by a + and then passed into #char.
|
238
|
+
#You can't use this way to send whitespace or _ characters.
|
239
|
+
def method_missing(sym, *args, &block)
|
240
|
+
super if args.size > 1 or block
|
241
|
+
char(sym.to_s.capitalize.gsub("_", "+"), args[0])
|
242
|
+
end
|
243
|
+
|
244
|
+
private
|
245
|
+
|
246
|
+
#Returns a key sequence in which special chars are recognized.
|
247
|
+
def check_for_special_key(key)
|
248
|
+
if SPECIAL_CHARS.has_key? key
|
249
|
+
#Spezialzeichen
|
250
|
+
return SPECIAL_CHARS[key]
|
251
|
+
elsif key =~/\d/
|
252
|
+
#Ziffer
|
253
|
+
return key
|
254
|
+
elsif key.upcase == key
|
255
|
+
#Großgeschrieben
|
256
|
+
return "shift+#{key}"
|
257
|
+
else
|
258
|
+
#Normal
|
259
|
+
return key
|
260
|
+
end
|
261
|
+
end #check_for_special_key
|
262
|
+
|
263
|
+
#Wraps an escape sequenz in the corerresponding class and
|
264
|
+
#returns the commands needed to execute it.
|
265
|
+
def sequence_escape(token, w_id)
|
266
|
+
esc = XDo::Keyboard.const_get(token.upcase.to_sym).new(w_id)
|
267
|
+
return esc.actual_commands
|
268
|
+
end
|
269
|
+
|
270
|
+
end
|
271
|
+
|
272
|
+
end
|
273
|
+
|
274
|
+
end
|
data/lib/xdo/mouse.rb
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
#Encoding: UTF-8
|
2
|
+
#This file is part of Xdo.
|
3
|
+
#Copyright © 2009 Marvin Gülker
|
4
|
+
# Initia in potestate nostra sunt, de eventu fortuna iudicat.
|
5
|
+
require_relative("../xdo")
|
6
|
+
module XDo
|
7
|
+
|
8
|
+
#Automate your mouse! You can simulate every click you can do with
|
9
|
+
#your fingers - it's kind of funny, but don't forget to create USEFUL
|
10
|
+
#applications, not ones annoying your users (e. g. you could make
|
11
|
+
#his/her mouse unusable).
|
12
|
+
module Mouse
|
13
|
+
|
14
|
+
#Left mouse button.
|
15
|
+
LEFT = 1
|
16
|
+
#Middle mouse button (as if you click your mouse wheel).
|
17
|
+
MIDDLE = 2
|
18
|
+
#Right mouse button.
|
19
|
+
RIGHT = 3
|
20
|
+
#Mouse wheel up.
|
21
|
+
UP = 4
|
22
|
+
#Mouse wheel down.
|
23
|
+
DOWN = 5
|
24
|
+
|
25
|
+
class << self
|
26
|
+
|
27
|
+
#Gets the current cursor position, which is returned as a two-element array
|
28
|
+
#of form <code>[x, y]</code>.
|
29
|
+
def position
|
30
|
+
cmd = "#{XDOTOOL} getmouselocation"
|
31
|
+
out = `#{cmd}`
|
32
|
+
out.match(/x:(\d+) y:(\d+)/)
|
33
|
+
return [$1.to_i, $2.to_i]
|
34
|
+
end
|
35
|
+
|
36
|
+
#Moves the mouse cursor to the given position.
|
37
|
+
#If +set+ is true, this function does not move it, but set it directly
|
38
|
+
#to the position.
|
39
|
+
#You can manipulate the speed of the cursor movement by changing
|
40
|
+
#the value of speed (which is 2 pixel per time by default), but the higher
|
41
|
+
#the value is, the more inaccurate the movement is. Tough, the cursor will
|
42
|
+
#be at the specfied position in any case, regeardless of how you set +speed+.
|
43
|
+
def move(x, y, speed = 2, set = false)
|
44
|
+
if set
|
45
|
+
out = `#{XDOTOOL} mousemove #{x} #{y}`
|
46
|
+
return [x, y]
|
47
|
+
else
|
48
|
+
raise(ArgumentError, "speed has to be > 0 (default is 2), was #{speed}!") if speed <= 0
|
49
|
+
pos = position #Aktuelle Cursorposition
|
50
|
+
act_x = pos[0]
|
51
|
+
act_y = pos[1]
|
52
|
+
aim_x = x
|
53
|
+
aim_y = y
|
54
|
+
#Erschaffe die Illusion einer flüssigen Bewegung
|
55
|
+
loop do
|
56
|
+
#Position um speed verändern
|
57
|
+
if act_x > aim_x
|
58
|
+
act_x -= speed
|
59
|
+
elsif act_x < aim_x
|
60
|
+
act_x += speed
|
61
|
+
end
|
62
|
+
if act_y > aim_y
|
63
|
+
act_y -= speed
|
64
|
+
elsif act_y < aim_y
|
65
|
+
act_y += speed
|
66
|
+
end
|
67
|
+
#Cursor an neue Position setzen
|
68
|
+
move(act_x, act_y, speed, true)
|
69
|
+
#Prüfen, ob sich die aktuelle Position im durch speed definierten
|
70
|
+
#Toleranzbereich um den Zielpunkt befindet
|
71
|
+
if ((aim_x - speed)..(aim_x + speed)).include? act_x
|
72
|
+
if ((aim_y - speed)..(aim_y + speed)).include? act_y
|
73
|
+
break
|
74
|
+
end #if in Y-Toleranz
|
75
|
+
end #if in X-Toleranz
|
76
|
+
end #loop
|
77
|
+
#Falls der Cursor nicht genau auf dem Zielpunkt landet, muss
|
78
|
+
#eine Korrektur erfolgen
|
79
|
+
if position != [x, y]
|
80
|
+
move(x, y, 1, true)
|
81
|
+
end #if position != [x, y]
|
82
|
+
|
83
|
+
end #if set
|
84
|
+
return [x, y]
|
85
|
+
end #def move
|
86
|
+
|
87
|
+
#Simulates a mouse click. If you don't specify a X AND a Y position,
|
88
|
+
#the click will happen at the current cursor position, +button+ may be one of
|
89
|
+
#the follwoing constants:
|
90
|
+
#* LEFT
|
91
|
+
#* RIGHT
|
92
|
+
#* MIDDLE
|
93
|
+
#The other arguments are the same as for #move.
|
94
|
+
def click(x = nil, y = nil, button = LEFT, speed = 1, set = false)
|
95
|
+
if x and y
|
96
|
+
move(x, y, speed, set)
|
97
|
+
end
|
98
|
+
`#{XDOTOOL} click #{button}`
|
99
|
+
end
|
100
|
+
|
101
|
+
#Scroll with the mouse wheel. +amount+ is the time of steps to scroll.
|
102
|
+
#Note: The XServer handles wheel up and wheel down events like mouse click
|
103
|
+
#events and if you take a look in the source code of this function you will see, that
|
104
|
+
#it calls #click with the value of UP or DOWN. So, if you want to be funny, write something
|
105
|
+
#like
|
106
|
+
# XDo::Mouse.click(nil, nil, XDo::Mouse::UP)
|
107
|
+
#.
|
108
|
+
def wheel(dir, amount)
|
109
|
+
amount.times{click(nil, nil, dir)}
|
110
|
+
end
|
111
|
+
|
112
|
+
#Holds a mouse button down. Don't forget to release it some time.
|
113
|
+
def down(button = LEFT)
|
114
|
+
`#{XDOTOOL} mousedown #{button}`
|
115
|
+
end
|
116
|
+
|
117
|
+
#Releases a mouse button. You should call #down before using this...
|
118
|
+
def up(button = LEFT)
|
119
|
+
`#{XDOTOOL} mouseup #{button}`
|
120
|
+
end
|
121
|
+
|
122
|
+
#Executs a drag&drop operation. If you set +x1+ and +y1+ to nil,
|
123
|
+
#this method will use the current cursor position as the start position.
|
124
|
+
def drag(x1, y1, x2, y2, button = LEFT, speed = 2, set = false)
|
125
|
+
#Wenn x1 und y1 nicht übergeben werden, nehme die aktuelle Positin an
|
126
|
+
if x1.nil? and y1.nil?
|
127
|
+
x1, y1 = position
|
128
|
+
end
|
129
|
+
#Zur angegebenen Erstposition bewegen
|
130
|
+
move(x1, y1, speed, set)
|
131
|
+
#Taste gedrückt halten
|
132
|
+
down(button)
|
133
|
+
#Zur Zielposition bewegen
|
134
|
+
move(x2, y2, speed, set)
|
135
|
+
#Taste loslassen
|
136
|
+
up(button)
|
137
|
+
nil
|
138
|
+
end
|
139
|
+
|
140
|
+
end #class << self
|
141
|
+
|
142
|
+
end #module Mouse
|
143
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#Encoding: UTF-8
|
2
|
+
require "rubygems"
|
3
|
+
require "wx"
|
4
|
+
|
5
|
+
module Wx
|
6
|
+
HTMLWindow = HtmlWindow
|
7
|
+
end
|
8
|
+
|
9
|
+
class Wx::Window
|
10
|
+
alias background_colour= set_background_colour
|
11
|
+
alias background_colour get_background_colour
|
12
|
+
alias font= set_font
|
13
|
+
alias font get_font
|
14
|
+
alias foreground_colour= set_foreground_colour
|
15
|
+
alias foreground_colour get_foreground_colour
|
16
|
+
end
|
17
|
+
|
18
|
+
class Wx::TopLevelWindow
|
19
|
+
alias icon= set_icon
|
20
|
+
alias icon get_icon
|
21
|
+
end
|
22
|
+
|
23
|
+
class Wx::Frame
|
24
|
+
alias menu_bar= set_menu_bar
|
25
|
+
alias title= set_title
|
26
|
+
end
|
27
|
+
|
28
|
+
class Wx::StaticText
|
29
|
+
alias label= set_label
|
30
|
+
alias label get_label
|
31
|
+
end
|
32
|
+
|
33
|
+
class Wx::Font
|
34
|
+
alias point_size get_point_size
|
35
|
+
alias point_size= set_point_size
|
36
|
+
end
|
37
|
+
|
38
|
+
class Wx::CheckBox
|
39
|
+
alias is_checked? is_checked
|
40
|
+
def check!
|
41
|
+
set_value(true)
|
42
|
+
end
|
43
|
+
alias check check!
|
44
|
+
def uncheck!
|
45
|
+
set_value(false)
|
46
|
+
end
|
47
|
+
alias uncheck uncheck!
|
48
|
+
end
|
49
|
+
|
50
|
+
class Wx::TextCtrl
|
51
|
+
alias text= set_value
|
52
|
+
alias text get_value
|
53
|
+
end
|
54
|
+
|
55
|
+
class Wx::HTMLWindow
|
56
|
+
alias page= set_page
|
57
|
+
end
|