wxruby3 0.9.0.pre.beta.9 → 0.9.0.pre.beta.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/ext/wxruby3/include/wxruby-ScaledDC.h +549 -0
  3. data/ext/wxruby3/swig/mark_free_impl.i +0 -34
  4. data/ext/wxruby3/swig/wx.i +1 -1
  5. data/lib/wx/core/bitmap.rb +7 -0
  6. data/lib/wx/core/choice.rb +3 -0
  7. data/lib/wx/core/combobox.rb +3 -0
  8. data/lib/wx/core/controlwithitems.rb +98 -2
  9. data/lib/wx/core/data_object.rb +74 -6
  10. data/lib/wx/core/icon.rb +7 -1
  11. data/lib/wx/core/imagelist.rb +11 -0
  12. data/lib/wx/core/listbox.rb +3 -0
  13. data/lib/wx/core/point.rb +21 -10
  14. data/lib/wx/core/real_point.rb +21 -10
  15. data/lib/wx/core/rect.rb +2 -2
  16. data/lib/wx/core/size.rb +12 -5
  17. data/lib/wx/doc/data_object.rb +104 -0
  18. data/lib/wx/doc/gdi_common.rb +33 -5
  19. data/lib/wx/doc/progress_dialog.rb +37 -0
  20. data/lib/wx/doc/scaled_dc.rb +16 -0
  21. data/lib/wx/global_const.rb +4 -3
  22. data/lib/wx/version.rb +1 -1
  23. data/rakelib/lib/config/mingw.rb +3 -0
  24. data/rakelib/lib/core/include/init.inc +2 -2
  25. data/rakelib/lib/core/package.rb +3 -3
  26. data/rakelib/lib/core/spec.rb +2 -0
  27. data/rakelib/lib/director/ctrl_with_items.rb +29 -17
  28. data/rakelib/lib/director/data_object.rb +94 -0
  29. data/rakelib/lib/director/data_object_simple_base.rb +123 -0
  30. data/rakelib/lib/director/derived_dc.rb +38 -0
  31. data/rakelib/lib/director/dialog.rb +29 -54
  32. data/rakelib/lib/director/image_list.rb +3 -1
  33. data/rakelib/lib/director/preview_frame.rb +41 -0
  34. data/rakelib/lib/director/print_data.rb +5 -7
  35. data/rakelib/lib/specs/interfaces.rb +2 -0
  36. data/rakelib/lib/typemap/data_object_data.rb +13 -4
  37. data/samples/dialogs/dialogs.rb +70 -50
  38. data/samples/drawing/maths_images.rb +1 -1
  39. data/samples/sampler/ext.rb +3 -3
  40. data/samples/sampler/stc_editor.rb +19 -19
  41. data/samples/sampler/txt_editor.rb +2 -2
  42. data/samples/treectrl/treectrl.rb +32 -30
  43. data/tests/lib/wxapp_runner.rb +64 -0
  44. data/tests/test_basic.rb +0 -5
  45. data/tests/test_clipboard.rb +114 -17
  46. data/tests/test_dialog.rb +2 -13
  47. data/tests/test_event_handling.rb +2 -13
  48. data/tests/test_events.rb +2 -6
  49. data/tests/test_geometry.rb +54 -17
  50. data/tests/test_intl.rb +2 -15
  51. data/tests/test_item_data.rb +69 -15
  52. data/tests/test_variant.rb +1 -15
  53. data/tests/testapp.rb +0 -5
  54. data/tests/testapp_noframe.rb +0 -5
  55. metadata +8 -2
@@ -1,10 +1,106 @@
1
1
  # Superclass of a variety of controls that display lists of items (eg
2
2
  # Choice, ListBox, CheckListBox)
3
3
  class Wx::ControlWithItems
4
- # Make these ruby enumerables so find, find_all, map etc are available
4
+
5
+ # Make these Ruby enumerables so find, find_all, map etc are available
5
6
  include Enumerable
7
+
6
8
  # Passes each valid item index into the passed block
7
9
  def each
8
- 0.upto(get_count - 1) { | i | yield i }
10
+ get_count.times { | i | yield i }
11
+ end
12
+
13
+ # We need to cache client data in Ruby variables as we cannot access items
14
+ # during the GC mark phase as for some platforms (WXMSW at least) that would
15
+ # involve calling methods that would break in that phase.
16
+
17
+ def client_data_store
18
+ @client_data ||= []
19
+ end
20
+ private :client_data_store
21
+
22
+ wx_set_client_data = instance_method :set_client_data
23
+ define_method :set_client_data do |item, data|
24
+ item = item.to_i
25
+ wx_set_client_data.bind(self).call(item, data)
26
+ client_data_store[item] = data
27
+ end
28
+
29
+ def get_client_data(item)
30
+ client_data_store[item.to_i]
31
+ end
32
+
33
+ wx_append = instance_method :append
34
+ define_method :append do |item, data=nil|
35
+ if data
36
+ if ::Array === item
37
+ if !(::Array === data)
38
+ ::Kernel.raise ::TypeError.new("Expected Array for argument 3")
39
+ elsif data.size != item.size
40
+ ::Kernel.raise ::ArgumentError.new("item and data array must be equal size")
41
+ end
42
+ offs = get_count
43
+ wx_append.bind(self).call(item)
44
+ item.size.times { |ix| set_client_data(offs+ix, data[ix]) }
45
+ else
46
+ wx_append.bind(self).call(item, data)
47
+ client_data_store[get_count-1] = data
48
+ end
49
+ else
50
+ wx_append.bind(self).call(item)
51
+ # no changes to data store
52
+ end
53
+ end
54
+
55
+ wx_insert = instance_method :insert
56
+ define_method :insert do |item, pos, data=nil|
57
+ if data
58
+ if ::Array === item
59
+ if !(::Array === data)
60
+ ::Kernel.raise ::TypeError.new("Expected Array for argument 3")
61
+ elsif data.size != item.size
62
+ ::Kernel.raise ::ArgumentError.new("item and data array must be equal size")
63
+ end
64
+ wx_insert.bind(self).call(item, pos)
65
+ client_data_store.insert(pos, *::Array.new(item.size))
66
+ item.size.times { |ix| set_client_data(pos+ix, data[ix]) }
67
+ else
68
+ wx_insert.bind(self).call(item, pos, data)
69
+ client_data_store.insert(pos, data)
70
+ end
71
+ else
72
+ wx_insert.bind(self).call(item, pos)
73
+ if ::Array === item
74
+ client_data_store.insert(pos, *::Array.new(item.size))
75
+ else
76
+ client_data_store.insert(pos, nil)
77
+ end
78
+ end
79
+ end
80
+
81
+ wx_set = instance_method :set
82
+ define_method :set do |items, data=nil|
83
+ if data
84
+ if !(::Array === data)
85
+ ::Kernel.raise ::TypeError.new("Expected Array for argument 2")
86
+ elsif data.size != items.size
87
+ ::Kernel.raise ::ArgumentError.new("items and data array must be equal size")
88
+ end
89
+ end
90
+ wx_set.bind(self).call(items)
91
+ client_data_store.clear
92
+ items.each_with_index { |item, ix| set_client_data(item, data[ix]) }
93
+ end
94
+
95
+ wx_clear = instance_method :clear
96
+ define_method :clear do
97
+ wx_clear.bind(self).call
98
+ client_data_store.clear
99
+ end
100
+
101
+ wx_delete = instance_method :delete
102
+ define_method :delete do |item|
103
+ wx_delete.bind(self).call(item.to_i)
104
+ client_data_store.slice!(item.to_i)
9
105
  end
10
106
  end
@@ -1,10 +1,78 @@
1
- # Provide some default implementations of these to make life easier
2
- class Wx::DataObject
3
- def get_preferred_format(direction)
4
- get_all_formats(direction).first
1
+
2
+ module Wx
3
+
4
+ # Provide some default implementations of these to make life easier
5
+ class DataObject
6
+ def get_preferred_format(direction)
7
+ get_all_formats(direction).first
8
+ end
9
+
10
+ def get_format_count(direction)
11
+ get_all_formats(direction).size
12
+ end
5
13
  end
6
14
 
7
- def get_format_count(direction)
8
- get_all_formats(direction).size
15
+ class DataObjectSimple
16
+
17
+ # implement the overloads which do not require the format arg
18
+ # using pure Ruby
19
+
20
+ wx_get_data_size = instance_method :get_data_size
21
+ define_method :get_data_size do |format = nil|
22
+ wx_get_data_size.bind(self).call(format || self.get_format)
23
+ end
24
+
25
+ wx_get_data_here = instance_method :get_data_here
26
+ define_method :get_data_here do |format = nil|
27
+ wx_get_data_here.bind(self).call(format || self.get_format)
28
+ end
29
+
30
+ wx_set_data = instance_method :set_data
31
+ define_method :set_data do |*args|
32
+ if args.size>1
33
+ format, buf = args
34
+ else
35
+ format = nil
36
+ buf = args.first
37
+ end
38
+ wx_set_data.bind(self).call(format || self.get_format, buf)
39
+ end
40
+
9
41
  end
42
+
43
+ class DataObjectSimpleBase
44
+
45
+ # implement these in pure Ruby for optimization
46
+ def get_data_size(*)
47
+ self._get_data_size
48
+ end
49
+ def get_data_here(*)
50
+ self._get_data
51
+ end
52
+
53
+ def set_data(*args)
54
+ if args.size>1
55
+ _, buf = args
56
+ else
57
+ buf = args.first
58
+ end
59
+ self._set_data(buf)
60
+ end
61
+
62
+ def _get_data_size
63
+ (_get_data || '').bytesize
64
+ end
65
+ protected :_get_data_size
66
+
67
+ end
68
+
69
+ class TextDataObject
70
+
71
+ # override this to loose the extra terminating 0 we otherwise get
72
+ def get_data_here(*)
73
+ self.get_text
74
+ end
75
+
76
+ end
77
+
10
78
  end
data/lib/wx/core/icon.rb CHANGED
@@ -14,12 +14,18 @@ class Wx::Icon
14
14
 
15
15
  def to_bitmap
16
16
  # for WXMSW platform Icon is not derived from Bitmap
17
- return self unless Wx::PLATFORM == 'WXMSW'
17
+ return self unless Wx::PLATFORM == 'WXMSW' || Wx::PLATFORM == 'WXOSX'
18
18
  bm = Wx::Bitmap.new
19
19
  bm.copy_from_icon(self)
20
20
  bm
21
21
  end
22
22
 
23
+ if Wx::PLATFORM == 'WXMSW' || Wx::PLATFORM == 'WXOSX'
24
+ def convert_to_image
25
+ to_bitmap.convert_to_image
26
+ end
27
+ end
28
+
23
29
  # Redefine the initialize method so it raises an exception if a
24
30
  # non-existent file is given to the constructor; otherwise, wx Widgets
25
31
  # just carries on with an empty icon, which may cause faults
@@ -1,3 +1,14 @@
1
+
1
2
  class Wx::ImageList
3
+
4
+ # provide seamless support for adding icons on all platforms
5
+ wx_add = instance_method :add
6
+ define_method :add do |*args|
7
+ if Wx::Icon === args.first
8
+ args[0] = args.first.to_bitmap
9
+ end
10
+ wx_add.bind(self).call(*args)
11
+ end
12
+
2
13
  alias :<< :add
3
14
  end
@@ -1,3 +1,6 @@
1
+
2
+ require_relative './controlwithitems'
3
+
1
4
  class Wx::ListBox
2
5
  alias :get_item_data :get_client_data
3
6
  alias :set_item_data :set_client_data
data/lib/wx/core/point.rb CHANGED
@@ -1,4 +1,7 @@
1
1
  class Wx::Point
2
+
3
+ include Comparable
4
+
2
5
  # More informative output when converted to string
3
6
  def to_s
4
7
  "#<Wx::Point: (#{x}, #{y})>"
@@ -16,23 +19,26 @@ class Wx::Point
16
19
  alias :get_x :x
17
20
  alias :get_y :y
18
21
 
19
- # Compare point values
20
- def ==(other)
21
- if Wx::Point === other
22
+ # Correct comparison for Points - same if same x and y
23
+ def eql?(other)
24
+ if other.instance_of?(self.class)
22
25
  x == other.x and y == other.y
23
- elsif Array === other && other.size == 2
24
- to_ary == other
25
26
  else
26
- Kernel.raise TypeError, "Cannot compare Point to #{other}"
27
+ false
27
28
  end
28
29
  end
29
30
 
30
- # Correct comparison for Points - same if same x and y
31
- def eql?(other)
31
+ def hash
32
+ to_ary.hash
33
+ end
34
+
35
+ def <=>(other)
32
36
  if Wx::Point === other
33
- x == other.x and y == other.y
37
+ (x*y) <=> (other.x*other.y)
38
+ elsif Array === other && other.size == 2
39
+ (x*y) <=> (other.first.to_i*other.last.to_i)
34
40
  else
35
- false
41
+ nil
36
42
  end
37
43
  end
38
44
 
@@ -89,4 +95,9 @@ class Wx::Point
89
95
  end
90
96
  end
91
97
  end
98
+
99
+ def to_real_point
100
+ Wx::RealPoint.new(self.x.to_f, self.y.to_f)
101
+ end
102
+ alias :to_real :to_real_point
92
103
  end
@@ -1,4 +1,7 @@
1
1
  class Wx::RealPoint
2
+
3
+ include Comparable
4
+
2
5
  # More informative output when converted to string
3
6
  def to_s
4
7
  "#<Wx::RealPoint: (#{x}, #{y})>"
@@ -16,23 +19,26 @@ class Wx::RealPoint
16
19
  alias :get_x :x
17
20
  alias :get_y :y
18
21
 
19
- # Compare point values
20
- def ==(other)
21
- if Wx::RealPoint === other
22
+ # Correct comparison for RealPoints - same if same x and y
23
+ def eql?(other)
24
+ if other.instance_of?(self.class)
22
25
  x == other.x and y == other.y
23
- elsif Array === other && other.size == 2
24
- to_ary == other
25
26
  else
26
- Kernel.raise TypeError, "Cannot compare RealPoint to #{other}"
27
+ false
27
28
  end
28
29
  end
29
30
 
30
- # Correct comparison for RealPoints - same if same x and y
31
- def eql?(other)
31
+ def hash
32
+ to_ary.hash
33
+ end
34
+
35
+ def <=>(other)
32
36
  if Wx::RealPoint === other
33
- x == other.x and y == other.y
37
+ (x*y) <=> (other.x*other.y)
38
+ elsif Array === other && other.size == 2
39
+ (x*y) <=> (other.first.to_f*other.last.to_f)
34
40
  else
35
- false
41
+ nil
36
42
  end
37
43
  end
38
44
 
@@ -89,4 +95,9 @@ class Wx::RealPoint
89
95
  end
90
96
  end
91
97
  end
98
+
99
+
100
+ def to_point
101
+ Wx::Point.new(self.x.to_i, self.y.to_i)
102
+ end
92
103
  end
data/lib/wx/core/rect.rb CHANGED
@@ -23,12 +23,12 @@ class Wx::Rect
23
23
  elsif Array === other && other.size == 4
24
24
  to_ary == other
25
25
  else
26
- Kernel.raise TypeError, "Cannot compare Rect to #{other}"
26
+ false
27
27
  end
28
28
  end
29
29
 
30
30
  def eql?(other)
31
- if Wx::Rect === other
31
+ if other.instance_of?(self.class)
32
32
  left == other.left and top == other.top and
33
33
  width == other.width and height == other.height
34
34
  else
data/lib/wx/core/size.rb CHANGED
@@ -1,4 +1,7 @@
1
1
  class Wx::Size
2
+
3
+ include Comparable
4
+
2
5
  # More informative output for inspect etc
3
6
  def to_s
4
7
  "#<Wx::Size: #{width}x#{height}>"
@@ -14,24 +17,28 @@ class Wx::Size
14
17
  end
15
18
 
16
19
  # Compare with another size value
17
- def ==(other)
20
+ def <=>(other)
18
21
  if Wx::Size === other
19
- width == other.width and height == other.height
22
+ (width*height) <=> (other.width*other.height)
20
23
  elsif Array === other and other.size == 2
21
- to_ary == other
24
+ (width*height) <=> (other.first*other.last)
22
25
  else
23
- Kernel.raise TypeError, "Cannot compare Size to #{other}"
26
+ nil
24
27
  end
25
28
  end
26
29
 
27
30
  def eql?(other)
28
- if Wx::Size === other
31
+ if other.instance_of?(self.class)
29
32
  width == other.width and height == other.height
30
33
  else
31
34
  false
32
35
  end
33
36
  end
34
37
 
38
+ def hash
39
+ to_ary.hash
40
+ end
41
+
35
42
  # Return a new Wx::Size with the width and height values both divided
36
43
  # by parameter +num+, which should be a Numeric
37
44
  def /(num)
@@ -0,0 +1,104 @@
1
+
2
+ module Wx
3
+
4
+ class DataObject
5
+
6
+ # Returns the data size of the given format.
7
+ # Should be overridden in derived classes.
8
+ # @note **IMPORTANT** Please note that it is necessary to return the **size in bytes** of the data string
9
+ # returned by #get_data_here (not the size in characters).
10
+ # @param format [Wx::DataFormat]
11
+ # @return [Integer]
12
+ def get_data_size(format) end
13
+ alias_method :data_size, :get_data_size
14
+
15
+ end
16
+
17
+ # This is an (abstract in Ruby) base class for the simplest possible custom data objects.
18
+ # Unlike in C++ in Ruby this class cannot be used to derive custom data objects from but
19
+ # instead {Wx::DataObjectSimpleBase} (derived from Wx::DataObjectSimple) should be used.
20
+ # The data object of (a class derived from) this class only supports <b>one format</b>,
21
+ # so the number of virtual functions to be implemented is reduced.
22
+ # This class is the base class for {Wx::TextDataObject}, {Wx::FileDataObject}, {Wx::BitmapDataObject},
23
+ # {Wx::wxCustomDataObject} and others.
24
+ # ===
25
+ #
26
+ # Category: Clipboard and Drag & Drop
27
+ # @see Drag and Drop Overview
28
+ # @see Drag & Drop Sample
29
+ class DataObjectSimple < DataObject
30
+
31
+ # @overload get_data_size(format)
32
+ # Returns the data size of the format for this object.
33
+ # @param [Wx::DataFormat] format ignored for this class
34
+ # @return [Integer] default always returns 0
35
+ # @overload get_data_size()
36
+ # Returns the data size of the format for this object.
37
+ # @return [Integer] default always returns 0
38
+ def get_data_size(*) end
39
+
40
+ # @overload get_data_here(format)
41
+ # Returns the data of this object.
42
+ # @param [Wx::DataFormat] format ignored for this class
43
+ # @return [String,nil] data of this object
44
+ # @overload get_data_here()
45
+ # Returns the data of this object.
46
+ # @return [String,nil] data of this object
47
+ def get_data_here(*) end
48
+
49
+ # @overload set_data(format, buf)
50
+ # Sets the data for this object and returns true if successful, false otherwise.
51
+ # @param [Wx::DataFormat] format ignored for this class
52
+ # @param [String] buf non-nil data
53
+ # @return [Boolean] default always returns false.
54
+ # @overload set_data(buf)
55
+ # Sets the data for this object and returns true if successful, false otherwise.
56
+ # @param [String] buf non-nil data
57
+ # @return [Boolean] default always returns false.
58
+ def set_data(*) end
59
+
60
+ end
61
+
62
+ # This is the base class for the simplest possible custom data objects.
63
+ # The data object of (a class derived from) this class only supports <b>one format</b>,
64
+ # so the number of methods to be implemented is reduced.
65
+ # To be useful it must be derived. Derived objects supporting rendering the data must
66
+ # override {Wx::DataObjectSimpleBase#_get_data_size} and {Wx::DataObjectSimpleBase#_get_data}.
67
+ # By default these methods respectively return <code>0</code> and <code>nil</code>.
68
+ # The objects which may be set must override {Wx::DataObjectSimpleBase#_set_data} (which
69
+ # returns <code>false</code>).
70
+ # Of course, the objects supporting both operations must override all three methods.
71
+ # ===
72
+ #
73
+ # Category: Clipboard and Drag & Drop
74
+ # @see Drag and Drop Overview
75
+ # @see Drag & Drop Sample
76
+ # @see Wx::DataObjectSimple
77
+ class DataObjectSimpleBase < DataObjectSimple
78
+
79
+ # Returns this object's data size.
80
+ # The default implementation calls #_get_data and determines the size of the returned data string (if any).
81
+ # As this is not very optimal for more complex (and larger data objects) very often this method will be
82
+ # overridden in derived classes.
83
+ # @note **IMPORTANT** Please note that it is necessary to return the **size in bytes** of the data string
84
+ # returned by #_get_data (not the size in characters).
85
+ # @return [Integer]
86
+ def _get_data_size; end
87
+ protected :_get_data_size
88
+
89
+ # Returns this object's data (default implementation returns nil).
90
+ # Should be overridden in derived classes.
91
+ # @return [String,nil]
92
+ def _get_data; end
93
+ protected :_get_data
94
+
95
+ # Sets this object's data (default implementation does nothing and returns false).
96
+ # Should be overridden in derived classes.
97
+ # @param [String] buf non-nil data
98
+ # @return [Boolean]
99
+ def _set_data(buf); end
100
+ protected :_set_data
101
+
102
+ end
103
+
104
+ end
@@ -56,20 +56,27 @@ module Wx
56
56
 
57
57
  class Point
58
58
 
59
+ include Comparable
60
+
59
61
  # Returns point array (`[x, y]`)
60
62
  # @return [Array(Integer,Integer)] point as array
61
63
  def to_ary; end
62
64
 
63
- # Compare point values (Wx::Point or point array). Throws exception if incompatible.
65
+ # Compare point values (Wx::Point or point array). Returns -1,0 or 1 to indicate if this point
66
+ # is smaller, equal or greater than other (comparing <code>x*y</code> with <code>other.x*other.y</code>).
67
+ # Returns nil if incompatible.
64
68
  # @param [Wx::Point,Array(Integer,Integer)] other
65
- # @return [Boolean]
66
- def ==(other)end
69
+ # @return [Boolean,nil]
70
+ def <=>(other)end
67
71
 
68
72
  # Compare points.
69
73
  # @param [Wx::Point] other
70
74
  # @return [Boolean]
71
75
  def eql?(other)end
72
76
 
77
+ # Returns hash for point
78
+ def hash; end
79
+
73
80
  # Return a new Wx::Point with the x and y parameters both divided by
74
81
  # parameter +num+, which should be a Numeric
75
82
  # @param [Numeric] num
@@ -97,11 +104,18 @@ module Wx
97
104
  # @param [Wx::Point,Wx::Size,Array(Integer,Integer),Numeric] arg
98
105
  # @return [Wx::Point]
99
106
  def +(arg) end
100
-
107
+
108
+ # Converts point to Wx::RealPoint
109
+ # @return [Wx::RealPoint] Wx::RealPoint instance from point coordinates
110
+ def to_real_point; end
111
+ alias :to_real :to_real_point
112
+
101
113
  end
102
114
 
103
115
  class RealPoint
104
116
 
117
+ include Comparable
118
+
105
119
  # Returns point array (`[x, y]`)
106
120
  # @return [Array(Float,Float)] point as array
107
121
  def to_ary; end
@@ -111,11 +125,21 @@ module Wx
111
125
  # @return [Boolean]
112
126
  def ==(other)end
113
127
 
128
+ # Compare point values (Wx::RealPoint or point array). Returns -1,0 or 1 to indicate if this point
129
+ # is smaller, equal or greater than other (comparing <code>x*y</code> with <code>other.x*other.y</code>).
130
+ # Returns nil if incompatible.
131
+ # @param [Wx::RealPoint,Array(Float,Float)] other
132
+ # @return [Boolean,nil]
133
+ def <=>(other)end
134
+
114
135
  # Compare points.
115
136
  # @param [Wx::RealPoint] other
116
137
  # @return [Boolean]
117
138
  def eql?(other)end
118
139
 
140
+ # Returns hash for point
141
+ def hash; end
142
+
119
143
  # Return a new Wx::RealPoint with the x and y parameters both divided by
120
144
  # parameter +num+, which should be a Numeric
121
145
  # @param [Numeric] num
@@ -144,6 +168,10 @@ module Wx
144
168
  # @return [Wx::RealPoint]
145
169
  def +(arg) end
146
170
 
171
+ # Converts real point to Wx::Point
172
+ # @return [Wx::Point] Wx::Point instance from real point coordinates
173
+ def to_point; end
174
+
147
175
  end
148
176
 
149
177
  class Rect
@@ -152,7 +180,7 @@ module Wx
152
180
  # @return [Array(Integer,Integer,Integer,Integer)] rect as array
153
181
  def to_ary; end
154
182
 
155
- # Compare area values (Wx::Rect or 4-element array). Throws exception if incompatible.
183
+ # Compare area values (Wx::Rect or 4-element array). Returns false if incompatible.
156
184
  # @param [Wx::Rect,Array(Integer,Integer,Integer,Integer)] other
157
185
  # @return [Boolean]
158
186
  def ==(other)end
@@ -0,0 +1,37 @@
1
+
2
+ class Wx::ProgressDialog
3
+
4
+ # Updates the dialog, setting the progress bar to the new value and updating the message if new one is specified.
5
+ #
6
+ # Returns <code>false</code> if the "Cancel" button has been pressed, <code>true</code> if neither "Cancel" nor
7
+ # "Skip" has been pressed and <code>:skipped</code> if "Skip" has been pressed.
8
+ #
9
+ # If false is returned, the application can either immediately destroy the dialog or ask the user for the confirmation
10
+ # and if the abort is not confirmed the dialog may be resumed with #resume method.
11
+ #
12
+ # If value is the maximum value for the dialog, the behaviour of the function depends on whether Wx::PD_AUTO_HIDE was
13
+ # used when the dialog was created. If it was, the dialog is hidden and the function returns immediately. If it was
14
+ # not, the dialog becomes a modal dialog and waits for the user to dismiss it, meaning that this function does not
15
+ # return until this happens.
16
+ #
17
+ # Notice that if newmsg is longer than the currently shown message, the dialog will be automatically made wider to
18
+ # account for it. However if the new message is shorter than the previous one, the dialog doesn't shrink back to
19
+ # avoid constant resizes if the message is changed often. To do this and fit the dialog to its current contents you
20
+ # may call fit explicitly. An alternative would be to keep the number of lines of text constant in order to avoid
21
+ # jarring dialog size changes. You may also want to make the initial message, specified when creating the dialog,
22
+ # wide enough to avoid having to resize the dialog later, e.g. by appending a long string of unbreakable spaces
23
+ # (wxString(L'\u00a0', 100)) to it.
24
+ # @param [Integer] value The new value of the progress meter. It should be less than or equal to the maximum value given to the constructor.
25
+ # @param [String] newmsg The new messages for the progress dialog text, if it is empty (which is the default) the message is not changed.
26
+ # @return [Boolean,:skipped]
27
+ def update(value, newmsg = '') end
28
+
29
+ # Like #update but makes the gauge control run in indeterminate mode.
30
+ #
31
+ # In indeterminate mode the remaining and the estimated time labels (if present) are set to "Unknown" or to newmsg
32
+ # (if it's non-empty). Each call to this function moves the progress bar a bit to indicate that some progress was done.
33
+ # @param [String] newmsg
34
+ # @return [Boolean,:skipped]
35
+ def pulse(newmsg = '') end
36
+
37
+ end
@@ -0,0 +1,16 @@
1
+
2
+ class Wx
3
+
4
+ class ScaledDC < Wx::DC
5
+
6
+ private :initialize
7
+
8
+ # Creates a Wx::ScaledDC instance for target and scale and
9
+ # passes the instance to the given block to draw on.
10
+ # @param [Wx::DC] target DC to draw on (scaled)
11
+ # @param [Float] scale scale factor
12
+ # @yieldparam [Wx::ScaledDC] dc scaled dc to draw on
13
+ def self.draw_on(target, scale) end
14
+ end
15
+
16
+ end
@@ -4,7 +4,7 @@
4
4
  module WxGlobalConstants
5
5
 
6
6
  class << self
7
- def search_nested(mod, sym)
7
+ def search_nested(mod, sym, path = [])
8
8
  # check any nested modules and/or (enum) classes
9
9
  const_val = nil
10
10
  mod.constants.each do |c|
@@ -16,11 +16,12 @@ module WxGlobalConstants
16
16
  elsif cv.name.start_with?('Wx::') # only search Wx namespace
17
17
  # prevent const_missing being triggered here since that may lead to unexpected results
18
18
  const_val = cv.const_get(sym) if cv.constants.include?(sym)
19
- const_val = search_nested(cv, sym) unless const_val
19
+ const_val = search_nested(cv, sym, path+[mod]) unless const_val || path.include?(cv)
20
20
  end
21
21
  when ::Module
22
22
  if cv.name.start_with?('Wx::') # only search Wx namespace
23
- const_val = cv.const_get(sym) rescue nil
23
+ const_val = cv.const_get(sym) if cv.constants.include?(sym)
24
+ const_val = search_nested(cv, sym, path+[mod]) unless const_val || path.include?(cv)
24
25
  end
25
26
  end unless mod == cv # watch out for infinite recursion
26
27
  break if const_val
data/lib/wx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wx
2
- WXRUBY_VERSION = '0.9.0-beta.9'
2
+ WXRUBY_VERSION = '0.9.0-beta.11'
3
3
  end