fxruby 1.6.5 → 1.6.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/doc/apes02.html +2 -2
  2. data/doc/apes03.html +1 -1
  3. data/doc/book.html +1 -1
  4. data/doc/changes.html +55 -21
  5. data/doc/differences.html +9 -9
  6. data/doc/implementation.html +1 -1
  7. data/doc/library.html +5 -5
  8. data/doc/opengl.html +5 -5
  9. data/doc/pt02.html +1 -1
  10. data/doc/scintilla.html +4 -4
  11. data/doc/subversion.html +1 -1
  12. data/examples/accell.rb +36 -0
  13. data/examples/babelfish.rb +6 -9
  14. data/examples/bounce.rb +5 -4
  15. data/examples/button.rb +19 -21
  16. data/examples/datatarget.rb +9 -8
  17. data/examples/dctest.rb +7 -13
  18. data/examples/dialog.rb +12 -16
  19. data/examples/dilbert.rb +4 -4
  20. data/examples/dirlist.rb +6 -5
  21. data/examples/dragdrop.rb +30 -33
  22. data/examples/dragsource.rb +22 -22
  23. data/examples/dropsite.rb +16 -17
  24. data/examples/foursplit.rb +8 -13
  25. data/examples/gltest.rb +21 -24
  26. data/examples/glviewer.rb +56 -58
  27. data/examples/header.rb +25 -25
  28. data/examples/iconlist.rb +12 -8
  29. data/examples/image.rb +36 -34
  30. data/examples/imageviewer.rb +44 -43
  31. data/examples/inputs.rb +15 -15
  32. data/examples/mditest.rb +6 -5
  33. data/examples/pig.rb +1 -0
  34. data/examples/raabrowser.rb +31 -40
  35. data/examples/ratio.rb +27 -16
  36. data/examples/rulerview.rb +4 -3
  37. data/examples/scribble.rb +14 -17
  38. data/examples/shutter.rb +10 -9
  39. data/examples/splitter.rb +7 -6
  40. data/examples/tabbook.rb +59 -17
  41. data/examples/table.rb +12 -16
  42. data/ext/fox16/FXRuby.cpp +2 -2
  43. data/lib/fox16/glshapes.rb +6 -6
  44. data/lib/fox16/iterators.rb +13 -8
  45. data/lib/fox16/kwargs.rb +604 -380
  46. data/lib/fox16/version.rb +1 -1
  47. data/tests/TC_FXTreeList.rb +13 -13
  48. data/tests/TC_FXTreeListBox.rb +3 -3
  49. metadata +4 -3
data/examples/inputs.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'fox16'
4
+ require 'fox16/kwargs'
4
5
 
5
6
  include Fox
6
7
 
@@ -8,20 +9,19 @@ class InputHandlerWindow < FXMainWindow
8
9
 
9
10
  def initialize(app)
10
11
  # Initialize base class first
11
- super(app, "Input Handlers Test", nil, nil, DECOR_ALL, 0, 0, 400, 300)
12
+ super(app, "Input Handlers Test", :opts => DECOR_ALL, :width => 400, :height => 300)
12
13
 
13
14
  # Text area plus a button
14
15
  commands = FXHorizontalFrame.new(self, LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X)
15
16
  FXLabel.new(commands, "Command:")
16
- @cmdInput = FXTextField.new(commands, 30,
17
- nil, 0, FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X)
17
+ @cmdInput = FXTextField.new(commands, 30, :opts => FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X)
18
18
  @cmdInput.connect(SEL_COMMAND, method(:onCmdText))
19
19
  FXHorizontalSeparator.new(self, LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X)
20
20
  textFrame = FXVerticalFrame.new(self,
21
21
  FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y)
22
22
 
23
23
  # Output will be displayed in a multiline text area
24
- @cmdOutput = FXText.new(textFrame, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y)
24
+ @cmdOutput = FXText.new(textFrame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
25
25
 
26
26
  # Initialize the pipe
27
27
  @pipe = nil
@@ -52,19 +52,19 @@ class InputHandlerWindow < FXMainWindow
52
52
  @pipe = IO.popen(@cmdInput.text)
53
53
 
54
54
  # Register input callbacks and return
55
- getApp().addInput(@pipe, INPUT_READ|INPUT_EXCEPT) { |sender, sel, ptr|
55
+ getApp().addInput(@pipe, INPUT_READ|INPUT_EXCEPT) do |sender, sel, ptr|
56
56
  case FXSELTYPE(sel)
57
- when SEL_IO_READ
58
- text = @pipe.read
59
- if text && text.length > 0
60
- @cmdOutput.appendText(text)
61
- else
62
- closePipe
63
- end
64
- when SEL_IO_EXCEPT
65
- # puts 'onPipeExcept'
57
+ when SEL_IO_READ
58
+ text = @pipe.read
59
+ if text && text.length > 0
60
+ @cmdOutput.appendText(text)
61
+ else
62
+ closePipe
63
+ end
64
+ when SEL_IO_EXCEPT
65
+ # puts 'onPipeExcept'
66
66
  end
67
- }
67
+ end
68
68
  return 1
69
69
  end
70
70
  end
data/examples/mditest.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'fox16'
4
4
  require 'fox16/colors'
5
+ require 'fox16/kwargs'
5
6
 
6
7
  include Fox
7
8
 
@@ -47,7 +48,7 @@ class MDITestWindow < FXMainWindow
47
48
 
48
49
  def initialize(app)
49
50
  # Invoke base class initialize method first
50
- super(app, "MDI Widget Test", nil, nil, DECOR_ALL, 0, 0, 800, 600)
51
+ super(app, "MDI Widget Test", :opts => DECOR_ALL, :width => 800, :height => 600)
51
52
 
52
53
  # Create the font
53
54
  @font = FXFont.new(getApp(), "courier", 15, FONTWEIGHT_BOLD)
@@ -64,9 +65,9 @@ class MDITestWindow < FXMainWindow
64
65
 
65
66
  # Icon for MDI Child
66
67
  @mdiicon = nil
67
- File.open(File.join("icons", "penguin.png"), "rb") { |f|
68
+ File.open(File.join("icons", "penguin.png"), "rb") do |f|
68
69
  @mdiicon = FXPNGIcon.new(getApp(), f.read)
69
- }
70
+ end
70
71
 
71
72
  # Make MDI Menu
72
73
  @mdimenu = FXMDIMenu.new(self, @mdiclient)
@@ -133,8 +134,8 @@ class MDITestWindow < FXMainWindow
133
134
  0, x, y, w, h)
134
135
  scrollwindow = FXScrollWindow.new(mdichild, 0)
135
136
  scrollwindow.verticalScrollBar.setLine(@font.fontHeight)
136
- btn = FXButton.new(scrollwindow, TYGER, nil, nil, 0,
137
- LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT, 0, 0, 600, 1000)
137
+ btn = FXButton.new(scrollwindow, TYGER,
138
+ :opts => LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT, :width => 600, :height => 1000)
138
139
  btn.font = @font
139
140
  btn.backColor = FXColor::White
140
141
  mdichild
data/examples/pig.rb CHANGED
@@ -5,6 +5,7 @@
5
5
  #
6
6
 
7
7
  require 'fox16'
8
+ require 'fox16/kwargs'
8
9
 
9
10
  include Fox
10
11
 
@@ -1,60 +1,51 @@
1
- require 'cgi'
2
1
  require 'fox16'
3
- begin
4
- require 'RAA'
5
- rescue LoadError
6
- require 'fox16/missingdep'
7
- MSG = <<EOM
8
- Sorry, this example depends on the SOAP4R extension. Please
9
- check the Ruby Application Archives for an appropriate
10
- download site.
11
- EOM
12
- missingDependency(MSG)
13
- end
2
+ require 'fox16/kwargs'
3
+ require 'cgi'
4
+ require 'soap/wsdlDriver'
14
5
 
15
6
  include Fox
16
7
 
17
8
  class RAABrowserWindow < FXMainWindow
9
+
18
10
  def initialize(app)
19
11
  # Initialize base class
20
- super(app, "Ruby Application Archive", nil, nil, DECOR_ALL, 0, 0, 600, 600)
21
-
12
+ super(app, "Ruby Application Archive", :opts => DECOR_ALL, :width => 600, :height => 600)
13
+
22
14
  # Contents
23
15
  contents = FXHorizontalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y)
24
16
 
25
17
  # Horizontal splitter
26
18
  splitter = FXSplitter.new(contents, (LAYOUT_SIDE_TOP|LAYOUT_FILL_X|
27
- LAYOUT_FILL_Y|SPLITTER_TRACKING|SPLITTER_HORIZONTAL))
19
+ LAYOUT_FILL_Y|SPLITTER_TRACKING|SPLITTER_HORIZONTAL))
28
20
 
29
21
  # Create a sunken frame to hold the tree list
30
22
  groupbox = FXGroupBox.new(splitter, "Contents",
31
- LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE)
23
+ LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE)
32
24
  frame = FXHorizontalFrame.new(groupbox,
33
- LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK)
25
+ LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK)
34
26
 
35
27
  # Create the empty tree list
36
- @treeList = FXTreeList.new(frame, nil, 0,
37
- (TREELIST_BROWSESELECT|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|
38
- TREELIST_ROOT_BOXES|LAYOUT_FILL_X|LAYOUT_FILL_Y))
28
+ @treeList = FXTreeList.new(frame,
29
+ :opts => TREELIST_BROWSESELECT|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|LAYOUT_FILL_X|LAYOUT_FILL_Y)
39
30
  @treeList.connect(SEL_COMMAND) do |sender, sel, item|
40
31
  if @treeList.isItemLeaf(item)
41
32
  getApp().beginWaitCursor do
42
33
  begin
43
- info = @raa.getInfoFromName(item.text)
44
- @category.value = info.category.major + "/" + info.category.minor
45
- @projectName.value = info.product.name
46
- @version.value = info.product.version
47
- @status.value = info.product.status
48
- @lastUpdate.value = info.update.strftime("%F %T GMT")
49
- @owner.value = "#{info.owner.name} (#{info.owner.email.to_s})"
50
- @homepage.value = info.product.homepage.to_s
51
- @download.value = info.product.download.to_s
52
- @license.value = info.product.license
53
- @description.value = CGI::unescapeHTML(info.product.description).gsub(/\r\n/, "\n")
54
- rescue SOAP::PostUnavailableError => ex
55
- getApp().endWaitCursor
56
- FXMessageBox.error(self, MBOX_OK, "SOAP Error", ex.message)
57
- end
34
+ gem = @raa.gem(item.text)
35
+ @category.value = gem.category.major + "/" + gem.category.minor
36
+ @projectName.value = gem.project.name
37
+ @version.value = gem.project.version
38
+ @status.value = gem.project.status
39
+ @lastUpdate.value = gem.updated.strftime("%F %T GMT")
40
+ @owner.value = "#{gem.owner.name} (#{gem.owner.email.to_s})"
41
+ @homepage.value = gem.project.url.to_s
42
+ @download.value = gem.project.download.to_s
43
+ @license.value = gem.project.license
44
+ @description.value = CGI::unescapeHTML(gem.project.description).gsub(/\r\n/, "\n")
45
+ rescue SOAP::PostUnavailableError => ex
46
+ getApp().endWaitCursor
47
+ FXMessageBox.error(self, MBOX_OK, "SOAP Error", ex.message)
48
+ end
58
49
  end
59
50
  end
60
51
  end
@@ -100,18 +91,18 @@ class RAABrowserWindow < FXMainWindow
100
91
  FXText.new(descriptionFrame, @description, FXDataTarget::ID_VALUE, TEXT_READONLY|TEXT_WORDWRAP|LAYOUT_FILL_X|LAYOUT_FILL_Y)
101
92
 
102
93
  # Initialize the service
103
- @raa = RAA::Driver.new
94
+ @raa = SOAP::WSDLDriverFactory.new("http://www2.ruby-lang.org/xmlns/soap/interface/RAA/0.0.4/").create_rpc_driver
104
95
 
105
96
  # Set up the product tree list
106
- @productTree = @raa.getProductTree
97
+ @productTree = @raa.tree_by_category
107
98
  @productTree.keys.sort.each do |sectionName|
108
99
  sectionHash = @productTree[sectionName]
109
- sectionItem = @treeList.addItemLast(nil, sectionName)
100
+ sectionItem = @treeList.appendItem(nil, sectionName)
110
101
  sectionHash.keys.sort.each do |categoryName|
111
102
  categoryArray = sectionHash[categoryName]
112
- categoryItem = @treeList.addItemLast(sectionItem, categoryName)
103
+ categoryItem = @treeList.appendItem(sectionItem, categoryName)
113
104
  categoryArray.each do |productName|
114
- productItem = @treeList.addItemLast(categoryItem, productName)
105
+ productItem = @treeList.appendItem(categoryItem, productName)
115
106
  end
116
107
  end
117
108
  end
data/examples/ratio.rb CHANGED
@@ -6,6 +6,7 @@
6
6
 
7
7
  require 'fox16'
8
8
  require 'fox16/colors'
9
+ require 'fox16/kwargs'
9
10
 
10
11
  include Fox
11
12
 
@@ -13,36 +14,46 @@ class MainWindow < FXMainWindow
13
14
 
14
15
  def initialize(app)
15
16
  # Initialize base class first
16
- super(app, 'Ratio', nil, nil, DECOR_ALL, 0, 0, 400, 200, 8, 8, 8, 8, 6, 6)
17
+ super(app, 'Ratio', :opts => DECOR_ALL,
18
+ :width => 400, :height => 200,
19
+ :padLeft => 8, :padRight => 8, :padTop => 8, :padBottom =>8,
20
+ :hSpacing => 6, :vSpacing => 6)
17
21
 
18
22
  # Add quit button and connect it to application
19
- FXButton.new(self, "&Quit", nil, app, FXApp::ID_QUIT, FRAME_RAISED|FRAME_THICK|LAYOUT_SIDE_BOTTOM|LAYOUT_CENTER_X, 0, 0, 0, 0, 20, 20, 2, 2)
23
+ FXButton.new(self, "&Quit", nil, app, FXApp::ID_QUIT,
24
+ :opts => FRAME_RAISED|FRAME_THICK|LAYOUT_SIDE_BOTTOM|LAYOUT_CENTER_X,
25
+ :padLeft => 20, :padRight => 20, :padTop => 2, :padBottom => 2)
20
26
 
21
27
  # Label above it
22
- FXLabel.new(self, "FXSpring can be used to keep widgets at fixed size ratios.\n\nResize the window to see how it behaves!", nil, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
28
+ FXLabel.new(self,
29
+ "FXSpring can be used to keep widgets at fixed size ratios.\n\nResize the window to see how it behaves!",
30
+ :opts => LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
23
31
 
24
32
  # Layout manager to place the springs
25
- horz = FXHorizontalFrame.new(self, FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
33
+ horz = FXHorizontalFrame.new(self, FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y,
34
+ :padLeft => 0, :padRight => 0, :padTop => 0, :padBottom => 0,
35
+ :hSpacing => 0, :vSpacing => 0)
26
36
 
27
37
  # First spring is set to behave normally in Y direction,
28
38
  # but to have a ratio 1 for the X direction
29
- FXSpring.new(horz, LAYOUT_FILL_X|LAYOUT_FILL_Y, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0) do |spring1|
30
- FXLabel.new(spring1, "1", nil, LAYOUT_FILL_X|LAYOUT_FILL_Y) do |label1|
31
- label1.backColor = FXColor::Red
39
+ FXSpring.new(horz, LAYOUT_FILL_X|LAYOUT_FILL_Y, :relw => 1, :padding => 0) do |spring|
40
+ FXLabel.new(spring, "1", :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y) do |label|
41
+ label.backColor = FXColor::Red
32
42
  end
33
43
  end
34
44
 
35
45
  # Second spring has ratio 2 in the X direction
36
- FXSpring.new(horz, LAYOUT_FILL_X|LAYOUT_FILL_Y, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0) do |spring2|
37
- FXLabel.new(spring2, "2", nil, LAYOUT_FILL_X|LAYOUT_FILL_Y) do |label2|
38
- label2.backColor = FXColor::Green
46
+ FXSpring.new(horz, LAYOUT_FILL_X|LAYOUT_FILL_Y, :relw => 2, :padding => 0) do |spring|
47
+ FXLabel.new(spring, "2", :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y) do |label|
48
+ label.backColor = FXColor::Green
39
49
  end
40
50
  end
41
51
 
42
52
  # Third spring has ratio 3 in the X direction
43
- FXSpring.new(horz, LAYOUT_FILL_X|LAYOUT_FILL_Y, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0) do |spring3|
44
- FXLabel.new(spring3, "3", nil, LAYOUT_FILL_X|LAYOUT_FILL_Y) do |label3|
45
- label3.backColor = FXColor::Blue
53
+ FXSpring.new(horz, LAYOUT_FILL_X|LAYOUT_FILL_Y, :relw => 3, :padding => 0) do |spring|
54
+ puts "pl, pr, pt, pb = #{spring.padLeft}, #{spring.padRight}, #{spring.padTop}, #{spring.padBottom}"
55
+ FXLabel.new(spring, "3", :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y) do |label|
56
+ label.backColor = FXColor::Blue
46
57
  end
47
58
  end
48
59
  end
@@ -55,16 +66,16 @@ class MainWindow < FXMainWindow
55
66
  end # class MainWindow
56
67
 
57
68
  if __FILE__ == $0
58
- # Construct an application
69
+ # Construct an application
59
70
  FXApp.new('Smithy', 'Max') do |theApp|
60
71
 
61
- # Construct the main window
72
+ # Construct the main window
62
73
  MainWindow.new(theApp)
63
74
 
64
75
  # Create and show the application windows
65
76
  theApp.create
66
77
 
67
- # Run the application
78
+ # Run the application
68
79
  theApp.run
69
80
  end
70
81
  end
@@ -1,17 +1,18 @@
1
1
  require 'fox16'
2
+ require 'fox16/kwargs'
2
3
 
3
4
  include Fox
4
5
 
5
6
  class RulerViewExample < FXMainWindow
6
7
  def initialize(app)
7
8
  # Initialize base class
8
- super(app, "Ruler View", nil, nil, DECOR_ALL, 0, 0, 400, 400)
9
+ super(app, "Ruler View", :opts => DECOR_ALL, :width => 400, :height => 400)
9
10
 
10
11
  # Construct a ruler view inside
11
- ruler_view = FXRulerView.new(self, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y)
12
+ ruler_view = FXRulerView.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
12
13
 
13
14
  # And put some content inside that
14
- contents = FXText.new(ruler_view, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y)
15
+ contents = FXText.new(ruler_view, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
15
16
  contents.text = "This is a test."
16
17
  end
17
18
  end
data/examples/scribble.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'fox16'
4
+ require 'fox16/kwargs'
4
5
 
5
6
  include Fox
6
7
 
@@ -8,28 +9,26 @@ class ScribbleWindow < FXMainWindow
8
9
 
9
10
  def initialize(app)
10
11
  # Call base class initializer first
11
- super(app, "Scribble Application", nil, nil, DECOR_ALL,
12
- 0, 0, 800, 600)
12
+ super(app, "Scribble Application", :width => 800, :height => 600)
13
13
 
14
14
  # Construct a horizontal frame to hold the main window's contents
15
15
  @contents = FXHorizontalFrame.new(self,
16
- LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0)
16
+ LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y,
17
+ :padLeft => 0, :padRight => 0, :padTop => 0, :padBottom => 0)
17
18
 
18
19
  # Left pane contains the canvas
19
20
  @canvasFrame = FXVerticalFrame.new(@contents,
20
21
  FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_LEFT,
21
- 0, 0, 0, 0, 10, 10, 10, 10)
22
+ :padLeft => 10, :padRight => 10, :padTop => 10, :padBottom => 10)
22
23
 
23
24
  # Place a label above the canvas
24
- FXLabel.new(@canvasFrame, "Canvas Frame", nil,
25
- JUSTIFY_CENTER_X|LAYOUT_FILL_X)
25
+ FXLabel.new(@canvasFrame, "Canvas Frame", nil, JUSTIFY_CENTER_X|LAYOUT_FILL_X)
26
26
 
27
27
  # Horizontal divider line
28
28
  FXHorizontalSeparator.new(@canvasFrame, SEPARATOR_GROOVE|LAYOUT_FILL_X)
29
29
 
30
30
  # Drawing canvas
31
- @canvas = FXCanvas.new(@canvasFrame, nil, 0,
32
- LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_LEFT)
31
+ @canvas = FXCanvas.new(@canvasFrame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_LEFT)
33
32
  @canvas.connect(SEL_PAINT) do |sender, sel, event|
34
33
  FXDCWindow.new(@canvas, event) do |dc|
35
34
  dc.foreground = @canvas.backColor
@@ -94,24 +93,22 @@ class ScribbleWindow < FXMainWindow
94
93
  # Right pane for the buttons
95
94
  @buttonFrame = FXVerticalFrame.new(@contents,
96
95
  FRAME_SUNKEN|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_LEFT,
97
- 0, 0, 0, 0, 10, 10, 10, 10)
96
+ :padLeft => 10, :padRight => 10, :padTop => 10, :padBottom => 10)
98
97
 
99
98
  # Label above the buttons
100
- FXLabel.new(@buttonFrame, "Button Frame", nil,
101
- JUSTIFY_CENTER_X|LAYOUT_FILL_X)
99
+ FXLabel.new(@buttonFrame, "Button Frame", nil, JUSTIFY_CENTER_X|LAYOUT_FILL_X)
102
100
 
103
101
  # Horizontal divider line
104
- FXHorizontalSeparator.new(@buttonFrame,
105
- SEPARATOR_RIDGE|LAYOUT_FILL_X)
102
+ FXHorizontalSeparator.new(@buttonFrame, SEPARATOR_RIDGE|LAYOUT_FILL_X)
106
103
 
107
104
  # Enable or disable mirror mode
108
105
  @mirrorMode = FXDataTarget.new(false)
109
106
  FXCheckButton.new(@buttonFrame, "Mirror", @mirrorMode, FXDataTarget::ID_VALUE, CHECKBUTTON_NORMAL|LAYOUT_FILL_X)
110
107
 
111
108
  # Button to clear the canvas
112
- clearButton = FXButton.new(@buttonFrame, "&Clear", nil, nil, 0,
113
- FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_TOP|LAYOUT_LEFT,
114
- 0, 0, 0, 0, 10, 10, 5, 5)
109
+ clearButton = FXButton.new(@buttonFrame, "&Clear",
110
+ :opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_TOP|LAYOUT_LEFT,
111
+ :padLeft => 10, :padRight => 10, :padTop => 5, :padBottom => 5)
115
112
  clearButton.connect(SEL_COMMAND) do
116
113
  FXDCWindow.new(@canvas) do |dc|
117
114
  dc.foreground = @canvas.backColor
@@ -136,7 +133,7 @@ class ScribbleWindow < FXMainWindow
136
133
  # Exit button
137
134
  FXButton.new(@buttonFrame, "&Exit", nil, app, FXApp::ID_QUIT,
138
135
  FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_TOP|LAYOUT_LEFT,
139
- 0, 0, 0, 0, 10, 10, 5, 5)
136
+ :padLeft => 10, :padRight => 10, :padTop => 5, :padBottom => 5)
140
137
 
141
138
  # Initialize other member variables
142
139
  @drawColor = "red"
data/examples/shutter.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'fox16'
4
+ require 'fox16/kwargs'
4
5
 
5
6
  include Fox
6
7
 
@@ -8,7 +9,7 @@ GORTS_BLURB = "Icons courtesy of Gort's Icons:\nhttp://www.forrestwalter.com/ico
8
9
 
9
10
  class ShutterItem < FXShutterItem
10
11
  def initialize(p, text, icon=nil, opts=0)
11
- super(p, text, icon, opts|LAYOUT_FILL_X|LAYOUT_TOP|LAYOUT_LEFT, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10)
12
+ super(p, text, icon, opts|LAYOUT_FILL_X|LAYOUT_TOP|LAYOUT_LEFT, :padding => 10, :hSpacing => 10, :vSpacing => 10)
12
13
  button.padTop = 2
13
14
  button.padBottom = 2
14
15
  end
@@ -16,7 +17,7 @@ end
16
17
 
17
18
  class ShutterButton < FXButton
18
19
  def initialize(p, txt, ic=nil)
19
- super(p, txt, ic, nil, 0, BUTTON_TOOLBAR|TEXT_BELOW_ICON|FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_TOP|LAYOUT_LEFT)
20
+ super(p, txt, ic, :opts => BUTTON_TOOLBAR|TEXT_BELOW_ICON|FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_TOP|LAYOUT_LEFT)
20
21
  self.backColor = p.backColor
21
22
  self.textColor = FXRGB(255, 255, 255)
22
23
  end
@@ -31,9 +32,9 @@ class ShutterWindow < FXMainWindow
31
32
  begin
32
33
  filename = File.join("icons", filename)
33
34
  icon = nil
34
- File.open(filename, "rb") { |f|
35
+ File.open(filename, "rb") do |f|
35
36
  icon = FXICOIcon.new(getApp(), f.read)
36
- }
37
+ end
37
38
  icon
38
39
  rescue
39
40
  raise RuntimeError, "Couldn't load icon: #{filename}"
@@ -42,7 +43,7 @@ class ShutterWindow < FXMainWindow
42
43
 
43
44
  def initialize(app)
44
45
  # Invoke base class initialize first
45
- super(app, "Look Out!", nil, nil, DECOR_ALL, 0, 0, 600, 600)
46
+ super(app, "Look Out!", :opts => DECOR_ALL, :width => 600, :height => 600)
46
47
 
47
48
  # Menubar along the top
48
49
  menubar = FXMenuBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
@@ -85,9 +86,9 @@ class ShutterWindow < FXMainWindow
85
86
  LAYOUT_FILL_Y|SPLITTER_TRACKING))
86
87
 
87
88
  # Shutter area on the left
88
- @shutter = FXShutter.new(splitter, nil, 0,
89
- FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y,
90
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
89
+ @shutter = FXShutter.new(splitter,
90
+ :opts => FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y,
91
+ :padding => 0, :hSpacing => 0, :vSpacing => 0)
91
92
 
92
93
  fatBot = loadIcon("FatBot.ico")
93
94
  angryGuy = loadIcon("AngryGuyInBunnySuit.ico")
@@ -121,7 +122,7 @@ class ShutterWindow < FXMainWindow
121
122
  # Right pane is a switcher
122
123
  # For a real application, each panel in the switcher would have real, working contents...
123
124
  @switcher = FXSwitcher.new(splitter,
124
- FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0)
125
+ FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
125
126
 
126
127
  FXLabel.new(@switcher,
127
128
  "Lookout Today!\n\n#{GORTS_BLURB}", nil, LAYOUT_FILL_X|LAYOUT_FILL_Y)