fxruby 1.6.5 → 1.6.6

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 (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
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'fox16'
4
+ require 'fox16/kwargs'
4
5
  require 'soap/rpc/driver'
5
6
 
6
7
  include Fox
@@ -41,14 +42,12 @@ class Babelfish < FXMainWindow
41
42
  controlsFrame = FXHorizontalFrame.new(self,
42
43
  LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X)
43
44
  FXLabel.new(controlsFrame, "Translate from:")
44
- @transModeCombo = FXComboBox.new(controlsFrame, 15, nil, 0,
45
- COMBOBOX_STATIC|FRAME_SUNKEN|FRAME_THICK)
45
+ @transModeCombo = FXComboBox.new(controlsFrame, 15, :opts => COMBOBOX_STATIC|FRAME_SUNKEN|FRAME_THICK)
46
46
  @transModeCombo.numVisible = 6
47
47
  TRANSLATIONS.keys.each do |key|
48
48
  @transModeCombo.appendItem(key, TRANSLATIONS[key])
49
49
  end
50
- btn = FXButton.new(controlsFrame, "Translate", nil, nil, 0,
51
- BUTTON_NORMAL|LAYOUT_SIDE_RIGHT)
50
+ btn = FXButton.new(controlsFrame, "Translate", :opts => BUTTON_NORMAL|LAYOUT_SIDE_RIGHT)
52
51
  btn.connect(SEL_COMMAND) do
53
52
  transMode = @transModeCombo.getItemData(@transModeCombo.currentItem)
54
53
  getApp().beginWaitCursor() do
@@ -61,19 +60,17 @@ class Babelfish < FXMainWindow
61
60
 
62
61
  # Source text area in a sunken frame
63
62
  topFrame = FXVerticalFrame.new(mainFrame, LAYOUT_FILL_X|LAYOUT_FILL_Y)
64
- FXLabel.new(topFrame, "Source Text:", nil, LAYOUT_FILL_X)
63
+ FXLabel.new(topFrame, "Source Text:", :opts => LAYOUT_FILL_X)
65
64
  sunkenFrame = FXHorizontalFrame.new(topFrame,
66
65
  FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y)
67
- @sourceText = FXText.new(sunkenFrame, nil, 0,
68
- LAYOUT_FILL_X|LAYOUT_FILL_Y)
66
+ @sourceText = FXText.new(sunkenFrame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
69
67
 
70
68
  # Translated text output
71
69
  bottomFrame = FXVerticalFrame.new(mainFrame, LAYOUT_FILL_X|LAYOUT_FILL_Y)
72
70
  FXLabel.new(bottomFrame, "Translated text:", nil, LAYOUT_FILL_X)
73
71
  sunkenFrame = FXHorizontalFrame.new(bottomFrame,
74
72
  FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y)
75
- @translatedText = FXText.new(sunkenFrame, nil, 0,
76
- TEXT_READONLY|LAYOUT_FILL_X|LAYOUT_FILL_Y)
73
+ @translatedText = FXText.new(sunkenFrame, :opts => TEXT_READONLY|LAYOUT_FILL_X|LAYOUT_FILL_Y)
77
74
  end
78
75
 
79
76
  def create
data/examples/bounce.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'fox16'
2
+ require 'fox16/kwargs'
2
3
 
3
4
  include Fox
4
5
 
@@ -71,10 +72,10 @@ class BounceWindow < FXMainWindow
71
72
 
72
73
  def initialize(app)
73
74
  # Initialize base class first
74
- super(app, "Bounce", nil, nil, DECOR_ALL, 0, 0, 400, 300)
75
+ super(app, "Bounce", :opts => DECOR_ALL, :width => 400, :height => 300)
75
76
 
76
77
  # Set up the canvas
77
- @canvas = FXCanvas.new(self, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y)
78
+ @canvas = FXCanvas.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
78
79
 
79
80
  # Set up the back buffer
80
81
  @backBuffer = FXImage.new(app, nil, IMAGE_KEEP)
@@ -150,10 +151,10 @@ class BounceWindow < FXMainWindow
150
151
  end
151
152
 
152
153
  if __FILE__ == $0
153
- FXApp.new("Bounce", "FXRuby") { |theApp|
154
+ FXApp.new("Bounce", "FXRuby") do |theApp|
154
155
  BounceWindow.new(theApp)
155
156
  theApp.create
156
157
  theApp.run
157
- }
158
+ end
158
159
  end
159
160
 
data/examples/button.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 @@ class ButtonWindow < FXMainWindow
8
9
 
9
10
  def initialize(app)
10
11
  # Invoke base class initialize first
11
- super(app, "Button Test", nil, nil, DECOR_ALL, 100, 100, 0, 0)
12
+ super(app, "Button Test", :opts => DECOR_ALL, :x => 100, :y => 100)
12
13
 
13
14
  # Create a tooltip
14
15
  FXToolTip.new(self.getApp())
@@ -28,7 +29,7 @@ class ButtonWindow < FXMainWindow
28
29
  # Contents
29
30
  contents = FXHorizontalFrame.new(self,
30
31
  LAYOUT_SIDE_LEFT|FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y|PACK_UNIFORM_WIDTH,
31
- 0, 0, 0, 0, 20, 20, 20, 20)
32
+ :padding => 20)
32
33
 
33
34
  # Construct icon from a PNG file on disk
34
35
  bigpenguin = loadIcon("bigpenguin.png")
@@ -40,12 +41,11 @@ class ButtonWindow < FXMainWindow
40
41
  "It also has a tooltip\n(which, by the way, can be multi-line also).\t" +
41
42
  "Here's a helpful message for the status line.",
42
43
  bigpenguin,
43
- nil, 0,
44
- FRAME_RAISED|FRAME_THICK|LAYOUT_CENTER_X|LAYOUT_CENTER_Y|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT,
45
- 0, 0, 300, 200)
44
+ :opts => FRAME_RAISED|FRAME_THICK|LAYOUT_CENTER_X|LAYOUT_CENTER_Y|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT,
45
+ :width => 300, :height => 200)
46
46
 
47
47
  checkButton = FXCheckButton.new(controls, "Toolbar Style\tCool \"poppy\" style buttons")
48
- checkButton.connect(SEL_COMMAND) { |sender, sel, checked|
48
+ checkButton.connect(SEL_COMMAND) do |sender, sel, checked|
49
49
  if checked
50
50
  @button.buttonStyle |= BUTTON_TOOLBAR
51
51
  @button.frameStyle = FRAME_RAISED
@@ -53,12 +53,12 @@ class ButtonWindow < FXMainWindow
53
53
  @button.buttonStyle &= ~BUTTON_TOOLBAR
54
54
  @button.frameStyle = FRAME_RAISED|FRAME_THICK
55
55
  end
56
- }
56
+ end
57
57
 
58
58
  group1 = FXGroupBox.new(controls, "Horizontal Placement",
59
59
  GROUPBOX_TITLE_CENTER|FRAME_RIDGE)
60
60
  @group1_dt = FXDataTarget.new(2)
61
- @group1_dt.connect(SEL_COMMAND) {
61
+ @group1_dt.connect(SEL_COMMAND) do
62
62
  case @group1_dt.value
63
63
  when 0
64
64
  @button.iconPosition = (@button.iconPosition|ICON_BEFORE_TEXT) & ~ICON_AFTER_TEXT
@@ -67,7 +67,7 @@ class ButtonWindow < FXMainWindow
67
67
  when 2
68
68
  @button.iconPosition = (@button.iconPosition & ~ICON_AFTER_TEXT) & ~ICON_BEFORE_TEXT
69
69
  end
70
- }
70
+ end
71
71
  FXRadioButton.new(group1, "Before Text", @group1_dt, FXDataTarget::ID_OPTION)
72
72
  FXRadioButton.new(group1, "After Text", @group1_dt, FXDataTarget::ID_OPTION + 1)
73
73
  FXRadioButton.new(group1, "Centered", @group1_dt, FXDataTarget::ID_OPTION + 2)
@@ -75,7 +75,7 @@ class ButtonWindow < FXMainWindow
75
75
  group2 = FXGroupBox.new(controls, "Vertical Placement",
76
76
  GROUPBOX_TITLE_CENTER|FRAME_RIDGE)
77
77
  @group2_dt = FXDataTarget.new(2)
78
- @group2_dt.connect(SEL_COMMAND) {
78
+ @group2_dt.connect(SEL_COMMAND) do
79
79
  case @group2_dt.value
80
80
  when 0
81
81
  @button.iconPosition = (@button.iconPosition|ICON_ABOVE_TEXT) & ~ICON_BELOW_TEXT
@@ -84,7 +84,7 @@ class ButtonWindow < FXMainWindow
84
84
  when 2
85
85
  @button.iconPosition = (@button.iconPosition & ~ICON_ABOVE_TEXT) & ~ICON_BELOW_TEXT
86
86
  end
87
- }
87
+ end
88
88
  FXRadioButton.new(group2, "Above Text", @group2_dt, FXDataTarget::ID_OPTION)
89
89
  FXRadioButton.new(group2, "Below Text", @group2_dt, FXDataTarget::ID_OPTION + 1)
90
90
  FXRadioButton.new(group2, "Centered", @group2_dt, FXDataTarget::ID_OPTION + 2)
@@ -92,7 +92,7 @@ class ButtonWindow < FXMainWindow
92
92
  group3 = FXGroupBox.new(controls, "Horizontal Justification",
93
93
  GROUPBOX_TITLE_CENTER|FRAME_RIDGE)
94
94
  @group3_dt = FXDataTarget.new(0)
95
- @group3_dt.connect(SEL_COMMAND) {
95
+ @group3_dt.connect(SEL_COMMAND) do
96
96
  case @group3_dt.value
97
97
  when 0
98
98
  @button.justify &= ~JUSTIFY_HZ_APART
@@ -103,7 +103,7 @@ class ButtonWindow < FXMainWindow
103
103
  when 3
104
104
  @button.justify |= JUSTIFY_HZ_APART
105
105
  end
106
- }
106
+ end
107
107
  FXRadioButton.new(group3, "Center", @group3_dt, FXDataTarget::ID_OPTION)
108
108
  FXRadioButton.new(group3, "Left", @group3_dt, FXDataTarget::ID_OPTION + 1)
109
109
  FXRadioButton.new(group3, "Right", @group3_dt, FXDataTarget::ID_OPTION + 2)
@@ -112,7 +112,7 @@ class ButtonWindow < FXMainWindow
112
112
  group4 = FXGroupBox.new(controls, "Vertical Justification",
113
113
  GROUPBOX_TITLE_CENTER|FRAME_RIDGE)
114
114
  @group4_dt = FXDataTarget.new(0)
115
- @group4_dt.connect(SEL_COMMAND) {
115
+ @group4_dt.connect(SEL_COMMAND) do
116
116
  case @group4_dt.value
117
117
  when 0
118
118
  @button.justify &= ~JUSTIFY_VT_APART
@@ -123,16 +123,14 @@ class ButtonWindow < FXMainWindow
123
123
  when 3
124
124
  @button.justify |= JUSTIFY_VT_APART
125
125
  end
126
- }
126
+ end
127
127
  FXRadioButton.new(group4, "Center", @group4_dt, FXDataTarget::ID_OPTION)
128
128
  FXRadioButton.new(group4, "Top", @group4_dt, FXDataTarget::ID_OPTION + 1)
129
129
  FXRadioButton.new(group4, "Bottom", @group4_dt, FXDataTarget::ID_OPTION + 2)
130
130
  FXRadioButton.new(group4, "Apart", @group4_dt, FXDataTarget::ID_OPTION + 3)
131
131
 
132
- quitButton = FXButton.new(controls, "&Quit", nil, nil, 0, FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X)
133
- quitButton.connect(SEL_COMMAND) {
134
- getApp().exit(0)
135
- }
132
+ quitButton = FXButton.new(controls, "&Quit", :opts => FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X)
133
+ quitButton.connect(SEL_COMMAND) { getApp().exit(0) }
136
134
  end
137
135
 
138
136
  # Load the named icon from a file
@@ -140,9 +138,9 @@ class ButtonWindow < FXMainWindow
140
138
  begin
141
139
  filename = File.join("icons", filename)
142
140
  icon = nil
143
- File.open(filename, "rb") { |f|
141
+ File.open(filename, "rb") do |f|
144
142
  icon = FXPNGIcon.new(getApp(), f.read)
145
- }
143
+ end
146
144
  icon
147
145
  rescue
148
146
  raise RuntimeError, "Couldn't load icon: #{filename}"
@@ -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
 
@@ -24,7 +25,7 @@ END
24
25
  class DataTargetWindow < FXMainWindow
25
26
  def initialize(app)
26
27
  # Initialize base class
27
- super(app, "Data Targets Test", nil, nil, DECOR_ALL, 20, 20, 700, 460)
28
+ super(app, "Data Targets Test", :opts => DECOR_ALL, :x => 20, :y => 20, :width => 700, :height => 460)
28
29
 
29
30
  # Create a data target with an integer value
30
31
  @intTarget = FXDataTarget.new(10)
@@ -86,7 +87,7 @@ class DataTargetWindow < FXMainWindow
86
87
  LAYOUT_SIDE_TOP|SEPARATOR_GROOVE|LAYOUT_FILL_X)
87
88
  FXSlider.new(self, @intTarget, FXDataTarget::ID_VALUE, (SLIDER_VERTICAL|
88
89
  SLIDER_INSIDE_BAR|LAYOUT_SIDE_RIGHT|LAYOUT_FILL_Y|LAYOUT_FIX_WIDTH),
89
- 0, 0, 20, 0)
90
+ :width => 20)
90
91
 
91
92
  # Arrange nicely
92
93
  matrix = FXMatrix.new(self, 7,
@@ -100,10 +101,10 @@ class DataTargetWindow < FXMainWindow
100
101
  FXTextField.new(matrix, 10, @intTarget, FXDataTarget::ID_VALUE,
101
102
  LAYOUT_CENTER_Y|LAYOUT_CENTER_X|FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_ROW)
102
103
  FXSlider.new(matrix, @intTarget, FXDataTarget::ID_VALUE,
103
- LAYOUT_CENTER_Y|LAYOUT_FILL_ROW|LAYOUT_FIX_WIDTH, 0, 0, 100)
104
+ LAYOUT_CENTER_Y|LAYOUT_FILL_ROW|LAYOUT_FIX_WIDTH, :width => 100)
104
105
  FXDial.new(matrix, @intTarget, FXDataTarget::ID_VALUE, (LAYOUT_CENTER_Y|
105
106
  LAYOUT_FILL_ROW|LAYOUT_FIX_WIDTH|DIAL_HORIZONTAL|DIAL_HAS_NOTCH),
106
- 0, 0, 100)
107
+ :width => 100)
107
108
  FXSpinner.new(matrix, 5, @intTarget, FXDataTarget::ID_VALUE,
108
109
  SPIN_CYCLIC|FRAME_SUNKEN|FRAME_THICK|LAYOUT_CENTER_Y|LAYOUT_FILL_ROW)
109
110
  FXProgressBar.new(matrix, @intTarget, FXDataTarget::ID_VALUE,
@@ -120,10 +121,10 @@ class DataTargetWindow < FXMainWindow
120
121
  (TEXTFIELD_REAL|LAYOUT_CENTER_Y|LAYOUT_CENTER_X|
121
122
  FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_ROW))
122
123
  FXSlider.new(matrix, @floatTarget, FXDataTarget::ID_VALUE,
123
- LAYOUT_CENTER_Y|LAYOUT_FILL_X|LAYOUT_FILL_ROW|LAYOUT_FIX_WIDTH, 0, 0, 100)
124
+ LAYOUT_CENTER_Y|LAYOUT_FILL_X|LAYOUT_FILL_ROW|LAYOUT_FIX_WIDTH, :width => 100)
124
125
  FXDial.new(matrix, @floatTarget, FXDataTarget::ID_VALUE,
125
126
  (LAYOUT_CENTER_Y|LAYOUT_FILL_X|LAYOUT_FILL_ROW|LAYOUT_FIX_WIDTH|
126
- DIAL_HORIZONTAL|DIAL_HAS_NOTCH), 0, 0, 100)
127
+ DIAL_HORIZONTAL|DIAL_HAS_NOTCH), :width => 100)
127
128
 
128
129
  FXFrame.new(matrix, LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW)
129
130
  FXFrame.new(matrix, LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW)
@@ -163,9 +164,9 @@ class DataTargetWindow < FXMainWindow
163
164
  FXLabel.new(matrix, "&Color", nil,
164
165
  LAYOUT_CENTER_Y|LAYOUT_CENTER_X|JUSTIFY_RIGHT|LAYOUT_FILL_ROW)
165
166
  FXColorWell.new(matrix, 0, @colorTarget, FXDataTarget::ID_VALUE,
166
- LAYOUT_CENTER_Y|LAYOUT_FILL_X|LAYOUT_FILL_ROW, 0, 0, 0, 0, 0, 0, 0, 0)
167
+ LAYOUT_CENTER_Y|LAYOUT_FILL_X|LAYOUT_FILL_ROW, :padLeft => 0, :padRight => 0, :padTop => 0, :padBottom => 0)
167
168
  FXColorWell.new(matrix, 0, @colorTarget, FXDataTarget::ID_VALUE,
168
- LAYOUT_CENTER_Y|LAYOUT_FILL_X|LAYOUT_FILL_ROW, 0, 0, 0, 0, 0, 0, 0, 0)
169
+ LAYOUT_CENTER_Y|LAYOUT_FILL_X|LAYOUT_FILL_ROW, :padLeft => 0, :padRight => 0, :padTop => 0, :padBottom => 0)
169
170
  FXFrame.new(matrix, LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW)
170
171
  FXFrame.new(matrix, LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW)
171
172
  FXFrame.new(matrix, LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW)
data/examples/dctest.rb CHANGED
@@ -107,7 +107,7 @@ $stipples = {
107
107
  class DCTestWindow < FXMainWindow
108
108
  def initialize(app)
109
109
  # Initialize base class first
110
- super(app, "Device Context Test", nil, nil, DECOR_ALL, 0, 0, 850, 740)
110
+ super(app, "Device Context Test", :opts => DECOR_ALL, :width => 850, :height => 740)
111
111
 
112
112
  opts = FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y
113
113
 
@@ -133,15 +133,12 @@ class DCTestWindow < FXMainWindow
133
133
 
134
134
  # Block for BLIT modes
135
135
  FXLabel.new(controls, "BLIT Function:", nil, LAYOUT_LEFT)
136
- blitgrid = FXMatrix.new(controls, 4, FRAME_RIDGE|MATRIX_BY_COLUMNS|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH)
137
- blitgrid.padLeft = 2
138
- blitgrid.padRight = 2
139
- blitgrid.padTop = 2
140
- blitgrid.padBottom = 2
136
+ blitgrid = FXMatrix.new(controls, 4, FRAME_RIDGE|MATRIX_BY_COLUMNS|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH,
137
+ :padLeft => 2, :padRight => 2, :padTop => 2, :padBottom => 2)
141
138
 
142
139
  # One button for each mode
143
140
  $blit_modes.each do |blit_mode, desc|
144
- btn = FXButton.new(blitgrid, desc, nil, nil, 0, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN)
141
+ btn = FXButton.new(blitgrid, desc, :opts => BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN)
145
142
  btn.userData = blit_mode
146
143
  btn.connect(SEL_COMMAND) do |sender, sel, ptr|
147
144
  @function = sender.userData
@@ -158,12 +155,9 @@ class DCTestWindow < FXMainWindow
158
155
 
159
156
  # Line dash style
160
157
  FXLabel.new(controls, "Line Style:", nil, LAYOUT_LEFT)
161
- linestyle = FXMatrix.new(controls, 3, FRAME_RIDGE|MATRIX_BY_COLUMNS|LAYOUT_FILL_X)
162
- linestyle.padLeft = 2
163
- linestyle.padRight = 2
164
- linestyle.padTop = 2
165
- linestyle.padBottom = 2
166
- lineSolidBtn = FXButton.new(linestyle, "\tLINE_SOLID", loadIcon("solid_line.png", 0, IMAGE_OPAQUE), nil, 0, BUTTON_TOOLBAR|JUSTIFY_CENTER_X|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN)
158
+ linestyle = FXMatrix.new(controls, 3, FRAME_RIDGE|MATRIX_BY_COLUMNS|LAYOUT_FILL_X,
159
+ :padLeft => 2, :padRight => 2, :padTop => 2, :padBottom => 2)
160
+ lineSolidBtn = FXButton.new(linestyle, "\tLINE_SOLID", loadIcon("solid_line.png", 0, IMAGE_OPAQUE), :opts => BUTTON_TOOLBAR|JUSTIFY_CENTER_X|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_FILL_COLUMN)
167
161
  lineSolidBtn.connect(SEL_COMMAND) do |sender, sel, ptr|
168
162
  @lineStyle = LINE_SOLID
169
163
  @linesCanvas.update(0, 0, @linesCanvas.width, @linesCanvas.height)
data/examples/dialog.rb CHANGED
@@ -1,11 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'fox16'
4
+ require 'fox16/kwargs'
4
5
 
5
6
  include Fox
6
7
 
7
8
  # A little dialog box to use in our tests
8
9
  class FXTestDialog < FXDialogBox
10
+
9
11
  def initialize(owner)
10
12
  # Invoke base class initialize function first
11
13
  super(owner, "Test of Dialog Box", DECOR_TITLE|DECOR_BORDER)
@@ -13,7 +15,7 @@ class FXTestDialog < FXDialogBox
13
15
  # Bottom buttons
14
16
  buttons = FXHorizontalFrame.new(self,
15
17
  LAYOUT_SIDE_BOTTOM|FRAME_NONE|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH,
16
- 0, 0, 0, 0, 40, 40, 20, 20)
18
+ :padLeft => 40, :padRight => 40, :padTop => 20, :padBottom => 20)
17
19
 
18
20
  # Separator
19
21
  FXHorizontalSeparator.new(self,
@@ -37,16 +39,9 @@ class FXTestDialog < FXDialogBox
37
39
 
38
40
  # Popup menu
39
41
  pane = FXPopup.new(self)
40
- FXOption.new(pane, "One", nil, nil, 0, JUSTIFY_HZ_APART|ICON_AFTER_TEXT)
41
- FXOption.new(pane, "Two", nil, nil, 0, JUSTIFY_HZ_APART|ICON_AFTER_TEXT)
42
- FXOption.new(pane, "Three", nil, nil, 0, JUSTIFY_HZ_APART|ICON_AFTER_TEXT)
43
- FXOption.new(pane, "Four", nil, nil, 0, JUSTIFY_HZ_APART|ICON_AFTER_TEXT)
44
- FXOption.new(pane, "Five", nil, nil, 0, JUSTIFY_HZ_APART|ICON_AFTER_TEXT)
45
- FXOption.new(pane, "Six", nil, nil, 0, JUSTIFY_HZ_APART|ICON_AFTER_TEXT)
46
- FXOption.new(pane, "Seven", nil, nil, 0, JUSTIFY_HZ_APART|ICON_AFTER_TEXT)
47
- FXOption.new(pane, "Eight", nil, nil, 0, JUSTIFY_HZ_APART|ICON_AFTER_TEXT)
48
- FXOption.new(pane, "Nine", nil, nil, 0, JUSTIFY_HZ_APART|ICON_AFTER_TEXT)
49
- FXOption.new(pane, "Ten", nil, nil, 0, JUSTIFY_HZ_APART|ICON_AFTER_TEXT)
42
+ %w{One Two Three Four Five Six Seven Eight Nine Ten}.each do |s|
43
+ FXOption.new(pane, s, :opts => JUSTIFY_HZ_APART|ICON_AFTER_TEXT)
44
+ end
50
45
 
51
46
  # Option menu
52
47
  FXOptionMenu.new(contents, pane, (FRAME_RAISED|FRAME_THICK|
@@ -68,6 +63,7 @@ class FXTestDialog < FXDialogBox
68
63
  accept.setDefault
69
64
  accept.setFocus
70
65
  end
66
+
71
67
  end
72
68
 
73
69
  # Subclassed main window
@@ -75,7 +71,7 @@ class DialogTester < FXMainWindow
75
71
 
76
72
  def initialize(app)
77
73
  # Invoke base class initialize first
78
- super(app, "Dialog Test", nil, nil, DECOR_ALL, 0, 0, 400, 200)
74
+ super(app, "Dialog Test", :opts => DECOR_ALL, :width => 400, :height => 200)
79
75
 
80
76
  # Tooltip
81
77
  FXToolTip.new(getApp())
@@ -98,14 +94,14 @@ class DialogTester < FXMainWindow
98
94
 
99
95
  # Button to pop normal dialog
100
96
  nonModalButton = FXButton.new(contents,
101
- "&Non-Modal Dialog...\tDisplay normal dialog", nil, nil, 0,
102
- FRAME_RAISED|FRAME_THICK|LAYOUT_CENTER_X|LAYOUT_CENTER_Y)
97
+ "&Non-Modal Dialog...\tDisplay normal dialog",
98
+ :opts => FRAME_RAISED|FRAME_THICK|LAYOUT_CENTER_X|LAYOUT_CENTER_Y)
103
99
  nonModalButton.connect(SEL_COMMAND, method(:onCmdShowDialog))
104
100
 
105
101
  # Button to pop modal dialog
106
102
  modalButton = FXButton.new(contents,
107
- "&Modal Dialog...\tDisplay modal dialog", nil, nil, 0,
108
- FRAME_RAISED|FRAME_THICK|LAYOUT_CENTER_X|LAYOUT_CENTER_Y)
103
+ "&Modal Dialog...\tDisplay modal dialog",
104
+ :opts => FRAME_RAISED|FRAME_THICK|LAYOUT_CENTER_X|LAYOUT_CENTER_Y)
109
105
  modalButton.connect(SEL_COMMAND, method(:onCmdShowDialogModal))
110
106
 
111
107
  # Build a dialog box
data/examples/dilbert.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'fox16'
4
+ require 'fox16/kwargs'
4
5
  require 'open-uri'
5
6
  begin
6
7
  require 'rubyful_soup'
@@ -22,16 +23,15 @@ class DailyDilbert < FXMainWindow
22
23
 
23
24
  def initialize(app)
24
25
  # Invoke base class initialize first
25
- super(app, "Daily Dilbert Viewer", nil, nil, DECOR_ALL,
26
- 0, 0, 850, 600, 0, 0)
26
+ super(app, "Daily Dilbert Viewer", :opts => DECOR_ALL, :width => 850, :height => 600, :padLeft => 0, :padRight => 0)
27
27
 
28
28
  # Sunken border for image widget
29
29
  imagebox = FXHorizontalFrame.new(self,
30
30
  FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y)
31
31
 
32
32
  # Make image widget
33
- @imageview = FXImageView.new(imagebox, nil, nil, 0,
34
- LAYOUT_FILL_X|LAYOUT_FILL_Y|HSCROLLER_NEVER|VSCROLLER_NEVER)
33
+ @imageview = FXImageView.new(imagebox,
34
+ :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|HSCROLLER_NEVER|VSCROLLER_NEVER)
35
35
 
36
36
  # Construct a GIF image and store it in the image viewer
37
37
  @imageview.image = FXGIFImage.new(getApp(), image_data)
data/examples/dirlist.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 @@ class DirListWindow < FXMainWindow
8
9
 
9
10
  def initialize(app)
10
11
  # Invoke the base class initialize first
11
- super(app, "Directory List", nil, nil, DECOR_ALL, 0, 0, 800, 600)
12
+ super(app, "Directory List", :opts => DECOR_ALL, :width => 800, :height => 600)
12
13
 
13
14
  # Make menu bar
14
15
  menubar = FXMenuBar.new(self, LAYOUT_FILL_X)
@@ -24,13 +25,13 @@ class DirListWindow < FXMainWindow
24
25
  FXMenuTitle.new(menubar, "&Help", nil, helpmenu, LAYOUT_RIGHT)
25
26
 
26
27
  # Text field at bottom
27
- text = FXTextField.new(self, 10, nil, 0,
28
- LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|FRAME_SUNKEN|FRAME_THICK)
28
+ text = FXTextField.new(self, 10,
29
+ :opts => LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|FRAME_SUNKEN|FRAME_THICK)
29
30
 
30
31
  # Make contents
31
- dirlist = FXDirList.new(self, nil, 0, (HSCROLLING_OFF|
32
+ dirlist = FXDirList.new(self, :opts => (HSCROLLING_OFF|
32
33
  TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|FRAME_SUNKEN|FRAME_THICK|
33
- LAYOUT_FILL_X|LAYOUT_FILL_Y), 0, 0, 0, 0)
34
+ LAYOUT_FILL_X|LAYOUT_FILL_Y))
34
35
 
35
36
  # Now make the directory list widget (dirlist) the message target
36
37
  # for the text field. If you type a new directory name in the text