fxruby 1.4.1 → 1.4.2

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.
@@ -23,18 +23,36 @@ module Fox
23
23
  warn "addItemFirst() is deprecated; use prependItem() instead"
24
24
  prependItem(*args)
25
25
  end
26
+
26
27
  def addItemLast(*args) # :nodoc:
27
28
  warn "addItemLast() is deprecated; use appendItem() instead"
28
29
  appendItem(*args)
29
30
  end
31
+
30
32
  def addItemAfter(other, *args) # :nodoc:
31
33
  warn "addItemAfter() is deprecated; use insertItem() instead"
32
34
  insertItem(other.next, other.parent, *args)
33
35
  end
36
+
34
37
  def addItemBefore(other, *args) # :nodoc:
35
38
  warn "addItemBefore() is deprecated; use insertItem() instead"
36
39
  insertItem(other, other.parent, *args)
37
40
  end
41
+
42
+ def reparentItem(item, father) # :nodoc:
43
+ warn "reparentItem() is deprecated; use moveItem() instead"
44
+ moveItem(nil, father, item)
45
+ end
46
+
47
+ def moveItemBefore(other, item) # :nodoc:
48
+ warn "moveItemBefore() is deprecated; use moveItem() instead"
49
+ moveItem(other, other.parent, item)
50
+ end
51
+
52
+ def moveItemAfter(other, item) # :nodoc:
53
+ warn "moveItemAfter() is deprecated; use moveItem() instead"
54
+ moveItem(other.next, other.parent, item)
55
+ end
38
56
  end
39
57
 
40
58
  class FXTreeListBox
@@ -323,6 +341,74 @@ module Fox
323
341
  # General failure
324
342
  class FXStreamFailureError < FXStreamError ; end
325
343
 
344
+ class FXCheckButton
345
+ # Return +true+ if this check button is in the checked state.
346
+ def checked?
347
+ self.checkState == TRUE
348
+ end
349
+
350
+ # Return +true+ if this check button is in the unchecked state.
351
+ def unchecked?
352
+ self.checkState == FALSE
353
+ end
354
+
355
+ # Return +true+ if this check button is in the indeterminate, or "maybe", state.
356
+ def maybe?
357
+ self.checkState == MAYBE
358
+ end
359
+ end
360
+
361
+ class FXMenuCheck
362
+ # Return +true+ if this menu check button is in the checked state.
363
+ def checked?
364
+ self.checkState == TRUE
365
+ end
366
+
367
+ # Return +true+ if this menu check button is in the unchecked state.
368
+ def unchecked?
369
+ self.checkState == FALSE
370
+ end
371
+
372
+ # Return +true+ if this menu check button is in the indeterminate, or "maybe", state.
373
+ def maybe?
374
+ self.checkState == MAYBE
375
+ end
376
+ end
377
+
378
+ class FXRadioButton
379
+ # Return +true+ if this radio button is in the checked state.
380
+ def checked?
381
+ self.checkState == TRUE
382
+ end
383
+
384
+ # Return +true+ if this radio button is in the unchecked state.
385
+ def unchecked?
386
+ self.checkState == FALSE
387
+ end
388
+
389
+ # Return +true+ if this radio button is in the indeterminate, or "maybe", state.
390
+ def maybe?
391
+ self.checkState == MAYBE
392
+ end
393
+ end
394
+
395
+ class FXMenuRadio
396
+ # Return +true+ if this menu radio button is in the checked state.
397
+ def checked?
398
+ self.checkState == TRUE
399
+ end
400
+
401
+ # Return +true+ if this menu radio button is in the unchecked state.
402
+ def unchecked?
403
+ self.checkState == FALSE
404
+ end
405
+
406
+ # Return +true+ if this menu radio button is in the indeterminate, or "maybe", state.
407
+ def maybe?
408
+ self.checkState == MAYBE
409
+ end
410
+ end
411
+
326
412
  class FXDC
327
413
  #
328
414
  # Draw a circle centered at (_x_, _y_), with specified radius.
@@ -5,7 +5,7 @@ module Fox
5
5
  # Returns the FXRuby version number as a string, e.g. "1.0.19".
6
6
  #
7
7
  def Fox.fxrubyversion
8
- "1.4.1"
8
+ "1.4.2"
9
9
  end
10
10
  end
11
11
 
@@ -47,20 +47,5 @@ module Fox
47
47
  # Construct new check button
48
48
  def initialize(parent, text, target=nil, selector=0, opts=CHECKBUTTON_NORMAL, x=0, y=0, width=0, height=0, padLeft=DEFAULT_PAD, padRight=DEFAULT_PAD, padTop=DEFAULT_PAD, padBottom=DEFAULT_PAD) # :yields: theCheckButton
49
49
  end
50
-
51
- # Return +true+ if the check button state is +TRUE+
52
- def checked?
53
- self.check == TRUE
54
- end
55
-
56
- # Return +true+ if the check button state is +FALSE+
57
- def unchecked?
58
- self.check == FALSE
59
- end
60
-
61
- # Return +true+ if the check button state is +MAYBE+
62
- def maybe?
63
- self.check == MAYBE
64
- end
65
50
  end
66
51
  end
@@ -193,7 +193,7 @@ module Fox
193
193
  attr_reader :clipHeight
194
194
 
195
195
  # Font to draw text with [FXFont]
196
- attr_accessor :textFont
196
+ attr_accessor :font
197
197
 
198
198
  # Construct dummy DC
199
199
  def initialize(app) ; end
@@ -4,28 +4,28 @@ module Fox
4
4
  # Dock site widgets are typically embedded inside the main window, placed
5
5
  # against those sides where docking of toolbars is to be allowed.
6
6
  # Dock bars placed inside a dock site are laid out in horizontal or vertical bands
7
- # called galleys. A toolbar with the LAYOUT_DOCK_SAME hint is preferentially placed
8
- # on the same galley as its previous sibling. A dock bar with the LAYOUT_DOCK_NEXT is
7
+ # called _galleys_. A toolbar with the +LAYOUT_DOCK_SAME+ hint is preferentially placed
8
+ # on the same galley as its previous sibling. A dock bar with the +LAYOUT_DOCK_NEXT+ is
9
9
  # always placed on the next galley.
10
- # Each galley will have at least one dock bar shown in it. Several dock bars
10
+ # Each galley will have at least one dock bar shown in it. Several dock bars
11
11
  # may be placed side-by-side inside one galley, unless there is insufficient
12
- # room. If there is insufficient room to place another dock bar, that dock bar
13
- # will be moved to the next galley, even though its LAYOUT_DOCK_NEXT option
14
- # is not set. This implies that when the main window is resized and more room
12
+ # room. If there is insufficient room to place another dock bar, that dock bar
13
+ # will be moved to the next galley, even though its +LAYOUT_DOCK_NEXT+ option
14
+ # is not set. This implies that when the main window is resized, and more room
15
15
  # becomes available, it will jump back to its preferred galley.
16
16
  # Within a galley, dock bars will be placed from left to right, at the given
17
17
  # x and y coordinates, with the constraints that the dock bar will stay within
18
- # the galley, and do not overlap each other. It is possible to use LAYOUT_FILL_X
19
- # and/or LAYOUT_FILL_Y to stretch a toolbar to the available space on its galley.
18
+ # the galley, and do not overlap each other. It is possible to use +LAYOUT_FILL_X+
19
+ # and/or +LAYOUT_FILL_Y+ to stretch a toolbar to the available space on its galley.
20
20
  # The galleys are oriented horizontally if the dock site is placed inside
21
- # a top level window using LAYOUT_SIDE_TOP or LAYOUT_SIDE_BOTTOM, and
22
- # vertically oriented if placed with LAYOUT_SIDE_LEFT or LAYOUT_SIDE_RIGHT.
21
+ # a top level window using +LAYOUT_SIDE_TOP+ or +LAYOUT_SIDE_BOTTOM+, and
22
+ # vertically oriented if placed with +LAYOUT_SIDE_LEFT+ or +LAYOUT_SIDE_RIGHT+.
23
23
  #
24
24
  class FXDockSite < FXPacker
25
25
  #
26
- # Construct a toolbar dock layout manager. Passing LAYOUT_SIDE_TOP or LAYOUT_SIDE_BOTTOM
27
- # causes the toolbar dock to be oriented horizontally. Passing LAYOUT_SIDE_LEFT or
28
- # LAYOUT_SIDE_RIGHT causes it to be oriented vertically.
26
+ # Construct a toolbar dock layout manager. Passing +LAYOUT_SIDE_TOP+ or +LAYOUT_SIDE_BOTTOM+
27
+ # causes the toolbar dock to be oriented horizontally. Passing +LAYOUT_SIDE_LEFT+ or
28
+ # +LAYOUT_SIDE_RIGHT+ causes it to be oriented vertically.
29
29
  #
30
30
  def initialize(p, opts=0, x=0, y=0, w=0, h=0, pl=0, pr=0, pt=0, pb=0, hs=0, vs=0) # :yields: theDockSite
31
31
  end
@@ -311,7 +311,14 @@ module Fox
311
311
  def fontMono? ; end
312
312
 
313
313
  #
314
- # Return +true+ if font has glyph for _ch_.
314
+ # Return +true+ if font has glyph for _ch_. Here, _ch_ can either be an
315
+ # ordinal value, e.g.
316
+ #
317
+ # aFont.hasChar?(?a)
318
+ #
319
+ # or a string of length one (i.e. a single character), e.g.
320
+ #
321
+ # aFont.hasChar?('a')
315
322
  #
316
323
  def hasChar?(ch) ; end
317
324
 
@@ -23,8 +23,6 @@ module Fox
23
23
  # Dither image to look better
24
24
  # +IMAGE_NEAREST+::
25
25
  # Turn off dithering and map to nearest color
26
- # +IMAGE_ALPHA+::
27
- # Data has alpha channel
28
26
  # +IMAGE_OPAQUE+::
29
27
  # Force opaque background
30
28
  # +IMAGE_ALPHACOLOR+::
@@ -44,11 +44,11 @@ module Fox
44
44
  # Scroll style [Integer]
45
45
  attr_accessor :scrollStyle
46
46
 
47
- # Horizontal scrollbar [FXScrollbar]
48
- attr_reader :horizontalScrollbar
47
+ # Horizontal scrollbar [FXScrollBar]
48
+ attr_reader :horizontalScrollBar
49
49
 
50
- # Vertical scrollbar [FXScrollbar]
51
- attr_reader :verticalScrollbar
50
+ # Vertical scrollbar [FXScrollBar]
51
+ attr_reader :verticalScrollBar
52
52
 
53
53
  # Current x-position [Integer]
54
54
  attr_reader :xPosition
@@ -1,6 +1,24 @@
1
1
  module Fox
2
2
  #
3
- # Persistent store definition
3
+ # A stream is a way to serialize data and objects into a byte stream.
4
+ # Each item of data that is saved or loaded from the stream may be byte-swapped,
5
+ # thus allowing little-endian machines to read data produced on big endian ones
6
+ # and vice-versa.
7
+ # Data is serialized exactly as-is. There are no tags or other markers
8
+ # inserted into the stream; thus, the stream may be used to save or load arbitrary
9
+ # binary data.
10
+ # Objects derived from FXObjects may be serialized also; whenever a reference to an
11
+ # object is serialized, a table is consulted to determine if the same object has
12
+ # been encountered previously; if not, the object is added to the table and then
13
+ # its contents are serialized. If the object has been encountered before, only a
14
+ # reference to the object is serialized.
15
+ # When loading back a serialized object, new instances are constructed using
16
+ # the default constructor, and subsequently the object's contents are loaded.
17
+ # A special container object may be passed in which is placed in the table
18
+ # as if it had been encountered before; this will cause only references to this
19
+ # object to be saved. The container object is typically the top-level document
20
+ # object which manages all objects contained by it. Additional objects may be
21
+ # added using addObject(); these will not be actually saved or loaded.
4
22
  #
5
23
  # === Stream status codes
6
24
  #
@@ -256,18 +256,6 @@ module Fox
256
256
  # Table style [Integer]
257
257
  attr_accessor :tableStyle
258
258
 
259
- # Number of leading rows [Integer]
260
- attr_accessor :leadingRows
261
-
262
- # Number of trailing rows [Integer]
263
- attr_accessor :trailingRows
264
-
265
- # Number of leading columns [Integer]
266
- attr_accessor :leadingCols
267
-
268
- # Number of trailing columns [Integer]
269
- attr_accessor :trailingCols
270
-
271
259
  # The column header height mode is either fixed (LAYOUT_FIX_HEIGHT) or variable.
272
260
  # In variable height mode, the column header will size to fit the contents in it.
273
261
  # In fixed height mode, the size is explicitly set via the _columnHeaderHeight_
@@ -18,6 +18,8 @@ module Fox
18
18
  # +DECOR_MAXIMIZE+:: Maximize button
19
19
  # +DECOR_CLOSE+:: Close button
20
20
  # +DECOR_BORDER+:: Border
21
+ # +DECOR_SHRINKABLE+:: Window can become smaller
22
+ # +DECOR_STRETCHABLE+:: Window can become larger
21
23
  # +DECOR_RESIZE+:: Resize handles
22
24
  # +DECOR_MENU+:: Window menu
23
25
  # +DECOR_ALL+:: All of the above
@@ -33,9 +35,12 @@ module Fox
33
35
  #
34
36
  # === Message identifiers
35
37
  #
36
- # +ID_ICONIFY+:: Iconify the window
37
- # +ID_DEICONIFY+:: Deiconify the window
38
- # +ID_QUERY_DOCK+:: Toolbar asks to dock
38
+ # +ID_MAXIMIZE+:: Maximize the window
39
+ # +ID_MINIMIZE+:: Minimize the window
40
+ # +ID_RESTORE+:: Restore the window
41
+ # +ID_CLOSE+:: Close the window
42
+ # +ID_QUERY_DOCK+:: Toolbar asks to dock
43
+ #
39
44
 
40
45
  class FXTopWindow < FXShell
41
46
 
@@ -83,14 +88,34 @@ module Fox
83
88
  # Obtain border sizes added to our window by the window manager.
84
89
  # Returns a 4-element array containing the left, right, top and bottom border sizes (in pixels).
85
90
  def getWMBorders(); end
86
-
87
- # Iconify window
88
- def iconify() ; end
89
-
90
- # Deiconify window
91
- def deiconify() ; end
92
-
93
- # Return +true+ if window has been iconified
94
- def iconified?() ; end
91
+
92
+ # Return +true+ if window is maximized.
93
+ def maximized? ; end
94
+
95
+ # Return +true+ if window is minimized.
96
+ def minimized? ; end
97
+
98
+ #
99
+ # Maximize window and return +true+ if maximized.
100
+ # If _notify_ is +true+, sends a +SEL_MAXIMIZE+ message to its message target.
101
+ #
102
+ def maximize(notify=false); end
103
+
104
+ #
105
+ # Minimize or iconify window and return +true+ if minimized.
106
+ # If _notify_ is +true+, sends a +SEL_MINIMIZE+ message to its message target.
107
+ #
108
+ def minimize(notify=false); end
109
+
110
+ #
111
+ # Restore window to normal and return +true+ if restored.
112
+ # If _notify_ is +true+, sends a +SEL_RESTORE+ message to its message target.
113
+ #
114
+ def restore(notify=false); end
115
+
116
+ #
117
+ # Close window and return +true+ if actually closed.
118
+ #
119
+ def close(notify=false); end
95
120
  end
96
121
  end
@@ -259,7 +259,6 @@ module Fox
259
259
  # ==== Parameters:
260
260
  #
261
261
  # +p+:: the parent window for this tree list [FXComposite]
262
- # +nvis+:: number of visible items [Integer]
263
262
  # +tgt+:: the message target, if any, for this tree list [FXObject]
264
263
  # +sel+:: the message identifier for this tree list [Integer]
265
264
  # +opts+:: tree list options [Integer]
@@ -268,7 +267,7 @@ module Fox
268
267
  # +w+:: initial width [Integer]
269
268
  # +h+:: initial height [Integer]
270
269
  #
271
- def initialize(p, nvis, tgt=nil, sel=0, opts=TREELIST_NORMAL, x=0, y=0, w=0, h=0) # :yields: theTreeList
270
+ def initialize(p, tgt=nil, sel=0, opts=TREELIST_NORMAL, x=0, y=0, w=0, h=0) # :yields: theTreeList
272
271
  end
273
272
 
274
273
  #
@@ -475,9 +474,6 @@ module Fox
475
474
  # message target after the sub-tree is expanded.
476
475
  def expandTree(tree, notify=false); end
477
476
 
478
- # Reparent _item_ under _parentItem_.
479
- def reparentItem(item, parentItem); end
480
-
481
477
  #
482
478
  # Change current item. If there is already a current item, that item
483
479
  # is first closed. After _item_ is set as the tree list's current item,
@@ -56,4 +56,14 @@ class TC_FXFont < Test::Unit::TestCase
56
56
  assert_instance_of(Array, fonts)
57
57
  assert(fonts.length > 0)
58
58
  end
59
+
60
+ def test_hasChar?
61
+ @app.normalFont.create
62
+ assert(@app.normalFont.hasChar('a'))
63
+ assert(@app.normalFont.hasChar(?a))
64
+ assert(@app.normalFont.hasChar?('a'))
65
+ assert(@app.normalFont.hasChar?(?a))
66
+ assert_raises(ArgumentError) { @app.normalFont.hasChar? "" }
67
+ assert_raises(ArgumentError) { @app.normalFont.hasChar? "ab" }
68
+ end
59
69
  end
@@ -0,0 +1,57 @@
1
+ require 'test/unit'
2
+ require 'testcase'
3
+ require 'fox14'
4
+
5
+ include Fox
6
+
7
+ class TC_FXMenuCheck < TestCase
8
+ def setup
9
+ super(self.class.name)
10
+ @menuCheck = FXMenuCheck.new(mainWindow, "menuCheck")
11
+ end
12
+
13
+ def test_setCheck_TRUE
14
+ @menuCheck.check = Fox::TRUE
15
+ assert_equal(true, @menuCheck.check)
16
+ assert_equal(Fox::TRUE, @menuCheck.checkState)
17
+ assert(@menuCheck.checked?)
18
+ assert(!@menuCheck.unchecked?)
19
+ assert(!@menuCheck.maybe?)
20
+ end
21
+
22
+ def test_setCheck_FALSE
23
+ @menuCheck.check = Fox::FALSE
24
+ assert_equal(false, @menuCheck.check)
25
+ assert_equal(Fox::FALSE, @menuCheck.checkState)
26
+ assert(!@menuCheck.checked?)
27
+ assert(@menuCheck.unchecked?)
28
+ assert(!@menuCheck.maybe?)
29
+ end
30
+
31
+ def test_setCheck_MAYBE
32
+ @menuCheck.check = Fox::MAYBE
33
+ assert_equal(true, @menuCheck.check) # this is not a typo!
34
+ assert_equal(Fox::MAYBE, @menuCheck.checkState)
35
+ assert(!@menuCheck.checked?)
36
+ assert(!@menuCheck.unchecked?)
37
+ assert(@menuCheck.maybe?)
38
+ end
39
+
40
+ def test_setCheck_true
41
+ @menuCheck.check = true
42
+ assert_equal(true, @menuCheck.check)
43
+ assert_equal(Fox::TRUE, @menuCheck.checkState)
44
+ assert(@menuCheck.checked?)
45
+ assert(!@menuCheck.unchecked?)
46
+ assert(!@menuCheck.maybe?)
47
+ end
48
+
49
+ def test_setCheck_false
50
+ @menuCheck.check = false
51
+ assert_equal(false, @menuCheck.check)
52
+ assert_equal(Fox::FALSE, @menuCheck.checkState)
53
+ assert(!@menuCheck.checked?)
54
+ assert(@menuCheck.unchecked?)
55
+ assert(!@menuCheck.maybe?)
56
+ end
57
+ end