ffi-tk 2010.01 → 2010.01.02

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,7 +44,7 @@ module Tk
44
44
  # This option is not available for separator or tear-off entries.
45
45
  # -bitmap value Specifies a bitmap to display in the menu instead of a
46
46
  # textual label, in any of the forms accepted by Tk_GetBitmap.
47
- # This option overrides the -label option (as controlled by the -compound
47
+ # This option overrides the -label option (as controlled by the -com‐ pound
48
48
  # option) but may be reset to an empty string to enable a textual label to
49
49
  # be displayed.
50
50
  # If a -image option has been specified, it overrides -bitmap.
@@ -58,7 +58,7 @@ module Tk
58
58
  # -compound value Specifies whether the menu entry should display both an
59
59
  # image and text, and if so, where the image should be placed relative to
60
60
  # the text.
61
- # Valid values for this option are bottom, center, left, none, right and
61
+ # Valid values for this option are bottom, cen‐ ter, left, none, right and
62
62
  # top. The default value is none, meaning that the button will display
63
63
  # either an image or text, depending on the values of the -image and
64
64
  # -bitmap options.
@@ -122,7 +122,7 @@ module Tk
122
122
  # bindings will refuse to activate or invoke the entry.
123
123
  # In this state the entry is displayed according to the disabledForeground
124
124
  # option for the menu and the background option from the entry.
125
- # This option is not available for separator entries.
125
+ # This option is not available for separa‐ tor entries.
126
126
  # -underline value Specifies the integer index of a character to underline
127
127
  # in the entry.
128
128
  # This option is also queried by the default bindings and used to implement
@@ -255,7 +255,7 @@ module Tk
255
255
  # Unmap the window so that it is no longer displayed.
256
256
  # If a lower-level cascaded menu is posted, unpost that menu.
257
257
  # Returns an empty string.
258
- # This subcommand does not work on Windows and the Macintosh, as those
258
+ # This subcommand does not work on Windows and the Mac‐ intosh, as those
259
259
  # platforms have their own way of unposting menus.
260
260
  def unpost
261
261
  execute(:unpost)
@@ -263,6 +263,7 @@ module Tk
263
263
 
264
264
  # Returns a decimal string giving the x-coordinate within the menu window
265
265
  # of the leftmost pixel in the entry specified by index.
266
+ # │
266
267
  def xposition(index)
267
268
  execute(:xposition, index)
268
269
  end
@@ -298,7 +299,7 @@ module Tk
298
299
  # menus. You create a torn-off menu by invoking the tear-off entry at the
299
300
  # top of an existing menu.
300
301
  # The default bindings will create a new menu that is a copy of the
301
- # original menu and leave it permanently posted as a top-level window.
302
+ # original menu and leave it perma‐ nently posted as a top-level window.
302
303
  # The torn-off menu behaves just the same as the original menu.
303
304
  # and unposts the menu.
304
305
  # If the current menu is a top-level menu posted from a menubutton, then
@@ -62,7 +62,7 @@ module Tk
62
62
 
63
63
  # This command computes the difference between the given coordinates and
64
64
  # the coordinates given to the last sash mark command for the given sash.
65
- # It then moves that sash the computed difference.
65
+ # It then moves that sash the computed dif‐ ference.
66
66
  def sash_dragto(index, x, y)
67
67
  execute_only(:sash, :dragto, index, x, y)
68
68
  end
@@ -84,107 +84,81 @@ module Tk
84
84
  execute(:panecget, window, option.to_tcl_option)
85
85
  end
86
86
 
87
- # Query or modify the management options for +window+.
88
- #
89
- # If no +options+ is specified, returns a list describing all of the available
90
- # options for +window+ (see Tk_ConfigureInfo for information on the format
87
+ # Query or modify the management options for window.
88
+ # If no option is specified, returns a list describing all of the available
89
+ # options for pathName (see Tk_ConfigureInfo for information on the format
91
90
  # of this list).
92
- #
93
- # If +options+ is specified with no value, then the command returns a list
91
+ # If option is specified with no value, then the command returns a list
94
92
  # describing the one named option (this list will be identical to the
95
93
  # corresponding sublist of the value returned if no option is specified).
96
- #
97
- # If one or more option-value pairs are specified, then the command modifies
98
- # the given widget option(s) to have the given value(s); in this case the
99
- # command returns an empty string.
100
- #
101
- # The following options are supported:
102
- # :after window
103
- # Insert the window after the window specified.
104
- # window should be the name of a window already managed by +window+.
105
- #
106
- # :before window
107
- # Insert the window before the window specified.
108
- # window should be the name of a window already managed by +window+.
109
- #
110
- # :height size
111
- # Specify a height for the window.
112
- # The height will be the outer dimension of the window including its
113
- # border, if any.
114
- # If size is an empty string, or if -height is not specified, then the
115
- # height requested internally by the window will be used initially; the
116
- # height may later be adjusted by the movement of sashes in the
117
- # panedwindow. Size may be any value accepted by Tk_GetPixels.
118
- #
119
- # :hide boolean
120
- # Controls the visibility of a pane.
121
- # When the boolean is true (according to Tcl_GetBoolean) the pane will
122
- # not be visible, but it will still be maintained in the list of panes.
123
- #
124
- # :minsize n
125
- # Specifies that the size of the window cannot be made less than n.
126
- # This constraint only affects the size of the widget in the paned
127
- # dimension -- the x dimension for horizontal panedwindows, the y
128
- # dimension for vertical panedwindows.
129
- # May be any value accepted by Tk_GetPixels.
130
- #
131
- # :padx n
132
- # Specifies a non-negative value indicating how much extra space to
133
- # leave on each side of the window in the X-direction.
134
- # The value may have any of the forms accepted by Tk_GetPixels.
135
- #
136
- # :pady n
137
- # Specifies a non-negative value indicating how much extra space to
138
- # leave on each side of the window in the Y-direction.
139
- # The value may have any of the forms accepted by Tk_GetPixels.
140
- # :sticky style
141
- # If a window's pane is larger than the requested dimensions of the
142
- # window, this option may be used to position (or stretch) the window
143
- # within its pane.
144
- # Style is a string that contains zero or more of the characters n, s, e
145
- # or w.
146
- # The string can optionally contains spaces or commas, but they are
147
- # ignored. Each letter refers to a side (north, south, east, or west)
148
- # that the window will "stick" to.
149
- # If both n and s (or e and w) are specified, the window will be
150
- # stretched to fill the entire height (or width) of its cavity.
151
- # :stretch when
152
- # Controls how extra space is allocated to each of the panes.
153
- # When is one of always, first, last, middle, and never.
154
- # The panedwindow will calculate the required size of all its panes.
155
- # Any remaining (or deficit) space will be distributed to those panes
156
- # marked for stretching.
157
- # The space will be distributed based on each panes current ratio of the
158
- # whole.
159
- # The when values have the following definition:
160
- # :always
161
- # This pane will always stretch.
162
- # :first
163
- # Only if this pane is the first pane (left-most or top-most) will
164
- # it stretch.
165
- # :last
166
- # Only if this pane is the last pane (right-most or bottom-most)
167
- # will it stretch. This is the default value.
168
- # :middle
169
- # Only if this pane is not the first or last pane will it stretch.
170
- # :never
171
- # This pane will never stretch.
172
- #
173
- # :width size
174
- # Specify a width for the window.
175
- # The width will be the outer dimension of the window including its
176
- # border, if any.
177
- # If size is an empty string, or if -width is not specified, then the
178
- # width requested internally by the window will be used initially; the
179
- # width may later be adjusted by the movement of sashes in the
180
- # panedwindow. Size may be any value accepted by Tk_GetPixels.
94
+ # If one or more option-value pairs are specified, then the command
95
+ # modifies the given widget option(s) to have the given value(s); in this
96
+ # case the command returns an empty string.
97
+ # The following options are supported: -after window Insert the window
98
+ # after the window specified.
99
+ # window should be the name of a window already managed by pathName.
100
+ # -before window Insert the window before the window specified.
101
+ # window should be the name of a window already managed by pathName.
102
+ # -height size Specify a height for the window.
103
+ # The height will be the outer dimension of the window including its
104
+ # border, if any.
105
+ # If size is an empty string, or if -height is not specified, then the
106
+ # height requested internally by the window will be used initially; the
107
+ # height may later be adjusted by the movement of sashes in the
108
+ # panedwindow. Size may be any value accepted by Tk_GetPixels.
109
+ # -hide boolean Controls the visibility of a pane.
110
+ # When the boolean is true (according to Tcl_GetBoolean) the pane will not
111
+ # be visible, but it will still be maintained in the list of panes.
112
+ # -minsize n Specifies that the size of the window cannot be made less
113
+ # than n.
114
+ # This constraint only affects the size of the widget in the paned
115
+ # dimension the x dimension for horizontal panedwin‐ dows, the y
116
+ # dimension for vertical panedwindows.
117
+ # May be any value accepted by Tk_GetPixels.
118
+ # -padx n Specifies a non-negative value indicating how much extra space to
119
+ # leave on each side of the window in the X-direction.
120
+ # The value may have any of the forms accepted by Tk_GetPixels.
121
+ # -pady n Specifies a non-negative value indicating how much extra space to
122
+ # leave on each side of the window in the Y-direction.
123
+ # The value may have any of the forms accepted by Tk_GetPixels.
124
+ # -sticky style If a window's pane is larger than the requested dimensions
125
+ # of the window, this option may be used to position (or stretch) the
126
+ # window within its pane.
127
+ # Style is a string that contains zero or more of the characters n, s, e or
128
+ # w. The string can optionally contains spaces or commas, but they are
129
+ # ignored. Each letter refers to a side (north, south, east, or west) that
130
+ # the window will “stick” to.
131
+ # If both n and s (or e and w) are specified, the window will be stretched
132
+ # to fill the entire height (or width) of its cavity.
133
+ # -stretch when Controls how extra space is allocated to each of the panes.
134
+ # When is one of always, first, last, middle, and never.
135
+ # The panedwindow will calculate the required size of all its panes.
136
+ # Any remaining (or deficit) space will be distributed to those panes
137
+ # marked for stretching.
138
+ # The space will be distributed based on each panes current ratio of the
139
+ # whole. The when values have the following definition: always │ This
140
+ # pane will always stretch.
141
+ # first │ Only if this pane is the first pane (left-most or top-most)
142
+ # will it stretch.
143
+ # │ last │ Only if this pane is the last pane (right-most or bottom-most)
144
+ # will it stretch.
145
+ # This is the default value.
146
+ # │ middle │ Only if this pane is not the first or last pane will it
147
+ # stretch. never This pane will never stretch.
148
+ # -width size Specify a width for the window.
149
+ # The width will be the outer dimension of the window including its border,
150
+ # if any.
151
+ # If size is an empty string, or if -width is not specified, then the width
152
+ # requested internally by the window will be used initially; the width may
153
+ # later be adjusted by the movement of sashes in the panedwindow.
154
+ # Size may be any value accepted by Tk_Get‐ Pixels.
181
155
  def paneconfigure(window, options = None)
182
156
  common_configure([:paneconfigure, window], options)
183
157
  end
184
158
 
185
- # Returns an ordered list of the widgets managed by +window+.
186
- def panes(window = None)
187
- execute(:panes, window).to_a
159
+ # Returns an ordered list of the widgets managed by pathName.
160
+ def panes
161
+ execute(:panes).to_a
188
162
  end
189
163
  end
190
164
  end
@@ -201,22 +201,18 @@ module Tk
201
201
  indices = [given_index]
202
202
 
203
203
  while arg = arguments.shift
204
- if arg.respond_to?(:to_tcl_option)
205
- case tcl_option = arg.to_tcl_option
206
- when '-command'
207
- command = arguments.shift
208
- invocation << ['-command', command]
209
- when /^-(?:all|image|mark|tag|text|window)$/
210
- invocation << tcl_option
211
- else
212
- indices.unshift(arg)
213
- end
204
+ case arg.to_tcl
205
+ when '-command'
206
+ command = arguments.shift
207
+ invocation << ['-command', command]
208
+ when /^-(all|image|mark|tag|text|window)$/
209
+ invocation << tcl_option(arg)
214
210
  else
215
211
  indices.unshift(arg)
216
212
  end
217
213
  end
218
214
 
219
- execute('dump', *invocation, *indices).to_a.each_slice(3).to_a
215
+ execute('dump', *invocation, *indices)
220
216
  end
221
217
 
222
218
  # If boolean is not specified, returns the modified flag of the widget.
@@ -659,7 +655,7 @@ module Tk
659
655
  # and the substitutions performed on script before invoking it.
660
656
  # If all arguments are specified then a new binding is created, replacing
661
657
  # any existing binding for the same sequence and tagName (if the first
662
- # character of script is "+" then script augments an existing binding
658
+ # character of script is “+” then script augments an existing binding
663
659
  # rather than replacing it).
664
660
  # In this case the return value is an empty string.
665
661
  # If script is omitted then the command returns the script associated
@@ -769,8 +765,8 @@ module Tk
769
765
  # active at the character position given by index.
770
766
  # If index is omitted, then the return value will describe all of the tags
771
767
  # that exist for the text (this includes all tags that have been named in a
772
- # "pathName tag" widget command but have not been deleted by a "pathName
773
- # tag delete" widget command, even if no characters are currently marked
768
+ # pathName tag widget command but have not been deleted by a pathName
769
+ # tag delete widget command, even if no characters are currently marked
774
770
  # with the tag).
775
771
  # The list will be sorted in order from lowest priority to highest
776
772
  # priority.
@@ -893,33 +889,5 @@ module Tk
893
889
  def paste
894
890
  Tk.execute(:tk_textPaste, self)
895
891
  end
896
-
897
- def tk_prev_word_pos(start)
898
- Tk.execute('tk::TextPrevPos', self, start, 'tcl_startOfPreviousWord').to_s
899
- end
900
-
901
- def tk_next_word_pos(start)
902
- Tk.execute('tk::TextNextPos', self, start, 'tcl_startOfNextWord').to_s
903
- end
904
-
905
- def tk_next_word_pos_end(start)
906
- Tk.execute('tk::TextNextWord', self, start).to_s
907
- end
908
-
909
- def tk_prev_line_pos(count)
910
- Tk.execute('tk::TextUpDownLine', self, -count.abs).to_s
911
- end
912
-
913
- def tk_next_line_pos(count)
914
- Tk.execute('tk::TextUpDownLine', self, count).to_s
915
- end
916
-
917
- def tk_prev_page_pos(count)
918
- Tk.execute('tk::TextScrollPages', self, -count.abs).to_s
919
- end
920
-
921
- def tk_next_page_pos(count)
922
- Tk.execute('tk::TextScrollPages', self, count).to_s
923
- end
924
892
  end
925
893
  end
@@ -38,20 +38,17 @@ module Tk
38
38
  # the string end, an integer index, or the name of a managed subwindow.
39
39
  # If subwindow is already managed by the notebook, moves it to
40
40
  # the specified position.
41
- def insert(pos, window, options = {})
42
- execute_only(:insert, pos, window, options.to_tcl_options)
41
+ def insert(pos, window, options)
42
+ execute_only(:insert, pos, window, options.to_tcl_options)
43
43
  end
44
44
 
45
45
  # Selects the specified tab. The associated slave window
46
46
  # will be displayed, and the previously-selected window
47
47
  # (if different) is unmapped. If tabid is omitted, returns
48
48
  # the widget name of the currently selected pane.
49
- def select(window = None)
50
- if None == window
51
- execute(:select)
52
- else
53
- execute_only(:select, window)
54
- end
49
+ def select(window)
50
+ execute_only(:select, window)
51
+ window.tk_pathname
55
52
  end
56
53
 
57
54
  # Remove the pane containing window from the panedwindow.
@@ -60,18 +57,14 @@ module Tk
60
57
  execute_only(:forget, window, *windows)
61
58
  end
62
59
 
63
- # Hides the tab specified by +tabid+.
64
- # The tab will not be displayed, but the associated window remains managed
65
- # by the notebook and its configuration remembered.
66
- # Hidden tabs may be restored with the add command.
67
- def hide(tabid)
68
- execute_only(:hide, tabid)
60
+ def hide(window)
61
+ execute_only(:hide, window)
69
62
  end
70
63
 
71
- # Returns the numeric index of the tab specified by +tabid+,
64
+ # Returns the numeric index of the tab specified by tabid,
72
65
  # or the total number of tabs if tabid is the string 'end'.
73
- def index(tabid)
74
- execute(:index, tabid).to_i
66
+ def index(window)
67
+ execute(:index, window).to_i
75
68
  end
76
69
 
77
70
  def identify(x, y)
@@ -3,59 +3,7 @@ module Tk
3
3
  class PanedWindow < Tk::PanedWindow
4
4
  def self.tk_command; 'ttk::panedwindow'; end
5
5
  include TileWidget
6
-
7
- # pathname add subwindow options...
8
- # Adds a new pane to the window.
9
- # subwindow must be a direct child of the paned window pathname.
10
- # See PANE OPTIONS for the list of available options.
11
- def add(subwindow, options = {})
12
- execute_only(:add, subwindow, options.to_tcl_options)
13
- end
14
-
15
- # pathname forget pane
16
- # Removes the specified subpane from the widget.
17
- # pane is either an integer index or the name of a managed subwindow.
18
- def forget(pane)
19
- execute_only(:forget, pane)
20
- end
21
-
22
- # pathname identify x y
23
- # Returns the index of the sash at point x,y, or the empty string if x,y
24
- # is not over a sash.
25
- def identify(x, y)
26
- execute(:identify, x, y)
27
- end
28
-
29
- # pathname insert pos subwindow options...
30
- # Inserts a pane at the specified position.
31
- # pos is either the string end, an integer index, or the name of a managed
32
- # subwindow. If subwindow is already managed by the paned window, moves it
33
- # to the specified position.
34
- # See PANE OPTIONS for the list of available options.
35
- def insert(pos, subwindow, options = {})
36
- execute_only(:insert, pos, subwindow, options.to_tcl_options)
37
- end
38
-
39
- # pathname pane pane -option ?value ?-option value...
40
- # Query or modify the options of the specified pane, where pane is either
41
- # an integer index or the name of a managed subwindow.
42
- # If no -option is specified, returns a dictionary of the pane option
43
- # values. If one -option is specified, returns the value of that option.
44
- # Otherwise, sets the -options to the corresponding values.
45
- def pane(pane, options = {})
46
- common_configure([:pane, pane], options)
47
- end
48
-
49
- # pathname sashpos index ?newpos?
50
- # If newpos is specified, sets the position of sash number index.
51
- # May adjust the positions of adjacent sashes to ensure that positions are
52
- # monotonically increasing.
53
- # Sash positions are further constrained to be between 0 and the total
54
- # size of the widget.
55
- # Returns the new position of sash number index.
56
- def sashpos(index, newpos = None)
57
- execute(:sashpos, index, newpos)
58
- end
59
6
  end
60
7
  end
61
8
  end
9
+
@@ -17,8 +17,8 @@ module Tk
17
17
  # BUG: http://tcl.activestate.com/man/tcl8.5/TkCmd/ttk_sizegrip.htm
18
18
  # If the containing toplevel's position was specified relative to the
19
19
  # right or bottom of the screen (e.g., 'wm geometry ... wxh-x-y' instead
20
- # of "wm geometry ... wxh+x+y"), the sizegrip widget will not resize the
21
- # window. ttk::sizegrip widgets only support "southeast" resizing.
20
+ # of wm geometry ... wxh+x+y), the sizegrip widget will not resize the
21
+ # window. ttk::sizegrip widgets only support southeast resizing.
22
22
  end
23
23
  end
24
24
  end
@@ -103,7 +103,7 @@ module Tk
103
103
  # Returns the value specified for -option in style style in state
104
104
  # state, using the standard lookup rules for element options.
105
105
  # state is a list of state names; if omitted, it defaults to all
106
- # bits off (the "normal" state). If the default argument is present,
106
+ # bits off (the normal state). If the default argument is present,
107
107
  # it is used as a fallback value in case no specification
108
108
  # for -option is found.
109
109
  def self.lookup(style, option, state=Tk::None, default=Tk::None)
@@ -217,10 +217,6 @@ module Tk
217
217
  tk_parent.children(id, *new_children)
218
218
  end
219
219
 
220
- def selection_set
221
- tk_parent.selection_set(id)
222
- end
223
-
224
220
  def selection_add
225
221
  tk_parent.selection_add(id)
226
222
  end
@@ -326,12 +322,12 @@ module Tk
326
322
 
327
323
  # Returns the list of selected items.
328
324
  def selection
329
- execute(:selection).to_a.map{|id| Item.new(self, id) }
325
+ execute(:selection).to_a
330
326
  end
331
327
 
332
328
  # +items+ becomes the new selection.
333
329
  def selection_set(*items)
334
- execute(:selection, :set, *items.flatten)
330
+ execute(:selection, set, *items.flatten)
335
331
  end
336
332
 
337
333
  # Add +items+ to the selection
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-tk
3
3
  version: !ruby/object:Gem::Version
4
- version: "2010.01"
4
+ version: 2010.01.02
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael 'manveru' Fellinger
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-30 00:00:00 +09:00
12
+ date: 2010-01-02 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -41,7 +41,6 @@ extensions: []
41
41
  extra_rdoc_files: []
42
42
 
43
43
  files:
44
- - .gitignore
45
44
  - AUTHORS
46
45
  - CHANGELOG
47
46
  - MANIFEST
@@ -64,7 +63,6 @@ files:
64
63
  - example/tile/kroc_rb_demo.rb
65
64
  - example/tile/notebook.rb
66
65
  - example/tile/theme_hello.rb
67
- - example/tile/themes.rb
68
66
  - example/tile/treeview.rb
69
67
  - example/tkgo.rb
70
68
  - example/various.rb
@@ -171,7 +169,6 @@ files:
171
169
  - lib/ffi-tk/widget/tile/style.rb
172
170
  - lib/ffi-tk/widget/tile/treeview.rb
173
171
  - lib/ffi-tk/widget/toplevel.rb
174
- - spec/ffi-tk/command/bind.rb
175
172
  - spec/ffi-tk/command/bindtags.rb
176
173
  - spec/ffi-tk/command/clipboard.rb
177
174
  - spec/ffi-tk/command/font.rb
data/.gitignore DELETED
@@ -1 +0,0 @@
1
- tags
@@ -1,13 +0,0 @@
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
@@ -1,25 +0,0 @@
1
- require_relative '../../helper'
2
-
3
- describe Tk::Bind do
4
- entry = Tk::Entry.new
5
- entry.pack
6
- entry.focus
7
-
8
- it 'should bind a block' do
9
- foo = false
10
- entry.bind('f'){ foo = true }
11
- Tk.interp.do_events_until{
12
- Tk::Event.generate(entry, 'f')
13
- foo
14
- }
15
- foo.should == true
16
- end
17
-
18
- it 'should return the bound proc' do
19
- entry.bind('f').should == ' ::RubyFFI::event 0 f %# %b %c %d %f %h %i %k %m %o %p %s %t %w %x %y %A %B %D %E %K %N %P %R %S %T %W %X %Y '
20
- end
21
-
22
- it 'should list the sequences bound' do
23
- entry.bind.should == ['f']
24
- end
25
- end