fxruby 1.6.10 → 1.6.11
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/apes02.html +2 -2
- data/doc/apes03.html +1 -1
- data/doc/book.html +1 -1
- data/doc/changes.html +40 -25
- data/doc/differences.html +9 -9
- data/doc/implementation.html +1 -1
- data/doc/library.html +5 -5
- data/doc/opengl.html +5 -5
- data/doc/pt02.html +1 -1
- data/doc/scintilla.html +4 -4
- data/doc/subversion.html +1 -1
- data/ext/fox16/extconf.rb +8 -8
- data/lib/fox16/aliases.rb +1 -0
- data/lib/fox16/core.rb +54 -2
- data/lib/fox16/iterators.rb +3 -3
- data/lib/fox16/kwargs.rb +1 -29
- data/lib/fox16/pseudokeyboard.rb +12 -6
- data/lib/fox16/pseudomouse.rb +15 -10
- data/lib/fox16/version.rb +1 -1
- data/rdoc-sources/FXIconDict.rb +1 -1
- data/tests/TC_FXFoldingList.rb +32 -0
- data/tests/TC_FXTreeList.rb +17 -0
- data/tests/TC_FXTreeListBox.rb +18 -0
- metadata +5 -2
data/lib/fox16/aliases.rb
CHANGED
data/lib/fox16/core.rb
CHANGED
@@ -263,15 +263,32 @@ module Fox
|
|
263
263
|
class FXWindow
|
264
264
|
#
|
265
265
|
# Iterate over the child windows for this window.
|
266
|
+
# Note that this only reaches the direct child windows for this window
|
267
|
+
# and no deeper descendants. To traverse the entire widget tree,
|
268
|
+
# use #each_child_recursive.
|
266
269
|
#
|
267
|
-
def each_child
|
270
|
+
def each_child # :yields: child
|
268
271
|
child = self.first
|
269
272
|
while child
|
270
273
|
next_child = child.next
|
271
274
|
yield child
|
272
|
-
|
275
|
+
child = next_child
|
273
276
|
end
|
274
277
|
end
|
278
|
+
|
279
|
+
#
|
280
|
+
# Traverse the widget tree starting from this window
|
281
|
+
# using depth-first traversal.
|
282
|
+
#
|
283
|
+
def each_child_recursive # :yields: child
|
284
|
+
each_child do |child|
|
285
|
+
yield child
|
286
|
+
child.each_child_recursive do |subchild|
|
287
|
+
yield subchild
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
275
292
|
|
276
293
|
# Returns an array containing all child windows of this window
|
277
294
|
def children
|
@@ -607,6 +624,41 @@ module Fox
|
|
607
624
|
def selectItem(row, col, notify=false)
|
608
625
|
selectRange(row, row, col, col, notify)
|
609
626
|
end
|
627
|
+
|
628
|
+
=begin
|
629
|
+
|
630
|
+
# Deselect cell at (_row_, _col_).
|
631
|
+
# If _notify_ is +true+, a +SEL_DESELECTED+ message is sent to the table's message target
|
632
|
+
# after the item is deselected.
|
633
|
+
# Raises IndexError if either _row_ or _col_ is out of bounds.
|
634
|
+
#
|
635
|
+
def deselectItem(row, col, notify=false)
|
636
|
+
raise IndexError, "row index out of bounds" if row < 0 || row >= numRows
|
637
|
+
raise IndexError, "column index out of bounds" if col < 0 || col >= numColumns
|
638
|
+
deselectRange(row, row, col, col, notify)
|
639
|
+
end
|
640
|
+
|
641
|
+
# Deselect range.
|
642
|
+
# If _notify_ is +true+, a +SEL_DESELECTED+ message is sent to the table's message
|
643
|
+
# target for each previously selected cell that becomes deselected as a result of
|
644
|
+
# this operation.
|
645
|
+
# Raises IndexError if _startRow_, _endRow_, _startColumn_ or _endColumn_ is out of bounds.
|
646
|
+
def deselectRange(startRow, endRow, startColumn, endColumn, notify=false)
|
647
|
+
raise IndexError, "starting row index out of bounds" if startRow < 0 || startRow >= numRows
|
648
|
+
raise IndexError, "ending row index out of bounds" if endRow < 0 || endRow >= numRows
|
649
|
+
raise IndexError, "starting column index out of bounds" if startColumn < 0 || startColumn >= numColumns
|
650
|
+
raise IndexError, "ending column index out of bounds" if endColumn < 0 || endColumn >= numColumns
|
651
|
+
changes = false
|
652
|
+
for row in startRow..endRow
|
653
|
+
for col in startColumn..endColumn
|
654
|
+
changes |= deselectItem(row, col, notify)
|
655
|
+
end
|
656
|
+
end
|
657
|
+
changes
|
658
|
+
end
|
659
|
+
|
660
|
+
=end
|
661
|
+
|
610
662
|
end
|
611
663
|
end
|
612
664
|
|
data/lib/fox16/iterators.rb
CHANGED
@@ -25,7 +25,7 @@ module Fox
|
|
25
25
|
# reference to that item as a parameter.
|
26
26
|
#
|
27
27
|
def each # :yields: aFoldingItem
|
28
|
-
current =
|
28
|
+
current = firstItem
|
29
29
|
while current != nil
|
30
30
|
next_current = current.next
|
31
31
|
yield current
|
@@ -183,7 +183,7 @@ module Fox
|
|
183
183
|
# reference to that item as a parameter.
|
184
184
|
#
|
185
185
|
def each # :yields: aTreeItem
|
186
|
-
current =
|
186
|
+
current = firstItem
|
187
187
|
while current != nil
|
188
188
|
next_current = current.next
|
189
189
|
yield current
|
@@ -202,7 +202,7 @@ module Fox
|
|
202
202
|
# reference to that item as a parameter.
|
203
203
|
#
|
204
204
|
def each # :yields: aTreeItem
|
205
|
-
current =
|
205
|
+
current = firstItem
|
206
206
|
while current != nil
|
207
207
|
next_current = current.next
|
208
208
|
yield current
|
data/lib/fox16/kwargs.rb
CHANGED
@@ -1104,7 +1104,7 @@ module Fox
|
|
1104
1104
|
alias old_initialize initialize
|
1105
1105
|
def initialize(app, *args, &blk)
|
1106
1106
|
argument_names = %w{path}
|
1107
|
-
default_params = { :path => defaultIconPath }
|
1107
|
+
default_params = { :path => FXIconDict.defaultIconPath }
|
1108
1108
|
params = {}
|
1109
1109
|
params = args.pop if args.last.is_a? Hash
|
1110
1110
|
args.each_with_index { |e, i| params[argument_names[i].intern] = e }
|
@@ -2580,34 +2580,6 @@ module Fox
|
|
2580
2580
|
end
|
2581
2581
|
end
|
2582
2582
|
|
2583
|
-
class FXVec4d
|
2584
|
-
alias old_initialize initialize
|
2585
|
-
def initialize(xx, yy, zz, *args, &blk)
|
2586
|
-
argument_names = %w{ww}
|
2587
|
-
default_params = { :ww => 1.0 }
|
2588
|
-
params = {}
|
2589
|
-
params = args.pop if args.last.is_a? Hash
|
2590
|
-
args.each_with_index { |e, i| params[argument_names[i].intern] = e }
|
2591
|
-
params.keys.each { |key| raise ArgumentError, "Unrecognized parameter #{key}" unless default_params.keys.include?(key) }
|
2592
|
-
params = default_params.merge(params)
|
2593
|
-
old_initialize(xx, yy, zz, params[:ww], &blk)
|
2594
|
-
end
|
2595
|
-
end
|
2596
|
-
|
2597
|
-
class FXVec4f
|
2598
|
-
alias old_initialize initialize
|
2599
|
-
def initialize(xx, yy, zz, *args, &blk)
|
2600
|
-
argument_names = %w{ww}
|
2601
|
-
default_params = { :ww => 1.0 }
|
2602
|
-
params = {}
|
2603
|
-
params = args.pop if args.last.is_a? Hash
|
2604
|
-
args.each_with_index { |e, i| params[argument_names[i].intern] = e }
|
2605
|
-
params.keys.each { |key| raise ArgumentError, "Unrecognized parameter #{key}" unless default_params.keys.include?(key) }
|
2606
|
-
params = default_params.merge(params)
|
2607
|
-
old_initialize(xx, yy, zz, params[:ww], &blk)
|
2608
|
-
end
|
2609
|
-
end
|
2610
|
-
|
2611
2583
|
class FXVerticalFrame
|
2612
2584
|
alias old_initialize initialize
|
2613
2585
|
def initialize(p, *args, &blk)
|
data/lib/fox16/pseudokeyboard.rb
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
module Fox
|
2
2
|
#
|
3
|
-
#
|
4
|
-
# an FXPseudoKeyboard object provides a simple means to operate widgets
|
3
|
+
# An FXPseudoKeyboard object provides a simple means to operate widgets
|
5
4
|
# programmatically, to aid test driven design. An FXPseudoKeyboard instance
|
6
5
|
# can be pointed at an FXObject and will manage the sending of events to
|
7
6
|
# it.
|
8
7
|
#
|
8
|
+
# For example:
|
9
|
+
#
|
10
|
+
# textfield = FXTextField.new(...)
|
11
|
+
# pk = FXPseudoKeyboard.new(textfield)
|
12
|
+
# pk.doKeyPress # sends a SEL_KEYPRESS message to the textfield
|
13
|
+
# pk.doKeyRelease # sends a SEL_KEYRELEASE message to the textfield
|
14
|
+
#
|
9
15
|
class FXPseudoKeyboard
|
10
16
|
|
11
17
|
attr_accessor :target
|
@@ -17,16 +23,16 @@ module Fox
|
|
17
23
|
def doKeyPress
|
18
24
|
unless @target.nil?
|
19
25
|
evt = FXEvent.new
|
20
|
-
|
21
|
-
@target.handle(self, Fox.
|
26
|
+
evt.type = Fox::SEL_KEYPRESS
|
27
|
+
@target.handle(self, Fox.FXSEL(Fox::SEL_KEYPRESS, 0), evt)
|
22
28
|
end
|
23
29
|
end
|
24
30
|
|
25
31
|
def doKeyRelease
|
26
32
|
unless @target.nil?
|
27
33
|
evt = FXEvent.new
|
28
|
-
|
29
|
-
@target.handle(self, Fox.
|
34
|
+
evt.type = Fox::SEL_KEYRELEASE
|
35
|
+
@target.handle(self, Fox.FXSEL(Fox::SEL_KEYRELEASE, 0), evt)
|
30
36
|
end
|
31
37
|
end
|
32
38
|
end
|
data/lib/fox16/pseudomouse.rb
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
module Fox
|
2
2
|
#
|
3
|
-
#
|
4
|
-
# an FXPseudoMouse object provides a simple means to operate widgets
|
3
|
+
# An FXPseudoMouse object provides a simple means to operate widgets
|
5
4
|
# programmatically, to aid test driven design. An FXPseudoMouse instance
|
6
5
|
# can be pointed at an FXObject and will manage the sending of events to
|
7
6
|
# it.
|
8
7
|
#
|
8
|
+
# For example:
|
9
|
+
#
|
10
|
+
# canvas = FXCanvas.new(...)
|
11
|
+
# pm = FXPseudoMouse.new(canvas)
|
12
|
+
# pm.doLeftButtonPress # sends a SEL_LEFTBUTTONPRESS message to the canvas
|
13
|
+
#
|
9
14
|
class FXPseudoMouse < FXObject
|
10
15
|
|
11
16
|
attr_accessor :target
|
@@ -18,7 +23,7 @@ module Fox
|
|
18
23
|
unless @target.nil?
|
19
24
|
evt = FXEvent.new
|
20
25
|
evt.type = Fox::SEL_MOTION
|
21
|
-
@target.handle(self, Fox.
|
26
|
+
@target.handle(self, Fox.FXSEL(Fox::SEL_MOTION, 0), evt)
|
22
27
|
end
|
23
28
|
end
|
24
29
|
|
@@ -26,7 +31,7 @@ module Fox
|
|
26
31
|
unless @target.nil?
|
27
32
|
evt = FXEvent.new
|
28
33
|
evt.type = Fox::SEL_MOUSEWHEEL
|
29
|
-
@target.handle(self, Fox.
|
34
|
+
@target.handle(self, Fox.FXSEL(Fox::SEL_MOUSEWHEEL, 0), evt)
|
30
35
|
end
|
31
36
|
end
|
32
37
|
|
@@ -34,7 +39,7 @@ module Fox
|
|
34
39
|
unless @target.nil?
|
35
40
|
evt = FXEvent.new
|
36
41
|
evt.type = Fox::SEL_LEFTBUTTONPRESS
|
37
|
-
@target.handle(self, Fox.
|
42
|
+
@target.handle(self, Fox.FXSEL(Fox::SEL_LEFTBUTTONPRESS, 0), evt)
|
38
43
|
end
|
39
44
|
end
|
40
45
|
|
@@ -42,7 +47,7 @@ module Fox
|
|
42
47
|
unless @target.nil?
|
43
48
|
evt = FXEvent.new
|
44
49
|
evt.type = Fox::SEL_LEFTBUTTONRELEASE
|
45
|
-
@target.handle(self, Fox.
|
50
|
+
@target.handle(self, Fox.FXSEL(Fox::SEL_LEFTBUTTONRELEASE, 0), evt)
|
46
51
|
end
|
47
52
|
end
|
48
53
|
|
@@ -50,7 +55,7 @@ module Fox
|
|
50
55
|
unless @target.nil?
|
51
56
|
evt = FXEvent.new
|
52
57
|
evt.type = Fox::SEL_MIDDLEBUTTONPRESS
|
53
|
-
@target.handle(self, Fox.
|
58
|
+
@target.handle(self, Fox.FXSEL(Fox::SEL_MIDDLEBUTTONPRESS, 0), evt)
|
54
59
|
end
|
55
60
|
end
|
56
61
|
|
@@ -58,7 +63,7 @@ module Fox
|
|
58
63
|
unless @target.nil?
|
59
64
|
evt = FXEvent.new
|
60
65
|
evt.type = Fox::SEL_MIDDLEBUTTONRELEASE
|
61
|
-
@target.handle(self, Fox.
|
66
|
+
@target.handle(self, Fox.FXSEL(Fox::SEL_MIDDLEBUTTONRELEASE, 0), evt)
|
62
67
|
end
|
63
68
|
end
|
64
69
|
|
@@ -66,7 +71,7 @@ module Fox
|
|
66
71
|
unless @target.nil?
|
67
72
|
evt = FXEvent.new
|
68
73
|
evt.type = Fox::SEL_RIGHTBUTTONPRESS
|
69
|
-
@target.handle(self, Fox.
|
74
|
+
@target.handle(self, Fox.FXSEL(Fox::SEL_RIGHTBUTTONPRESS, 0), evt)
|
70
75
|
end
|
71
76
|
end
|
72
77
|
|
@@ -74,7 +79,7 @@ module Fox
|
|
74
79
|
unless @target.nil?
|
75
80
|
evt = FXEvent.new
|
76
81
|
evt.type = Fox::SEL_RIGHTBUTTONRELEASE
|
77
|
-
@target.handle(self, Fox.
|
82
|
+
@target.handle(self, Fox.FXSEL(Fox::SEL_RIGHTBUTTONRELEASE, 0), evt)
|
78
83
|
end
|
79
84
|
end
|
80
85
|
end
|
data/lib/fox16/version.rb
CHANGED
data/rdoc-sources/FXIconDict.rb
CHANGED
@@ -21,7 +21,7 @@ module Fox
|
|
21
21
|
# Construct icon dictionary, and set initial search path; also
|
22
22
|
# creates a default icon source object.
|
23
23
|
#
|
24
|
-
def initialize(app, path=defaultIconPath);
|
24
|
+
def initialize(app, path=FXIconDict.defaultIconPath);
|
25
25
|
|
26
26
|
# Change icon source to _src_ (an FXIconSource instance).
|
27
27
|
def iconSource=(src); end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'testcase'
|
3
|
+
require 'fox16'
|
4
|
+
|
5
|
+
include Fox
|
6
|
+
|
7
|
+
class TC_FXFoldingList < TestCase
|
8
|
+
|
9
|
+
def setup
|
10
|
+
super(self.class.name)
|
11
|
+
@foldingList = FXFoldingList.new(mainWindow)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_each_for_empty_list
|
15
|
+
count = 0
|
16
|
+
@foldingList.each { |item| count += 1 }
|
17
|
+
assert_equal(0, count, "count for empty list should be zero")
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_each
|
21
|
+
@foldingList.appendItem(nil, "1")
|
22
|
+
@foldingList.appendItem(nil, "2")
|
23
|
+
@foldingList.appendItem(nil, "3")
|
24
|
+
@foldingList.appendItem(nil, "4")
|
25
|
+
@foldingList.appendItem(nil, "5")
|
26
|
+
count = 0
|
27
|
+
@foldingList.each { |item| count += 1 }
|
28
|
+
assert_equal(5, count, "count didn't match expected number of items")
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
data/tests/TC_FXTreeList.rb
CHANGED
@@ -80,4 +80,21 @@ class TC_FXTreeList < TestCase
|
|
80
80
|
@treeList.removeItem(theItem, true)
|
81
81
|
assert_same(theItem, anItem)
|
82
82
|
end
|
83
|
+
|
84
|
+
def test_each_for_empty_list
|
85
|
+
count = 0
|
86
|
+
@treeList.each { |item| count += 1 }
|
87
|
+
assert_equal(0, count, "count for empty list should be zero")
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_each
|
91
|
+
@treeList.appendItem(nil, "1")
|
92
|
+
@treeList.appendItem(nil, "2")
|
93
|
+
@treeList.appendItem(nil, "3")
|
94
|
+
@treeList.appendItem(nil, "4")
|
95
|
+
count = 0
|
96
|
+
@treeList.each { |item| count += 1 }
|
97
|
+
assert_equal(4, count, "count didn't match expected number of items")
|
98
|
+
end
|
99
|
+
|
83
100
|
end
|
data/tests/TC_FXTreeListBox.rb
CHANGED
@@ -5,6 +5,7 @@ require 'fox16'
|
|
5
5
|
include Fox
|
6
6
|
|
7
7
|
class TC_FXTreeListBox < TestCase
|
8
|
+
|
8
9
|
def setup
|
9
10
|
super(self.class.name)
|
10
11
|
@treeListBox = FXTreeListBox.new(mainWindow)
|
@@ -19,5 +20,22 @@ class TC_FXTreeListBox < TestCase
|
|
19
20
|
assert_equal("B", @treeListBox.firstItem.next.text)
|
20
21
|
assert_equal("C", @treeListBox.lastItem.text)
|
21
22
|
end
|
23
|
+
|
24
|
+
def test_each_for_empty_list
|
25
|
+
count = 0
|
26
|
+
@treeListBox.each { |item| count += 1 }
|
27
|
+
assert_equal(0, count, "count for empty list should be zero")
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_each
|
31
|
+
@treeListBox.appendItem(nil, "1")
|
32
|
+
@treeListBox.appendItem(nil, "2")
|
33
|
+
@treeListBox.appendItem(nil, "3")
|
34
|
+
@treeListBox.appendItem(nil, "4")
|
35
|
+
count = 0
|
36
|
+
@treeListBox.each { |item| count += 1 }
|
37
|
+
assert_equal(4, count, "count didn't match expected number of items")
|
38
|
+
end
|
39
|
+
|
22
40
|
end
|
23
41
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: fxruby
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.6.
|
7
|
-
date: 2007-04-
|
6
|
+
version: 1.6.11
|
7
|
+
date: 2007-04-18 00:00:00 -05:00
|
8
8
|
summary: FXRuby is the Ruby binding to the FOX GUI toolkit.
|
9
9
|
require_paths:
|
10
10
|
- ext/fox16
|
@@ -260,6 +260,7 @@ files:
|
|
260
260
|
- tests/TC_FXDirList.rb
|
261
261
|
- tests/TC_FXFileAssoc.rb
|
262
262
|
- tests/TC_FXFileStream.rb
|
263
|
+
- tests/TC_FXFoldingList.rb
|
263
264
|
- tests/TC_FXFont.rb
|
264
265
|
- tests/TC_FXFontDesc.rb
|
265
266
|
- tests/TC_FXGLGroup.rb
|
@@ -782,6 +783,8 @@ rdoc_options:
|
|
782
783
|
- rdoc-sources/README.rdoc
|
783
784
|
- --exclude
|
784
785
|
- ext/fox16
|
786
|
+
- --exclude
|
787
|
+
- !ruby/regexp /acceltable|aliases|bitmapview|canvas|html|kwargs|missingdep|responder|tkcompat/
|
785
788
|
extra_rdoc_files:
|
786
789
|
- rdoc-sources
|
787
790
|
- rdoc-sources/README.rdoc
|