ffi-tk 2010.01 → 2010.01.02
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +1 -1
- data/CHANGELOG +203 -305
- data/MANIFEST +0 -3
- data/ffi-tk.gemspec +3 -3
- data/lib/ffi-tk/command/bind.rb +4 -21
- data/lib/ffi-tk/command/bindtags.rb +2 -6
- data/lib/ffi-tk/command/clipboard.rb +2 -7
- data/lib/ffi-tk/command/event.rb +2 -2
- data/lib/ffi-tk/command/grab.rb +2 -2
- data/lib/ffi-tk/command/grid.rb +7 -7
- data/lib/ffi-tk/command/place.rb +6 -2
- data/lib/ffi-tk/command/scrollable.rb +19 -19
- data/lib/ffi-tk/command/selection.rb +3 -3
- data/lib/ffi-tk/command/tk_cmd.rb +3 -4
- data/lib/ffi-tk/command/winfo.rb +2 -2
- data/lib/ffi-tk/core_extensions.rb +3 -6
- data/lib/ffi-tk/event/data.rb +3 -34
- data/lib/ffi-tk/event/handler.rb +2 -11
- data/lib/ffi-tk/ffi/tcl/interp.rb +0 -3
- data/lib/ffi-tk/ffi/tk.rb +0 -33
- data/lib/ffi-tk/tk.rb +2 -2
- data/lib/ffi-tk/version.rb +1 -1
- data/lib/ffi-tk/widget/checkbutton.rb +3 -3
- data/lib/ffi-tk/widget/listbox.rb +3 -3
- data/lib/ffi-tk/widget/menu.rb +6 -5
- data/lib/ffi-tk/widget/panedwindow.rb +69 -95
- data/lib/ffi-tk/widget/text.rb +10 -42
- data/lib/ffi-tk/widget/tile/notebook.rb +10 -17
- data/lib/ffi-tk/widget/tile/panedwindow.rb +1 -53
- data/lib/ffi-tk/widget/tile/sizegrip.rb +2 -2
- data/lib/ffi-tk/widget/tile/style.rb +1 -1
- data/lib/ffi-tk/widget/tile/treeview.rb +2 -6
- metadata +2 -5
- data/.gitignore +0 -1
- data/example/tile/themes.rb +0 -13
- data/spec/ffi-tk/command/bind.rb +0 -25
data/MANIFEST
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
.gitignore
|
2
1
|
AUTHORS
|
3
2
|
CHANGELOG
|
4
3
|
MANIFEST
|
@@ -21,7 +20,6 @@ example/tile/kroc_demo_small.rb
|
|
21
20
|
example/tile/kroc_rb_demo.rb
|
22
21
|
example/tile/notebook.rb
|
23
22
|
example/tile/theme_hello.rb
|
24
|
-
example/tile/themes.rb
|
25
23
|
example/tile/treeview.rb
|
26
24
|
example/tkgo.rb
|
27
25
|
example/various.rb
|
@@ -128,7 +126,6 @@ lib/ffi-tk/widget/tile/sizegrip.rb
|
|
128
126
|
lib/ffi-tk/widget/tile/style.rb
|
129
127
|
lib/ffi-tk/widget/tile/treeview.rb
|
130
128
|
lib/ffi-tk/widget/toplevel.rb
|
131
|
-
spec/ffi-tk/command/bind.rb
|
132
129
|
spec/ffi-tk/command/bindtags.rb
|
133
130
|
spec/ffi-tk/command/clipboard.rb
|
134
131
|
spec/ffi-tk/command/font.rb
|
data/ffi-tk.gemspec
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{ffi-tk}
|
5
|
-
s.version = "2010.01"
|
5
|
+
s.version = "2010.01.02"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Michael 'manveru' Fellinger"]
|
9
|
-
s.date = %q{2010-01-
|
9
|
+
s.date = %q{2010-01-02}
|
10
10
|
s.description = %q{Pure Ruby FFI wrapper for the Tk GUI toolkit.}
|
11
11
|
s.email = %q{m.fellinger@gmail.com}
|
12
|
-
s.files = ["
|
12
|
+
s.files = ["AUTHORS", "CHANGELOG", "MANIFEST", "README.md", "Rakefile", "TODO.md", "bin/rwish", "doc/MIT_LICENSE", "doc/TCL_LICENSE", "example/choose_color.rb", "example/choose_directory.rb", "example/dialog.rb", "example/hello.rb", "example/message_box.rb", "example/option_menu.rb", "example/popup.rb", "example/set_palette.rb", "example/text.rb", "example/tile/kroc_demo_small.rb", "example/tile/kroc_rb_demo.rb", "example/tile/notebook.rb", "example/tile/theme_hello.rb", "example/tile/treeview.rb", "example/tkgo.rb", "example/various.rb", "example/wait.rb", "ffi-tk.gemspec", "lib/ffi-tk.rb", "lib/ffi-tk/command.rb", "lib/ffi-tk/command/after.rb", "lib/ffi-tk/command/bell.rb", "lib/ffi-tk/command/bind.rb", "lib/ffi-tk/command/bindtags.rb", "lib/ffi-tk/command/cget.rb", "lib/ffi-tk/command/choose_color.rb", "lib/ffi-tk/command/choose_directory.rb", "lib/ffi-tk/command/clipboard.rb", "lib/ffi-tk/command/configure.rb", "lib/ffi-tk/command/destroy.rb", "lib/ffi-tk/command/dialog.rb", "lib/ffi-tk/command/event.rb", "lib/ffi-tk/command/focus.rb", "lib/ffi-tk/command/font.rb", "lib/ffi-tk/command/get_open_file.rb", "lib/ffi-tk/command/get_save_file.rb", "lib/ffi-tk/command/grab.rb", "lib/ffi-tk/command/grid.rb", "lib/ffi-tk/command/image.rb", "lib/ffi-tk/command/lower.rb", "lib/ffi-tk/command/message_box.rb", "lib/ffi-tk/command/option_menu.rb", "lib/ffi-tk/command/pack.rb", "lib/ffi-tk/command/place.rb", "lib/ffi-tk/command/popup.rb", "lib/ffi-tk/command/raise.rb", "lib/ffi-tk/command/scrollable.rb", "lib/ffi-tk/command/selection.rb", "lib/ffi-tk/command/set_palette.rb", "lib/ffi-tk/command/tk_cmd.rb", "lib/ffi-tk/command/vars.rb", "lib/ffi-tk/command/wait.rb", "lib/ffi-tk/command/winfo.rb", "lib/ffi-tk/command/wm.rb", "lib/ffi-tk/core_extensions.rb", "lib/ffi-tk/event/data.rb", "lib/ffi-tk/event/handler.rb", "lib/ffi-tk/ffi/tcl.rb", "lib/ffi-tk/ffi/tcl/cmd_proc.rb", "lib/ffi-tk/ffi/tcl/eval_result.rb", "lib/ffi-tk/ffi/tcl/interp.rb", "lib/ffi-tk/ffi/tcl/obj.rb", "lib/ffi-tk/ffi/tcl/time.rb", "lib/ffi-tk/ffi/tk.rb", "lib/ffi-tk/geometry.rb", "lib/ffi-tk/thread_sender.rb", "lib/ffi-tk/tk.rb", "lib/ffi-tk/variable.rb", "lib/ffi-tk/version.rb", "lib/ffi-tk/widget.rb", "lib/ffi-tk/widget/button.rb", "lib/ffi-tk/widget/canvas.rb", "lib/ffi-tk/widget/canvas/arc.rb", "lib/ffi-tk/widget/canvas/bitmap.rb", "lib/ffi-tk/widget/canvas/image.rb", "lib/ffi-tk/widget/canvas/item.rb", "lib/ffi-tk/widget/canvas/line.rb", "lib/ffi-tk/widget/canvas/oval.rb", "lib/ffi-tk/widget/canvas/polygon.rb", "lib/ffi-tk/widget/canvas/rectangle.rb", "lib/ffi-tk/widget/canvas/text.rb", "lib/ffi-tk/widget/canvas/window.rb", "lib/ffi-tk/widget/checkbutton.rb", "lib/ffi-tk/widget/entry.rb", "lib/ffi-tk/widget/frame.rb", "lib/ffi-tk/widget/label.rb", "lib/ffi-tk/widget/labelframe.rb", "lib/ffi-tk/widget/listbox.rb", "lib/ffi-tk/widget/menu.rb", "lib/ffi-tk/widget/menubutton.rb", "lib/ffi-tk/widget/message.rb", "lib/ffi-tk/widget/panedwindow.rb", "lib/ffi-tk/widget/radiobutton.rb", "lib/ffi-tk/widget/root.rb", "lib/ffi-tk/widget/scale.rb", "lib/ffi-tk/widget/scrollbar.rb", "lib/ffi-tk/widget/spinbox.rb", "lib/ffi-tk/widget/text.rb", "lib/ffi-tk/widget/text/peer.rb", "lib/ffi-tk/widget/tile.rb", "lib/ffi-tk/widget/tile/button.rb", "lib/ffi-tk/widget/tile/checkbutton.rb", "lib/ffi-tk/widget/tile/combobox.rb", "lib/ffi-tk/widget/tile/entry.rb", "lib/ffi-tk/widget/tile/frame.rb", "lib/ffi-tk/widget/tile/label.rb", "lib/ffi-tk/widget/tile/labelframe.rb", "lib/ffi-tk/widget/tile/menubutton.rb", "lib/ffi-tk/widget/tile/notebook.rb", "lib/ffi-tk/widget/tile/panedwindow.rb", "lib/ffi-tk/widget/tile/progressbar.rb", "lib/ffi-tk/widget/tile/radiobutton.rb", "lib/ffi-tk/widget/tile/scale.rb", "lib/ffi-tk/widget/tile/scrollbar.rb", "lib/ffi-tk/widget/tile/separator.rb", "lib/ffi-tk/widget/tile/sizegrip.rb", "lib/ffi-tk/widget/tile/style.rb", "lib/ffi-tk/widget/tile/treeview.rb", "lib/ffi-tk/widget/toplevel.rb", "spec/ffi-tk/command/bindtags.rb", "spec/ffi-tk/command/clipboard.rb", "spec/ffi-tk/command/font.rb", "spec/ffi-tk/command/grid.rb", "spec/ffi-tk/command/image.rb", "spec/ffi-tk/command/pack.rb", "spec/ffi-tk/command/place.rb", "spec/ffi-tk/command/selection.rb", "spec/ffi-tk/command/vars.rb", "spec/ffi-tk/command/winfo.rb", "spec/ffi-tk/command/wm.rb", "spec/ffi-tk/event.rb", "spec/ffi-tk/tile/button.rb", "spec/ffi-tk/tile/checkbutton.rb", "spec/ffi-tk/tile/combobox.rb", "spec/ffi-tk/tile/entry.rb", "spec/ffi-tk/tile/frame.rb", "spec/ffi-tk/tile/label.rb", "spec/ffi-tk/tile/labelframe.rb", "spec/ffi-tk/tile/menubutton.rb", "spec/ffi-tk/tile/notebook.rb", "spec/ffi-tk/tile/panedwindow.rb", "spec/ffi-tk/tile/progressbar.rb", "spec/ffi-tk/tile/radiobutton.rb", "spec/ffi-tk/tile/scale.rb", "spec/ffi-tk/tile/scrollbar.rb", "spec/ffi-tk/tile/separator.rb", "spec/ffi-tk/tile/sizegrip.rb", "spec/ffi-tk/tile/style.rb", "spec/ffi-tk/tile/treeview.rb", "spec/ffi-tk/variable.rb", "spec/ffi-tk/widget/button.rb", "spec/ffi-tk/widget/canvas.rb", "spec/ffi-tk/widget/checkbutton.rb", "spec/ffi-tk/widget/entry.rb", "spec/ffi-tk/widget/frame.rb", "spec/ffi-tk/widget/label.rb", "spec/ffi-tk/widget/labelframe.rb", "spec/ffi-tk/widget/listbox.rb", "spec/ffi-tk/widget/menu.rb", "spec/ffi-tk/widget/menubutton.rb", "spec/ffi-tk/widget/message.rb", "spec/ffi-tk/widget/panedwindow.rb", "spec/ffi-tk/widget/radiobutton.rb", "spec/ffi-tk/widget/root.rb", "spec/ffi-tk/widget/scale.rb", "spec/ffi-tk/widget/scrollbar.rb", "spec/ffi-tk/widget/spinbox.rb", "spec/ffi-tk/widget/text.rb", "spec/ffi-tk/widget/toplevel.rb", "spec/helper.rb", "tasks/authors.rake", "tasks/bacon.rake", "tasks/changelog.rake", "tasks/gem.rake", "tasks/gem_setup.rake", "tasks/grancher.rake", "tasks/manifest.rake", "tasks/rcov.rake", "tasks/release.rake", "tasks/reversion.rake", "tasks/setup.rake", "tasks/ycov.rake"]
|
13
13
|
s.homepage = %q{http://github.com/manveru/ffi-tk}
|
14
14
|
s.require_paths = ["lib"]
|
15
15
|
s.rubygems_version = %q{1.3.5}
|
data/lib/ffi-tk/command/bind.rb
CHANGED
@@ -1,28 +1,11 @@
|
|
1
1
|
module Tk
|
2
2
|
module Bind
|
3
|
-
def self.bind(
|
4
|
-
|
5
|
-
Tk.execute(:bind, tag).to_a
|
6
|
-
else
|
7
|
-
if block_given?
|
8
|
-
Event::Handler.register(tag, sequence, &Proc.new)
|
9
|
-
else
|
10
|
-
Tk.execute(:bind, tag, sequence).to_s
|
11
|
-
end
|
12
|
-
end
|
3
|
+
def self.bind(pathname, sequence, &block)
|
4
|
+
Event::Handler.register(pathname, sequence, &block)
|
13
5
|
end
|
14
6
|
|
15
|
-
|
16
|
-
def self.unbind(tag, sequence)
|
17
|
-
Event::Handler.unregister(tag, sequence)
|
18
|
-
end
|
19
|
-
|
20
|
-
def bind(sequence = None, &block)
|
7
|
+
def bind(sequence, &block)
|
21
8
|
Bind.bind(tk_pathname, sequence, &block)
|
22
9
|
end
|
23
|
-
|
24
|
-
def unbind(sequence)
|
25
|
-
Bind.unbind(tk_pathname, sequence)
|
26
|
-
end
|
27
10
|
end
|
28
|
-
end
|
11
|
+
end
|
@@ -58,16 +58,12 @@ module Tk
|
|
58
58
|
end
|
59
59
|
|
60
60
|
class BindTag < Struct.new(:name)
|
61
|
-
def bind(sequence
|
61
|
+
def bind(sequence, &block)
|
62
62
|
Bind.bind(name, sequence, &block)
|
63
63
|
end
|
64
64
|
|
65
|
-
def unbind(sequence)
|
66
|
-
Bind.unbind(name, sequence)
|
67
|
-
end
|
68
|
-
|
69
65
|
def to_tcl
|
70
66
|
TclString.new(name)
|
71
67
|
end
|
72
68
|
end
|
73
|
-
end
|
69
|
+
end
|
@@ -21,7 +21,8 @@ module Tk
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def clipboard_set(string, options = {})
|
24
|
-
|
24
|
+
clipboard_clear
|
25
|
+
clipboard_append(options.merge(data: string))
|
25
26
|
end
|
26
27
|
|
27
28
|
module_function
|
@@ -84,12 +85,6 @@ module Tk
|
|
84
85
|
Tk.execute_only(:clipboard, :append, *args)
|
85
86
|
end
|
86
87
|
|
87
|
-
# Shortcut to clear clipboard and append given +string+.
|
88
|
-
def set(string, options = {})
|
89
|
-
clear
|
90
|
-
append(options.merge(data: string))
|
91
|
-
end
|
92
|
-
|
93
88
|
# Retrieve data from the clipboard on +window+'s display.
|
94
89
|
# +window+ defaults to ".".
|
95
90
|
# +type+ specifies the form in which the data is to be returned and should be
|
data/lib/ffi-tk/command/event.rb
CHANGED
@@ -60,7 +60,7 @@ module Tk
|
|
60
60
|
# processed. Certain events, such as key events, require that the window has
|
61
61
|
# focus to receive the event properly.
|
62
62
|
def self.generate(window = None, event = None, options = {})
|
63
|
-
Tk.execute_only(:event, :generate, window, event, options
|
63
|
+
Tk.execute_only(:event, :generate, window, event, options)
|
64
64
|
end
|
65
65
|
|
66
66
|
# Returns information about virtual events.
|
@@ -76,4 +76,4 @@ module Tk
|
|
76
76
|
Tk.execute(:event, :info, virtual).to_a
|
77
77
|
end
|
78
78
|
end
|
79
|
-
end
|
79
|
+
end
|
data/lib/ffi-tk/command/grab.rb
CHANGED
@@ -25,7 +25,7 @@ module Tk
|
|
25
25
|
# mouse motion events are reported to window, and window entry and window exit
|
26
26
|
# events are ignored.
|
27
27
|
#
|
28
|
-
# The grab subtree owns the pointer: windows outside the grab subtree
|
28
|
+
# The grab subtree âownsâ the pointer: windows outside the grab subtree
|
29
29
|
# will be visible on the screen but they will be insensitive until the grab is
|
30
30
|
# released. The tree of windows underneath the grab window can include
|
31
31
|
# top-level windows, in which case all of those top-level windows and their
|
@@ -138,4 +138,4 @@ module Tk
|
|
138
138
|
Tk.execute(:grab, :set, '-global', window)
|
139
139
|
end
|
140
140
|
end
|
141
|
-
end
|
141
|
+
end
|
data/lib/ffi-tk/command/grid.rb
CHANGED
@@ -70,9 +70,9 @@ module Tk
|
|
70
70
|
# If only an option is specified, with no value, the current value of that
|
71
71
|
# option is returned.
|
72
72
|
# If only the master window and index is specified, all the current settings
|
73
|
-
# are returned in a list of
|
74
|
-
def self.columnconfigure(master, index, options =
|
75
|
-
Tk.execute('grid', 'columnconfigure', master, index, options
|
73
|
+
# are returned in a list of â-option valueâ pairs.
|
74
|
+
def self.columnconfigure(master, index, options = {})
|
75
|
+
Tk.execute('grid', 'columnconfigure', master, index, options)
|
76
76
|
end
|
77
77
|
|
78
78
|
# The arguments consist of the names of one or more slave windows followed
|
@@ -97,7 +97,7 @@ module Tk
|
|
97
97
|
# Returns a list whose elements are the current configuration state of the
|
98
98
|
# slave given by slave in the same option-value form that might be specified
|
99
99
|
# to grid configure.
|
100
|
-
# The first two elements of the list are
|
100
|
+
# The first two elements of the list are â-in masterâ where master is
|
101
101
|
# the slave's master.
|
102
102
|
def self.info(slave)
|
103
103
|
Tk.execute('grid', 'info', slave)
|
@@ -148,7 +148,7 @@ module Tk
|
|
148
148
|
# If only an option is specified, with no value, the current value of that
|
149
149
|
# option is returned.
|
150
150
|
# If only the master window and index is specified, all the current settings
|
151
|
-
# are returned in a list of
|
151
|
+
# are returned in a list of â-option valueâ pairs.
|
152
152
|
def self.rowconfigure(master, index, options = None)
|
153
153
|
Tk.execute('grid', 'rowconfigure', master, index, options.to_tcl_options?)
|
154
154
|
end
|
@@ -194,8 +194,8 @@ module Tk
|
|
194
194
|
end
|
195
195
|
|
196
196
|
# @see Grid::columnconfigure
|
197
|
-
def grid_columnconfigure(index, options =
|
198
|
-
Grid.columnconfigure(self, index, options)
|
197
|
+
def grid_columnconfigure(index, options = {})
|
198
|
+
Grid.columnconfigure(self, index, options.to_tcl_options)
|
199
199
|
end
|
200
200
|
|
201
201
|
# @see Grid::configure
|
data/lib/ffi-tk/command/place.rb
CHANGED
@@ -32,7 +32,11 @@ module Tk
|
|
32
32
|
# option(s) to have the given value(s); in this case the command returns
|
33
33
|
# nil.
|
34
34
|
def self.configure(window, options = None)
|
35
|
-
|
35
|
+
if options == None
|
36
|
+
Tk.execute('place', 'configure', window)
|
37
|
+
else
|
38
|
+
Tk.execute_only('place', 'configure', window, options)
|
39
|
+
end
|
36
40
|
end
|
37
41
|
|
38
42
|
def self.forget(window)
|
@@ -84,4 +88,4 @@ module Tk
|
|
84
88
|
Place.slaves(self)
|
85
89
|
end
|
86
90
|
end
|
87
|
-
end
|
91
|
+
end
|
@@ -31,14 +31,14 @@ module Tk
|
|
31
31
|
# This command shifts the view in the window left or right according to
|
32
32
|
# number and what.
|
33
33
|
# What must be units, pages or pixels.
|
34
|
-
# If what is units or pages then number must be an integer, otherwise
|
35
|
-
# number may be specified in any of the forms
|
36
|
-
# Tk_GetPixels, such as
|
37
|
-
# nearest integer value.
|
34
|
+
# If what is units or pages then number │ must be an integer, otherwise
|
35
|
+
# number may be specified in any of the forms accept│ able to
|
36
|
+
# Tk_GetPixels, such as “2.0c” or “1i” (the result is rounded to the
|
37
|
+
# nearest │ integer value.
|
38
38
|
# If no units are given, pixels are assumed).
|
39
|
-
# If what is units, the view adjusts left or right by number
|
40
|
-
# average-width characters on the display; if it is pages then the view
|
41
|
-
# adjusts by number screenfuls; if it is pixels then the view adjusts by
|
39
|
+
# If what is units, the │ view adjusts left or right by number
|
40
|
+
# average-width characters on the display; if │ it is pages then the view
|
41
|
+
# adjusts by number screenfuls; if it is pixels then the │ view adjusts by
|
42
42
|
# number pixels.
|
43
43
|
# If number is negative then characters farther to the left become visible;
|
44
44
|
# if it is positive then characters farther to the right become visible.
|
@@ -75,11 +75,11 @@ module Tk
|
|
75
75
|
# Fraction is a fraction between 0 and 1; 0 indicates the first pixel of
|
76
76
|
# the first character in the text, 0.33 indicates the pixel that is
|
77
77
|
# one-third the way through the text; and so on.
|
78
|
-
# Values close to 1 will indicate values close to the last pixel in the
|
79
|
-
# text (1 actually refers to one pixel beyond the last pixel), but in
|
80
|
-
# such cases the widget will never scroll beyond the last pixel, and so a
|
81
|
-
# value of 1 will effectively be rounded back to whatever fraction
|
82
|
-
# ensures the last pixel is at the bottom of the window, and some other
|
78
|
+
# Values close to 1 │ will indicate values close to the last pixel in the
|
79
|
+
# text (1 actually refers to one │ pixel beyond the last pixel), but in
|
80
|
+
# such cases the widget will never scroll │ beyond the last pixel, and so a
|
81
|
+
# value of 1 will effectively be rounded back to │ whatever fraction
|
82
|
+
# ensures the last pixel is at the bottom of the window, and some │ other
|
83
83
|
# pixel is at the top.
|
84
84
|
def yview_moveto(fraction)
|
85
85
|
execute_only(:yview, :moveto, fraction)
|
@@ -88,14 +88,14 @@ module Tk
|
|
88
88
|
# This command adjust the view in the window up or down according to number
|
89
89
|
# and what.
|
90
90
|
# What must be units, pages or pixels.
|
91
|
-
# If what is units or pages then number must be an integer, otherwise
|
92
|
-
# number may be specified in any of the forms
|
93
|
-
# Tk_GetPixels, such as
|
94
|
-
# nearest integer value.
|
91
|
+
# If what is units or pages then number │ must be an integer, otherwise
|
92
|
+
# number may be specified in any of the forms accept│ able to
|
93
|
+
# Tk_GetPixels, such as “2.0c” or “1i” (the result is rounded to the
|
94
|
+
# nearest │ integer value.
|
95
95
|
# If no units are given, pixels are assumed).
|
96
|
-
# If what is units, the view adjusts up or down by number lines on the
|
97
|
-
# display; if it is pages then the view adjusts by number screenfuls; if
|
98
|
-
# it is pixels then the view adjusts by number pixels.
|
96
|
+
# If what is units, the │ view adjusts up or down by number lines on the
|
97
|
+
# display; if it is pages then the │ view adjusts by number screenfuls; if
|
98
|
+
# it is pixels then the view adjusts by number │ pixels.
|
99
99
|
# If number is negative then earlier positions in the text become visible;
|
100
100
|
# if it is positive then later positions in the text become visible.
|
101
101
|
def yview_scroll(number, what)
|
@@ -35,9 +35,9 @@ module Tk
|
|
35
35
|
end
|
36
36
|
|
37
37
|
# Retrieves the value of selection from window's display and returns it as a
|
38
|
-
# result. Selection defaults to PRIMARY and window defaults to
|
38
|
+
# result. Selection defaults to PRIMARY and window defaults to â.â.
|
39
39
|
# Type specifies the form in which the selection is to be returned (the
|
40
|
-
# desired
|
40
|
+
# desired âtargetâ for conversion, in ICCCM terminology), and should be
|
41
41
|
# an atom name such as STRING or FILE_NAME; see the Inter-Client
|
42
42
|
# Communication Conventions Manual for complete details.
|
43
43
|
# Type defaults to STRING.
|
@@ -129,4 +129,4 @@ module Tk
|
|
129
129
|
end
|
130
130
|
end
|
131
131
|
end
|
132
|
-
end
|
132
|
+
end
|
@@ -51,9 +51,8 @@ module Tk
|
|
51
51
|
# application (the name that may be used in send commands to communicate
|
52
52
|
# with the application).
|
53
53
|
# If newName is specified, then the name of the application is changed to
|
54
|
-
# newName.
|
55
|
-
#
|
56
|
-
# "#3" is appended in order to make the name unique.
|
54
|
+
# newName. If the given name is already in use, then a suffix of the form “
|
55
|
+
# #2” or “ #3” is appended in order to make the name unique.
|
57
56
|
# The command's result is the name actually chosen.
|
58
57
|
# newName should not start with a capital letter.
|
59
58
|
# This will interfere with option processing, since names starting with
|
@@ -91,7 +90,7 @@ module Tk
|
|
91
90
|
# If the window argument is omitted, it defaults to the main window.
|
92
91
|
# If the number argument is omitted, the current value of the scaling
|
93
92
|
# factor is returned.
|
94
|
-
# A
|
93
|
+
# A “point” is a unit of measurement equal to 1/72 inch.
|
95
94
|
# A scaling factor of 1.0 corresponds to 1 pixel per point, which is
|
96
95
|
# equivalent to a standard 72 dpi monitor.
|
97
96
|
# A scaling factor of 1.25 would mean 1.25 pixels per point, which is the
|
data/lib/ffi-tk/command/winfo.rb
CHANGED
@@ -434,7 +434,7 @@ module Tk
|
|
434
434
|
# Returns the number of pixels in window corresponding to the distance
|
435
435
|
# given by number.
|
436
436
|
# Number may be specified in any of the forms acceptable to Tk_GetPixels,
|
437
|
-
# such as
|
437
|
+
# such as “2.0c” or “1i”.
|
438
438
|
# The result is rounded to the nearest integer value; for a fractional
|
439
439
|
# result, use winfo fpixels.
|
440
440
|
def pixels(window, number)
|
@@ -665,4 +665,4 @@ module Tk
|
|
665
665
|
Tk.execute(:winfo, :y, window)
|
666
666
|
end
|
667
667
|
end
|
668
|
-
end
|
668
|
+
end
|
@@ -14,8 +14,6 @@ module Tk
|
|
14
14
|
TclString.new('{' << map(&:to_tcl).compact.join(' ') << '}')
|
15
15
|
end
|
16
16
|
|
17
|
-
# try to convert to a Hash.
|
18
|
-
# it may return an Array if this contains none.
|
19
17
|
def tcl_options_to_hash(hints = {})
|
20
18
|
if first.respond_to?(:to_ary)
|
21
19
|
hash = {}
|
@@ -38,8 +36,9 @@ module Tk
|
|
38
36
|
end
|
39
37
|
|
40
38
|
hash
|
41
|
-
|
39
|
+
else
|
42
40
|
::Hash[each_slice(2).map{|key, value|
|
41
|
+
|
43
42
|
key = key.sub(/^-/, '').to_sym
|
44
43
|
|
45
44
|
case hint = hints[key]
|
@@ -53,8 +52,6 @@ module Tk
|
|
53
52
|
[key, value]
|
54
53
|
end
|
55
54
|
}]
|
56
|
-
else
|
57
|
-
self
|
58
55
|
end
|
59
56
|
end
|
60
57
|
end
|
@@ -98,7 +95,7 @@ module Tk
|
|
98
95
|
|
99
96
|
module String
|
100
97
|
def to_tcl
|
101
|
-
TclString.new('"' << gsub(/[\[\]
|
98
|
+
TclString.new('"' << gsub(/[\[\]$"\\]/, '\\\\\&') << '"')
|
102
99
|
end
|
103
100
|
|
104
101
|
def to_tcl_option
|
data/lib/ffi-tk/event/data.rb
CHANGED
@@ -33,8 +33,8 @@ module Tk
|
|
33
33
|
['%K', :String, :keysym ],
|
34
34
|
['%N', :Integer, :keysym_number ],
|
35
35
|
['%P', :String, :property ],
|
36
|
-
['%R', :
|
37
|
-
['%S', :
|
36
|
+
['%R', :Integer, :root ],
|
37
|
+
['%S', :Integer, :subwindow ],
|
38
38
|
['%T', :Integer, :type ],
|
39
39
|
['%W', :String, :window_path ],
|
40
40
|
['%X', :Integer, :x_root ],
|
@@ -45,8 +45,7 @@ module Tk
|
|
45
45
|
super id, sequence
|
46
46
|
|
47
47
|
PROPERTIES.each do |code, conv, name|
|
48
|
-
|
49
|
-
converted = __send__(conv, value)
|
48
|
+
converted = __send__(conv, properties.shift)
|
50
49
|
next if converted == '??'
|
51
50
|
self[name] = converted
|
52
51
|
end
|
@@ -55,36 +54,6 @@ module Tk
|
|
55
54
|
def call
|
56
55
|
Handler.invoke(id, self) if id
|
57
56
|
end
|
58
|
-
|
59
|
-
# Try to resend the event with as much information preserved as possible.
|
60
|
-
# Unfortunately that doesn't seem to be easy.
|
61
|
-
def resend(widget, virtual, changes = {})
|
62
|
-
original = {}
|
63
|
-
members.each do |name|
|
64
|
-
value = self[name]
|
65
|
-
|
66
|
-
case name
|
67
|
-
when :id, :sequence, :border_width, :button, :count, :focus, :height,
|
68
|
-
:keycode, :keysym, :keysym_number, :mode, :mousewheel_delta,
|
69
|
-
:override_redirect, :place, :property, :root, :send_event,
|
70
|
-
:subwindow, :type, :unicode, :width, :window, :window_path
|
71
|
-
when :x_root
|
72
|
-
original[:rootx] = value
|
73
|
-
when :y_root
|
74
|
-
original[:rooty] = value
|
75
|
-
when :detail
|
76
|
-
original[name] = value if value
|
77
|
-
else
|
78
|
-
original[name] = value
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
Event.generate(widget, virtual, original.merge(changes))
|
83
|
-
end
|
84
|
-
|
85
|
-
def widget
|
86
|
-
Tk.widgets[window_path]
|
87
|
-
end
|
88
57
|
end
|
89
58
|
end
|
90
59
|
end
|
data/lib/ffi-tk/event/handler.rb
CHANGED
@@ -4,7 +4,6 @@ module Tk
|
|
4
4
|
data = Data::PROPERTIES.transpose[0].join(' ').gsub(/%/, '%%')
|
5
5
|
@callback = %(bind %s %s { ::RubyFFI::event %d %s #{data} })
|
6
6
|
@store = []
|
7
|
-
@bound = {}
|
8
7
|
@mutex = Mutex.new
|
9
8
|
|
10
9
|
module_function
|
@@ -28,7 +27,6 @@ module Tk
|
|
28
27
|
def register(tag, sequence, &block)
|
29
28
|
id = register_block(block)
|
30
29
|
Tk.interp.eval(@callback % [tag, sequence, id, sequence])
|
31
|
-
@bound[[tag, sequence]] = block
|
32
30
|
id
|
33
31
|
end
|
34
32
|
|
@@ -38,15 +36,8 @@ module Tk
|
|
38
36
|
id
|
39
37
|
end
|
40
38
|
|
41
|
-
def unregister(
|
42
|
-
|
43
|
-
|
44
|
-
if block = @bound[key]
|
45
|
-
Tk.execute(:bind, tag, sequence, nil)
|
46
|
-
id = @store.index(block)
|
47
|
-
@store[id] = nil
|
48
|
-
@bound.delete(key)
|
49
|
-
end
|
39
|
+
def unregister(id)
|
40
|
+
@store[id] = nil
|
50
41
|
end
|
51
42
|
end
|
52
43
|
end
|
@@ -30,9 +30,6 @@ module FFI
|
|
30
30
|
Tcl.new_string_obj(ruby_obj, ruby_obj.bytesize)
|
31
31
|
when Fixnum
|
32
32
|
Tcl.new_int_obj(ruby_obj)
|
33
|
-
when Exception
|
34
|
-
string = [ruby_obj.message, *ruby_obj.backtrace].join("\n")
|
35
|
-
Tcl.new_string_obj(string, string.bytesize)
|
36
33
|
else
|
37
34
|
if ruby_obj.respond_to?(:to_tcl)
|
38
35
|
ruby_obj.to_tcl
|
data/lib/ffi-tk/ffi/tk.rb
CHANGED
@@ -3,44 +3,11 @@ module FFI
|
|
3
3
|
extend FFI::Library
|
4
4
|
ffi_lib 'libtk8.5.so', 'libtk.so', *::Tk::LIBPATH[:tk]
|
5
5
|
|
6
|
-
class XColor < FFI::Struct
|
7
|
-
layout(
|
8
|
-
:pixel, :ulong,
|
9
|
-
:red, :ushort,
|
10
|
-
:green, :ushort,
|
11
|
-
:blue, :ushort,
|
12
|
-
:flags, :char,
|
13
|
-
:pad, :char
|
14
|
-
)
|
15
|
-
|
16
|
-
def red
|
17
|
-
self[:red]
|
18
|
-
end
|
19
|
-
|
20
|
-
def green
|
21
|
-
self[:green]
|
22
|
-
end
|
23
|
-
|
24
|
-
def blue
|
25
|
-
self[:blue]
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
# This is opaque
|
30
|
-
class Window < FFI::Struct
|
31
|
-
end
|
32
|
-
|
33
6
|
attach_function :Tk_Init, [:pointer], :int
|
34
|
-
attach_function :Tk_MainWindow, [Tcl::Interp], Window
|
35
|
-
attach_function :Tk_GetColor, [Tcl::Interp, Window, name = :string], XColor
|
36
7
|
attach_function :Tk_MainLoop, [], :void
|
37
8
|
|
38
9
|
module_function
|
39
10
|
|
40
|
-
def get_color(interp, string)
|
41
|
-
XColor.new(Tk_GetColor(interp, Tk_MainWindow(interp), string))
|
42
|
-
end
|
43
|
-
|
44
11
|
def mainloop
|
45
12
|
if ::Tk::RUN_EVENTLOOP_ON_MAIN_THREAD
|
46
13
|
Tk_MainLoop()
|
data/lib/ffi-tk/tk.rb
CHANGED
@@ -124,7 +124,7 @@ module Tk
|
|
124
124
|
|
125
125
|
return BREAK
|
126
126
|
rescue => ex
|
127
|
-
FFI::Tcl::Interp.new(interp).obj_result = ex
|
127
|
+
FFI::Tcl::Interp.new(interp).obj_result = ex.message
|
128
128
|
return ERROR
|
129
129
|
end
|
130
130
|
TCL_CALLBACK = method(:tcl_callback)
|
@@ -145,7 +145,7 @@ module Tk
|
|
145
145
|
|
146
146
|
return BREAK
|
147
147
|
rescue => ex
|
148
|
-
FFI::Tcl::Interp.new(interp).obj_result = ex
|
148
|
+
FFI::Tcl::Interp.new(interp).obj_result = ex.message
|
149
149
|
return ERROR
|
150
150
|
end
|
151
151
|
TCL_EVENT = method(:tcl_event)
|
data/lib/ffi-tk/version.rb
CHANGED
@@ -15,7 +15,7 @@ module Tk
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
# Deselects the checkbutton and sets the associated variable to its
|
18
|
+
# Deselects the checkbutton and sets the associated variable to its “off”
|
19
19
|
# value.
|
20
20
|
def deselect
|
21
21
|
execute_only(:deselect)
|
@@ -36,12 +36,12 @@ module Tk
|
|
36
36
|
# Tcl command associated with the checkbutton, if there is one.
|
37
37
|
# The return value is the return value from the Tcl command, or an empty
|
38
38
|
# string if there is no command associated with the checkbutton.
|
39
|
-
# This command is ignored if the
|
39
|
+
# This command is ignored if the checkbut‐ ton's state is disabled.
|
40
40
|
def invoke
|
41
41
|
execute_only(:invoke)
|
42
42
|
end
|
43
43
|
|
44
|
-
# Selects the checkbutton and sets the associated variable to its
|
44
|
+
# Selects the checkbutton and sets the associated variable to its “on”
|
45
45
|
# value.
|
46
46
|
def select
|
47
47
|
execute_only(:select)
|
@@ -20,7 +20,7 @@ module Tk
|
|
20
20
|
# Sets the active element to the one indicated by index.
|
21
21
|
# If index is outside the range of elements in the listbox then the closest
|
22
22
|
# element is activated.
|
23
|
-
# The active element is drawn as
|
23
|
+
# The active element is drawn as speci‐ fied by -activestyle when the
|
24
24
|
# widget has the input focus, and its index may be retrieved with the index
|
25
25
|
# active.
|
26
26
|
def activate(index)
|
@@ -100,7 +100,7 @@ module Tk
|
|
100
100
|
# of this list).
|
101
101
|
# If option is specified with no value, then the command returns a list
|
102
102
|
# describing the one named option (this list will be identical to the
|
103
|
-
#
|
103
|
+
# correspond‐ ing sublist of the value returned if no option is specified).
|
104
104
|
# If one or more option-value pairs are specified, then the command
|
105
105
|
# modifies the given widget option(s) to have the given value(s); in this
|
106
106
|
# case the command returns an empty string.
|
@@ -136,7 +136,7 @@ module Tk
|
|
136
136
|
|
137
137
|
# This command computes the difference between its x and y arguments and
|
138
138
|
# the x and y arguments to the last scan mark command for the widget.
|
139
|
-
# It then adjusts the view by 10 times the
|
139
|
+
# It then adjusts the view by 10 times the dif‐ ference in coordinates.
|
140
140
|
# This command is typically associated with mouse motion events in the
|
141
141
|
# widget, to produce the effect of dragging the list at high speed through
|
142
142
|
# the window.
|