ffi-tk 2009.12.14 → 2010.01

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.
Files changed (42) hide show
  1. data/.gitignore +1 -0
  2. data/AUTHORS +5 -0
  3. data/CHANGELOG +340 -192
  4. data/MANIFEST +5 -0
  5. data/README.md +3 -4
  6. data/Rakefile +1 -1
  7. data/example/tile/themes.rb +13 -0
  8. data/ffi-tk.gemspec +6 -6
  9. data/lib/ffi-tk/command/bind.rb +21 -4
  10. data/lib/ffi-tk/command/bindtags.rb +6 -2
  11. data/lib/ffi-tk/command/clipboard.rb +7 -2
  12. data/lib/ffi-tk/command/event.rb +2 -2
  13. data/lib/ffi-tk/command/get_open_file.rb +4 -2
  14. data/lib/ffi-tk/command/get_save_file.rb +4 -2
  15. data/lib/ffi-tk/command/grab.rb +2 -2
  16. data/lib/ffi-tk/command/grid.rb +7 -7
  17. data/lib/ffi-tk/command/place.rb +2 -6
  18. data/lib/ffi-tk/command/scrollable.rb +19 -19
  19. data/lib/ffi-tk/command/selection.rb +3 -3
  20. data/lib/ffi-tk/command/tk_cmd.rb +4 -3
  21. data/lib/ffi-tk/command/winfo.rb +2 -2
  22. data/lib/ffi-tk/core_extensions.rb +41 -14
  23. data/lib/ffi-tk/event/data.rb +40 -10
  24. data/lib/ffi-tk/event/handler.rb +11 -2
  25. data/lib/ffi-tk/ffi/tcl/interp.rb +3 -0
  26. data/lib/ffi-tk/ffi/tcl.rb +1 -0
  27. data/lib/ffi-tk/ffi/tk.rb +33 -0
  28. data/lib/ffi-tk/tk.rb +2 -2
  29. data/lib/ffi-tk/version.rb +3 -0
  30. data/lib/ffi-tk/widget/canvas.rb +11 -7
  31. data/lib/ffi-tk/widget/checkbutton.rb +3 -3
  32. data/lib/ffi-tk/widget/listbox.rb +3 -3
  33. data/lib/ffi-tk/widget/menu.rb +5 -6
  34. data/lib/ffi-tk/widget/panedwindow.rb +95 -69
  35. data/lib/ffi-tk/widget/text.rb +43 -11
  36. data/lib/ffi-tk/widget/tile/notebook.rb +17 -10
  37. data/lib/ffi-tk/widget/tile/panedwindow.rb +53 -1
  38. data/lib/ffi-tk/widget/tile/sizegrip.rb +2 -2
  39. data/lib/ffi-tk/widget/tile/style.rb +1 -1
  40. data/lib/ffi-tk/widget/tile/treeview.rb +6 -2
  41. data/spec/ffi-tk/command/bind.rb +25 -0
  42. metadata +8 -3
data/MANIFEST CHANGED
@@ -1,3 +1,5 @@
1
+ .gitignore
2
+ AUTHORS
1
3
  CHANGELOG
2
4
  MANIFEST
3
5
  README.md
@@ -19,6 +21,7 @@ example/tile/kroc_demo_small.rb
19
21
  example/tile/kroc_rb_demo.rb
20
22
  example/tile/notebook.rb
21
23
  example/tile/theme_hello.rb
24
+ example/tile/themes.rb
22
25
  example/tile/treeview.rb
23
26
  example/tkgo.rb
24
27
  example/various.rb
@@ -74,6 +77,7 @@ lib/ffi-tk/geometry.rb
74
77
  lib/ffi-tk/thread_sender.rb
75
78
  lib/ffi-tk/tk.rb
76
79
  lib/ffi-tk/variable.rb
80
+ lib/ffi-tk/version.rb
77
81
  lib/ffi-tk/widget.rb
78
82
  lib/ffi-tk/widget/button.rb
79
83
  lib/ffi-tk/widget/canvas.rb
@@ -124,6 +128,7 @@ lib/ffi-tk/widget/tile/sizegrip.rb
124
128
  lib/ffi-tk/widget/tile/style.rb
125
129
  lib/ffi-tk/widget/tile/treeview.rb
126
130
  lib/ffi-tk/widget/toplevel.rb
131
+ spec/ffi-tk/command/bind.rb
127
132
  spec/ffi-tk/command/bindtags.rb
128
133
  spec/ffi-tk/command/clipboard.rb
129
134
  spec/ffi-tk/command/font.rb
data/README.md CHANGED
@@ -5,15 +5,14 @@ This library provides you with a wrapper for the Tk windowing toolkit.
5
5
 
6
6
  ## Installation
7
7
 
8
- Right now this project only exists on github, and tarballs of the repository may
9
- be obtained there.
10
- Once feature-complete, a gem will be provided.
8
+ gem install ffi-tk
11
9
 
12
10
  No compilation is required, but I'm not yet confident that this will run on
13
11
  every architecture without changes, FFI::Tk is being developed on Archlinux and
14
12
  Debian on Intel i686 and AMD x86_64, testers for other platforms are invited to
15
13
  give it a try and report any problems that occur.
16
14
 
15
+ You will need to have tk installed in order to actually use the library.
17
16
 
18
17
  ## Ruby-FFI
19
18
 
@@ -82,4 +81,4 @@ Parts of the documentation were obtained from the tcl/tk manpages and modified
82
81
  to clarify and apply to the specifics of the FFI::Tk wrapper.
83
82
  These parts of the documentation are under Tcl license.
84
83
 
85
- The licenses can be found in doc/TCL_LICENSE and doc/MIT_LICENSE respectively.
84
+ The licenses can be found in doc/TCL_LICENSE and doc/MIT_LICENSE respectively.
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ PROJECT_README = 'README.md'
10
10
  PROJECT_VERSION = ENV['VERSION'] || Date.today.strftime('%Y.%m.%d')
11
11
 
12
12
  DEPENDENCIES = {
13
- 'ffi' => {:version => '~> 0.5.1'},
13
+ 'ffi' => {:version => '~> 0.5.4'},
14
14
  }
15
15
 
16
16
  DEVELOPMENT_DEPENDENCIES = {
@@ -0,0 +1,13 @@
1
+ require 'ffi-tk'
2
+
3
+ Tk::Tile::Style.theme_names.each do |name|
4
+ button = Tk::Tile::Button.new(
5
+ text: name,
6
+ command: ->{ Tk::Tile.set_theme(name) })
7
+ button.pack side: :top, anchor: :nw
8
+ end
9
+
10
+ button = Tk::Tile::Button.new(text: 'Exit', command: ->{ Tk.exit })
11
+ button.pack side: :top, anchor: :nw
12
+
13
+ Tk.mainloop
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 = "2009.12.14"
5
+ s.version = "2010.01"
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{2009-12-14}
9
+ s.date = %q{2010-01-30}
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 = ["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/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"]
12
+ s.files = [".gitignore", "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/themes.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/bind.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}
@@ -20,14 +20,14 @@ Gem::Specification.new do |s|
20
20
  s.specification_version = 3
21
21
 
22
22
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
23
- s.add_runtime_dependency(%q<ffi>, ["~> 0.5.1"])
23
+ s.add_runtime_dependency(%q<ffi>, ["~> 0.5.4"])
24
24
  s.add_development_dependency(%q<bacon>, [">= 1.1.0"])
25
25
  else
26
- s.add_dependency(%q<ffi>, ["~> 0.5.1"])
26
+ s.add_dependency(%q<ffi>, ["~> 0.5.4"])
27
27
  s.add_dependency(%q<bacon>, [">= 1.1.0"])
28
28
  end
29
29
  else
30
- s.add_dependency(%q<ffi>, ["~> 0.5.1"])
30
+ s.add_dependency(%q<ffi>, ["~> 0.5.4"])
31
31
  s.add_dependency(%q<bacon>, [">= 1.1.0"])
32
32
  end
33
33
  end
@@ -1,11 +1,28 @@
1
1
  module Tk
2
2
  module Bind
3
- def self.bind(pathname, sequence, &block)
4
- Event::Handler.register(pathname, sequence, &block)
3
+ def self.bind(tag, sequence = None)
4
+ if None == sequence
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
5
13
  end
6
14
 
7
- def bind(sequence, &block)
15
+ # TODO: remove the block associated
16
+ def self.unbind(tag, sequence)
17
+ Event::Handler.unregister(tag, sequence)
18
+ end
19
+
20
+ def bind(sequence = None, &block)
8
21
  Bind.bind(tk_pathname, sequence, &block)
9
22
  end
23
+
24
+ def unbind(sequence)
25
+ Bind.unbind(tk_pathname, sequence)
26
+ end
10
27
  end
11
- end
28
+ end
@@ -58,12 +58,16 @@ module Tk
58
58
  end
59
59
 
60
60
  class BindTag < Struct.new(:name)
61
- def bind(sequence, &block)
61
+ def bind(sequence = None, &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
+
65
69
  def to_tcl
66
70
  TclString.new(name)
67
71
  end
68
72
  end
69
- end
73
+ end
@@ -21,8 +21,7 @@ module Tk
21
21
  end
22
22
 
23
23
  def clipboard_set(string, options = {})
24
- clipboard_clear
25
- clipboard_append(options.merge(data: string))
24
+ Clipboard.set(string, options)
26
25
  end
27
26
 
28
27
  module_function
@@ -85,6 +84,12 @@ module Tk
85
84
  Tk.execute_only(:clipboard, :append, *args)
86
85
  end
87
86
 
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
+
88
93
  # Retrieve data from the clipboard on +window+'s display.
89
94
  # +window+ defaults to ".".
90
95
  # +type+ specifies the form in which the data is to be returned and should be
@@ -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.to_tcl_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
@@ -80,6 +80,8 @@ module Tk
80
80
  # Extensions without a full stop character (e.g. "~") are allowed but may not
81
81
  # work on all platforms.
82
82
  def get_open_file(options = None)
83
- Tk.execute(:tk_getOpenFile, options.to_tcl_options?)
83
+ result = Tk.execute(:tk_getOpenFile, options.to_tcl_options?)
84
+ path = result.respond_to?(:to_str) ? result.to_str : result.to_s?
85
+ path unless path.empty?
84
86
  end
85
- end
87
+ end
@@ -78,6 +78,8 @@ module Tk
78
78
  # Extensions without a full stop character (e.g. "~") are allowed but may not
79
79
  # work on all platforms.
80
80
  def get_save_file(options = None)
81
- Tk.execute(:tk_getSaveFile, options.to_tcl_options?)
81
+ result = Tk.execute(:tk_getSaveFile, options.to_tcl_options?)
82
+ path = result.respond_to?(:to_str) ? result.to_str : result.to_s?
83
+ path unless path.empty?
82
84
  end
83
- end
85
+ end
@@ -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
@@ -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 “-option value” pairs.
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 = None)
75
+ Tk.execute('grid', 'columnconfigure', master, index, options.to_tcl_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 “-in master” where master is
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 “-option value” pairs.
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.to_tcl_options)
197
+ def grid_columnconfigure(index, options = None)
198
+ Grid.columnconfigure(self, index, options)
199
199
  end
200
200
 
201
201
  # @see Grid::configure
@@ -32,11 +32,7 @@ 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
- if options == None
36
- Tk.execute('place', 'configure', window)
37
- else
38
- Tk.execute_only('place', 'configure', window, options)
39
- end
35
+ Configure.common(Tk, [:place, :configure, window], options)
40
36
  end
41
37
 
42
38
  def self.forget(window)
@@ -88,4 +84,4 @@ module Tk
88
84
  Place.slaves(self)
89
85
  end
90
86
  end
91
- end
87
+ 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 accept│ able to
36
- # Tk_GetPixels, such as 2.0c or 1i (the result is rounded to the
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 acceptable 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 accept│ able to
93
- # Tk_GetPixels, such as 2.0c or 1i (the result is rounded to the
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 acceptable 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 “target” for conversion, in ICCCM terminology), and should be
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,8 +51,9 @@ 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. 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.
54
+ # newName.
55
+ # If the given name is already in use, then a suffix of the form "#2" or
56
+ # "#3" is appended in order to make the name unique.
56
57
  # The command's result is the name actually chosen.
57
58
  # newName should not start with a capital letter.
58
59
  # This will interfere with option processing, since names starting with
@@ -90,7 +91,7 @@ module Tk
90
91
  # If the window argument is omitted, it defaults to the main window.
91
92
  # If the number argument is omitted, the current value of the scaling
92
93
  # factor is returned.
93
- # A point is a unit of measurement equal to 1/72 inch.
94
+ # A "point" is a unit of measurement equal to 1/72 inch.
94
95
  # A scaling factor of 1.0 corresponds to 1 pixel per point, which is
95
96
  # equivalent to a standard 72 dpi monitor.
96
97
  # A scaling factor of 1.25 would mean 1.25 pixels per point, which is the
@@ -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 2.0c or 1i”.
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,21 +14,48 @@ 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.
17
19
  def tcl_options_to_hash(hints = {})
18
- ::Hash[each_slice(2).map{|key, value|
19
- key = key.sub(/^-/, '').to_sym
20
-
21
- case hint = hints[key]
22
- when :boolean
23
- [key, Tk.boolean(value)]
24
- when :symbol
25
- [key, value.to_sym]
26
- when :float
27
- [key, Float(value)]
28
- else
29
- [key, value]
20
+ if first.respond_to?(:to_ary)
21
+ hash = {}
22
+
23
+ each do |key, _, _, _, value|
24
+ next if !value || (value.respond_to?(:empty?) && value.empty?)
25
+ key = key.sub(/^-/, '').to_sym
26
+
27
+ hash[key] =
28
+ case hint = hints[key]
29
+ when :boolean
30
+ Tk.boolean(value)
31
+ when :symbol
32
+ value.to_sym
33
+ when :float
34
+ Float(value)
35
+ else
36
+ value
37
+ end
30
38
  end
31
- }]
39
+
40
+ hash
41
+ elsif first =~ /^-/
42
+ ::Hash[each_slice(2).map{|key, value|
43
+ key = key.sub(/^-/, '').to_sym
44
+
45
+ case hint = hints[key]
46
+ when :boolean
47
+ [key, Tk.boolean(value)]
48
+ when :symbol
49
+ [key, value.to_sym]
50
+ when :float
51
+ [key, Float(value)]
52
+ else
53
+ [key, value]
54
+ end
55
+ }]
56
+ else
57
+ self
58
+ end
32
59
  end
33
60
  end
34
61
 
@@ -71,7 +98,7 @@ module Tk
71
98
 
72
99
  module String
73
100
  def to_tcl
74
- TclString.new('"' << gsub(/[\[\]$"\\]/, '\\\\\&') << '"')
101
+ TclString.new('"' << gsub(/[\[\]{}$"\\]/, '\\\\\&') << '"')
75
102
  end
76
103
 
77
104
  def to_tcl_option
@@ -17,24 +17,24 @@ module Tk
17
17
  ['%f', :String, :focus ],
18
18
  ['%h', :Integer, :height ],
19
19
  ['%i', :String, :window ],
20
- ['%k', :String, :keycode ],
20
+ ['%k', :Integer, :keycode ],
21
21
  ['%m', :String, :mode ],
22
22
  ['%o', :String, :override_redirect ],
23
23
  ['%p', :String, :place ],
24
24
  ['%s', :String, :state ],
25
- ['%t', :String, :time ],
25
+ ['%t', :Integer, :time ],
26
26
  ['%w', :Integer, :width ],
27
27
  ['%x', :Integer, :x ],
28
28
  ['%y', :Integer, :y ],
29
29
  ['%A', :String, :unicode ],
30
30
  ['%B', :Integer, :border_width ],
31
- ['%D', :String, :mousewheel_delta ],
32
- ['%E', :String, :send_event ],
31
+ ['%D', :Integer, :mousewheel_delta ],
32
+ ['%E', :Integer, :send_event ],
33
33
  ['%K', :String, :keysym ],
34
- ['%N', :String, :keysym_number ],
34
+ ['%N', :Integer, :keysym_number ],
35
35
  ['%P', :String, :property ],
36
- ['%R', :Integer, :root ],
37
- ['%S', :Integer, :subwindow ],
36
+ ['%R', :String, :root ],
37
+ ['%S', :String, :subwindow ],
38
38
  ['%T', :Integer, :type ],
39
39
  ['%W', :String, :window_path ],
40
40
  ['%X', :Integer, :x_root ],
@@ -45,9 +45,9 @@ module Tk
45
45
  super id, sequence
46
46
 
47
47
  PROPERTIES.each do |code, conv, name|
48
- property = properties.shift
49
- next if property == '??'
50
- converted = __send__(conv, property)
48
+ value = properties.shift
49
+ converted = __send__(conv, value)
50
+ next if converted == '??'
51
51
  self[name] = converted
52
52
  end
53
53
  end
@@ -55,6 +55,36 @@ module Tk
55
55
  def call
56
56
  Handler.invoke(id, self) if id
57
57
  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
58
88
  end
59
89
  end
60
90
  end