wxruby3 0.9.0.pre.beta.11 → 0.9.0.pre.beta.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +85 -0
  3. data/README.md +2 -0
  4. data/assets/logo.png +0 -0
  5. data/assets/logo.svg +170 -0
  6. data/assets/logo.xcf +0 -0
  7. data/ext/wxruby3/swig/wx.i +1 -1
  8. data/lib/wx/core/array_ext.rb +26 -0
  9. data/lib/wx/core/art_locator.rb +92 -0
  10. data/lib/wx/core/artprovider.rb +1 -1
  11. data/lib/wx/core/bitmap.rb +90 -53
  12. data/lib/wx/core/cursor.rb +12 -0
  13. data/lib/wx/core/dataformat.rb +3 -1
  14. data/lib/wx/core/dc.rb +76 -52
  15. data/lib/wx/core/enum.rb +4 -0
  16. data/lib/wx/core/event.rb +38 -5
  17. data/lib/wx/core/evthandler.rb +64 -23
  18. data/lib/wx/core/icon.rb +50 -35
  19. data/lib/wx/core/id_helper.rb +32 -0
  20. data/lib/wx/core/image.rb +63 -53
  21. data/lib/wx/core/point.rb +14 -0
  22. data/lib/wx/core/real_point.rb +15 -1
  23. data/lib/wx/core/rect.rb +42 -7
  24. data/lib/wx/core/region_iterator.rb +37 -0
  25. data/lib/wx/core/size.rb +20 -0
  26. data/lib/wx/core/window.rb +8 -31
  27. data/lib/wx/doc/array_ext.rb +27 -0
  28. data/lib/wx/doc/art_locator.rb +57 -0
  29. data/lib/wx/doc/bitmap.rb +27 -0
  30. data/lib/wx/doc/clipboard.rb +12 -0
  31. data/lib/wx/doc/const.rb +77 -0
  32. data/lib/wx/doc/cursor.rb +16 -0
  33. data/lib/wx/doc/data_object.rb +1 -2
  34. data/lib/wx/doc/dc.rb +63 -46
  35. data/lib/wx/doc/event.rb +24 -0
  36. data/lib/wx/doc/events.rb +14 -0
  37. data/lib/wx/doc/evthandler.rb +24 -3
  38. data/lib/wx/doc/extra/00_starting.md +1 -1
  39. data/lib/wx/doc/extra/06_geometry.md +10 -4
  40. data/lib/wx/doc/extra/10_art.md +105 -0
  41. data/lib/wx/doc/gc_dc.rb +21 -0
  42. data/lib/wx/doc/gdi_common.rb +122 -1
  43. data/lib/wx/doc/graphics_context.rb +42 -0
  44. data/lib/wx/doc/icon.rb +18 -0
  45. data/lib/wx/doc/id_helper.rb +25 -0
  46. data/lib/wx/doc/image.rb +33 -0
  47. data/lib/wx/doc/region_iterator.rb +31 -0
  48. data/lib/wx/doc/scaled_dc.rb +1 -0
  49. data/lib/wx/doc/window.rb +18 -0
  50. data/lib/wx/version.rb +1 -1
  51. data/lib/wx/wxruby/cmd/sampler.rb +3 -21
  52. data/rakelib/lib/config.rb +4 -4
  53. data/rakelib/lib/core/package.rb +3 -3
  54. data/rakelib/lib/director/art_provider.rb +2 -2
  55. data/rakelib/lib/director/busy_info.rb +9 -7
  56. data/rakelib/lib/director/clipboard.rb +1 -1
  57. data/rakelib/lib/director/colour_picker_ctrl.rb +1 -0
  58. data/rakelib/lib/director/data_object.rb +72 -4
  59. data/rakelib/lib/director/derived_dc.rb +100 -6
  60. data/rakelib/lib/director/dir_picker_ctrl.rb +1 -0
  61. data/rakelib/lib/director/event.rb +73 -8
  62. data/rakelib/lib/director/events.rb +19 -1
  63. data/rakelib/lib/director/file_picker_ctrl.rb +1 -0
  64. data/rakelib/lib/director/font_picker_ctrl.rb +1 -0
  65. data/rakelib/lib/director/gdicommon.rb +1 -3
  66. data/rakelib/lib/director/graphics_context.rb +89 -0
  67. data/rakelib/lib/director/help_controller.rb +2 -2
  68. data/rakelib/lib/director/html_data_object.rb +37 -0
  69. data/rakelib/lib/director/image.rb +55 -0
  70. data/rakelib/lib/director/region_iterator.rb +48 -0
  71. data/rakelib/lib/director/richtext_buffer.rb +1 -1
  72. data/rakelib/lib/director/richtext_buffer_data_object.rb +45 -0
  73. data/rakelib/lib/director/scroll_bar.rb +39 -0
  74. data/rakelib/lib/director/slider.rb +39 -0
  75. data/rakelib/lib/director/window.rb +36 -5
  76. data/rakelib/lib/director/window_disabler.rb +0 -7
  77. data/rakelib/lib/extractor/class.rb +1 -1
  78. data/rakelib/lib/extractor/function.rb +1 -1
  79. data/rakelib/lib/generate/doc.rb +26 -6
  80. data/rakelib/lib/specs/interfaces.rb +6 -1
  81. data/rakelib/lib/typemap/common.rb +1 -1
  82. data/rakelib/lib/util/string.rb +29 -8
  83. data/samples/art/wxruby-128x128.png +0 -0
  84. data/samples/art/wxruby-256x256.png +0 -0
  85. data/samples/art/wxruby-64x64.png +0 -0
  86. data/samples/art/wxruby.ico +0 -0
  87. data/samples/art/wxruby.png +0 -0
  88. data/samples/drawing/graphics_drawing.rb +1 -2
  89. data/samples/propgrid/propgrid.rb +65 -65
  90. data/samples/sample.xpm +246 -470
  91. data/samples/treectrl/treectrl.rb +1 -1
  92. data/tests/art/my_art/sample.xpm +251 -0
  93. data/tests/art/sample3.xpm +251 -0
  94. data/tests/art/test_art/bitmap/sample.xpm +251 -0
  95. data/tests/art/test_art/bitmap/wxruby.bmp +0 -0
  96. data/tests/art/test_art/bitmap/wxruby.png +0 -0
  97. data/tests/art/test_art/bitmap/wxruby.xpm +251 -0
  98. data/tests/art/test_art/cursor/wxruby.bmp +0 -0
  99. data/tests/art/test_art/icon/sample.xpm +251 -0
  100. data/tests/art/test_art/icon/wxruby.ico +0 -0
  101. data/tests/art/test_art/icon/wxruby.png +0 -0
  102. data/tests/art/test_art/image/sample.xpm +251 -0
  103. data/tests/art/test_art/image/wxruby.jpg +0 -0
  104. data/tests/art/test_art/image/wxruby.png +0 -0
  105. data/tests/art/test_art/sample2.xpm +251 -0
  106. data/tests/test_art.rb +91 -0
  107. data/tests/test_clipboard.rb +35 -0
  108. data/tests/test_dc.rb +70 -0
  109. data/tests/test_events.rb +12 -0
  110. data/tests/test_geometry.rb +13 -0
  111. metadata +51 -5
@@ -0,0 +1,37 @@
1
+
2
+ class Wx::RegionIterator
3
+
4
+ alias :have_rects? :have_rects
5
+
6
+ # Ruby like enumeration
7
+ def each
8
+ if block_given?
9
+ while have_rects
10
+ yield get_rect
11
+ next_rect
12
+ end
13
+ else
14
+ # The region iterator instance cannot be allowed to exist beyond the outer
15
+ # Wx::RegionIterator.for_region block as it is a temporary instance that
16
+ # will stop to exist when the outer block finishes, so we collect the rectangles
17
+ # here and return an enumerator on that
18
+ arr = []
19
+ while has_rects
20
+ arr << get_rect
21
+ next_rect
22
+ end
23
+ arr.each
24
+ end
25
+ end
26
+
27
+ def self.iterate(region, &block)
28
+ return unless block
29
+ for_region(region) do |ri|
30
+ while ri.have_rects
31
+ block.call(ri)
32
+ ri.next_rect
33
+ end
34
+ end
35
+ end
36
+
37
+ end
data/lib/wx/core/size.rb CHANGED
@@ -2,6 +2,12 @@ class Wx::Size
2
2
 
3
3
  include Comparable
4
4
 
5
+ # provide compatibility methods
6
+ alias :get_x :get_width
7
+ alias :x :get_width
8
+ alias :get_y :get_height
9
+ alias :y :get_height
10
+
5
11
  # More informative output for inspect etc
6
12
  def to_s
7
13
  "#<Wx::Size: #{width}x#{height}>"
@@ -90,4 +96,18 @@ class Wx::Size
90
96
  end
91
97
  end
92
98
  end
99
+
100
+ def dup
101
+ Wx::Size.new(self.width, self.height)
102
+ end
103
+
104
+ def to_size
105
+ self
106
+ end
107
+
108
+ def assign(sz)
109
+ self.width = sz.width
110
+ self.height = sz.height
111
+ self
112
+ end
93
113
  end
@@ -53,43 +53,20 @@ class Wx::Window
53
53
  def evt_paint(meth = nil, &block)
54
54
  paint_proc = acquire_handler(meth, block)
55
55
  wrapped_block = proc do | event |
56
- instance_variable_set("@__painting__", true)
56
+ instance_variable_set('@__painting__', true)
57
57
  paint_proc.call(event)
58
- remove_instance_variable("@__painting__")
58
+ remove_instance_variable('@__painting__')
59
59
  end
60
60
  __old_evt_paint(&wrapped_block)
61
61
  end
62
62
 
63
- # Provides bufferd drawing facility to reduce flicker for complex
64
- # drawing commands. Works similar to BufferedDC and BufferedPaintDC in
65
- # the wxWidgets API, by doing drawing on an in-memory Bitmap, then
66
- # copying the result in bulk to the screen.
67
- #
68
- # The method may be passed an existing Wx::Bitmap as the +buffer+,
69
- # otherwise one will be created.
70
- #
71
- # Works like wxAutoBufferedDC in that additional buffering will only
72
- # be done on platforms that do not already natively support buffering
73
- # for the standard PaintDC / ClientDC - Windows, in particular.
74
- def paint_buffered(buffer = nil)
75
- # OS X and GTK do double-buffering natively
76
- if self.double_buffered?
77
- paint { | dc | yield dc }
63
+ # Overload the wrapper method to check for @__painting__
64
+ wx_paint_buffered = instance_method :paint_buffered
65
+ define_method :paint_buffered do |&block|
66
+ if instance_variable_defined?('@__painting__')
67
+ wx_paint_buffered.bind(self).call(&block)
78
68
  else
79
- # client_size is the window area available for drawing upon
80
- c_size = client_size
81
- # Create an in-memory buffer if none supplied
82
- buffer ||= Wx::Bitmap.new(c_size.width, c_size.height)
83
- buffer.draw do | mem_dc |
84
- mem_dc.background = Wx::TRANSPARENT_BRUSH
85
- mem_dc.clear
86
- # Yield the bitmap for the user code to draw upon
87
- yield mem_dc
88
- paint do | dc |
89
- # Copy the buffer to the window
90
- dc.blit(0, 0, c_size.width, c_size.height, mem_dc, 0, 0)
91
- end
92
- end
69
+ self.paint(&block)
93
70
  end
94
71
  end
95
72
  end
@@ -0,0 +1,27 @@
1
+
2
+ module Wx
3
+
4
+ # Mixin module providing Array extensions.
5
+ module ArrayExt
6
+
7
+ # Returns a new Wx::Size instance created from the first two elements of the array.
8
+ # Any missing element will be supplemented by a Wx::DEFAULT_COORD value.
9
+ # The array is not altered.
10
+ # @return [Wx::Size]
11
+ def to_size; end
12
+
13
+ # Returns a new Wx::Point instance created from the first two elements of the array.
14
+ # Any missing element will be supplemented by a Wx::DEFAULT_COORD value.
15
+ # The array is not altered.
16
+ # @return [Wx::Point]
17
+ def to_point; end
18
+
19
+ # Returns a new Wx::RealPoint instance created from the first two elements of the array.
20
+ # Any missing element will be supplemented by a Wx::DEFAULT_COORD value.
21
+ # The array is not altered.
22
+ # @return [Wx::RealPoint]
23
+ def to_real_point; end
24
+
25
+ end
26
+
27
+ end
@@ -0,0 +1,57 @@
1
+
2
+
3
+ # This module provides and standardizes support for locating application art files.
4
+ #
5
+ module Wx::ArtLocator
6
+
7
+ # Default name of art folder.
8
+ ART_FOLDER = 'art'
9
+
10
+ class << self
11
+
12
+ # Returns the base name for the folder holding application art files.
13
+ # By default this returns ART_FOLDER
14
+ # @return [String]
15
+ def art_folder; end
16
+
17
+ # Sets the base name for the folder holding application art files.
18
+ # @param [String] name art folder base name
19
+ def art_folder=(name) end
20
+
21
+ # Adds one or more search paths to look for art files.
22
+ # By default ArtLocator#find_art will look only at locations of the caller's
23
+ # file path. If search paths have been added though these will be searched
24
+ # after the lookup in the caller's path has failed.
25
+ def add_search_path(*names) end
26
+ alias :add_search_paths :add_search_path
27
+
28
+ # Searches for the an art file for the given 'art_name'.
29
+ # By default the search will be performed at the following locations (in order):
30
+ # 1. <art_path>/<#art_folder>/<art_section>/<art_type>/
31
+ # 2. <art_path>/<#art_folder>/<art_section>/
32
+ # 3. <art_path>/<#art_folder>/
33
+ # 4. <art_path>/
34
+ # Where 'art_type' is any of <code>:icon</code>, <code>:bitmap</code>, <code>:cursor</code>,
35
+ # <code>:image</code> or <code>nil</code>. If 'art_type' is nil the first location will be skipped.
36
+ # In case 'art_path' == <code>nil</code> the absolute path to the folder holding the caller's
37
+ # code will be used which is determined through ::Kernel#caller_locations.
38
+ # If 'art_section' is also <code>nil</code> the basename of the caller's source file will be used.
39
+ # At each location the existence of a file with base name 'art_name' and each of the supported
40
+ # extensions for the given 'art_type' (see wxWidgets documentation) will be tested. If 'art_type' is nil
41
+ # all extensions for all supported bitmap types will be tested (similar to when 'art_type' is :image).
42
+ # If an optional Wx::BitmapType is specified through 'bmp_type' the tested extensions will
43
+ # be restricted to the extensions supported for specified the bitmap type.
44
+ #
45
+ # In case additional search paths have been specified through #add_search_path these will be
46
+ # searched after the lookup at 'art_path' fails. For each search path the same lookups
47
+ # will be performed (replacing 'art_path' by the search path).
48
+ # @param [String,Symbol] art_name base name for art file
49
+ # @param [Symbol,nil] art_type type of art to look for (:icon, :bitmap, :cursor, :image)
50
+ # @param [String,nil] art_path base path to look up the art file
51
+ # @param [String,nil] art_section optional owner folder name for art files
52
+ # @param [Wx::BitmapType,nil] bmp_type bitmap type of art file
53
+ def find_art(art_name, art_type: nil, art_path: nil, art_section: nil, bmp_type: nil) end
54
+
55
+ end
56
+
57
+ end
@@ -0,0 +1,27 @@
1
+
2
+ module Wx
3
+
4
+ # Default BitmapType for current platform. Actual value is platform dependent.
5
+ ICON_DEFAULT_TYPE = Wx::BitmapType::BITMAP_TYPE_ANY
6
+ # Default BitmapType for current platform. Actual value is platform dependent.
7
+ BITMAP_DEFAULT_TYPE = Wx::BitmapType::BITMAP_TYPE_ANY
8
+ # Default BitmapType for current platform. Actual value is platform dependent.
9
+ CURSOR_DEFAULT_TYPE = Wx::BitmapType::BITMAP_TYPE_ANY
10
+
11
+ class Bitmap
12
+
13
+ # Searches for an art file with basename 'name' and creates a Bitmap if found.
14
+ # Raises an ArgumentError if not found.
15
+ # Wx::ArtLocator::find_art is used to look up the art file using ::Kernel#caller_locations to
16
+ # determine the values for the 'art_path' and 'art_owner' arguments ('art_path' is set to the
17
+ # absolute path to the folder holding the caller's code and 'art_owner' to the basename of the
18
+ # caller's source file). The 'art_type' argument is set to <code>:icon</code>.
19
+ # @param [String,Symbol] name base name of art file
20
+ # @param [Wx::BitmapType,nil] bmp_type bitmap type for art file (nil means any supported type)
21
+ # @return [Wx::Bitmap]
22
+ # @see Wx::ArtLocator::find_art
23
+ def self.Bitmap(name, bmp_type = nil); end
24
+
25
+ end
26
+
27
+ end
@@ -0,0 +1,12 @@
1
+
2
+ class Wx::Clipboard
3
+
4
+ alias :place :set_data
5
+ alias :fetch :get_data
6
+
7
+ # Opens the global clipboard and passes the clipboard object to the block.
8
+ # @yieldparam [Wx::Clipboard] clip the global clipboard object
9
+ # @return [Object] block result
10
+ def self.open; end
11
+
12
+ end
@@ -0,0 +1,77 @@
1
+ module Wx
2
+
3
+ =begin
4
+ These constants are not documented in the wxWidgets interface headers
5
+ although they are referenced in various argument defaults which *are*
6
+ in the interface header declarations so we do want them included the
7
+ wxRuby docs so the doc links work but we do not need them in the
8
+ wxRuby implementation since these are internal to the C++ wrappers.
9
+ =end
10
+
11
+ DefaultDateTimeFormat = '%c'
12
+ DefaultTimeSpanFormat = '%H:%M:%S'
13
+
14
+ ChoiceNameStr = 'choice'
15
+ ColourPickerCtrlNameStr = 'colourpicker'
16
+ ColourPickerWidgetNameStr = 'colourpickerwidget'
17
+ HyperlinkCtrlNameStr = 'hyperlink'
18
+ PanelNameStr = 'panel'
19
+ ListBoxNameStr = 'listBox'
20
+ FrameNameStr = 'frame'
21
+ StatusLineNameStr = 'status_line'
22
+ StaticBitmapNameStr = 'staticBitmap'
23
+ WebViewNameStr = 'wxWebView'
24
+ AnimationCtrlNameStr = 'animationctrl'
25
+ ToolBarNameStr = 'toolbar'
26
+ TextCtrlNameStr = 'text'
27
+ ListCtrlNameStr = 'listCtrl'
28
+ FilePickerCtrlNameStr = 'filepicker'
29
+ FilePickerWidgetNameStr = 'filepickerwidget'
30
+ DirPickerCtrlNameStr = 'dirpicker'
31
+ DirPickerWidgetNameStr = 'dirpickerwidget'
32
+ FileCtrlNameStr = 'wxfilectrl'
33
+ StaticBoxNameStr = 'groupBox'
34
+ ButtonNameStr = 'button'
35
+ RadioBoxNameStr = 'radioBox'
36
+ StaticLineNameStr = 'staticLine'
37
+ RadioButtonNameStr = 'radioButton'
38
+ BitmapRadioButtonNameStr = 'radioButton'
39
+ GaugeNameStr = 'gauge'
40
+ DataViewCtrlNameStr = 'dataviewCtrl'
41
+ FontPickerCtrlNameStr = 'fontpicker'
42
+ FontPickerWidgetNameStr = 'fontpickerwidget'
43
+ RearrangeListNameStr = 'wxRearrangeList'
44
+ RearrangeDialogNameStr = 'wxRearrangeDlg'
45
+ NotebookNameStr = 'notebook'
46
+ ControlNameStr = 'control'
47
+ ScrollBarNameStr = 'scrollBar'
48
+ StatusBarNameStr = 'statusBar'
49
+ SliderNameStr = 'slider'
50
+ HeaderCtrlNameStr = 'wxHeaderCtrl'
51
+ BitmapComboBoxNameStr = 'bitmapComboBox'
52
+ CheckBoxNameStr = 'check'
53
+ FileDialogNameStr = 'filedlg'
54
+ AddRemoveCtrlNameStr = 'wxAddRemoveCtrl'
55
+ StaticTextNameStr = 'staticText'
56
+ ComboBoxNameStr = 'comboBox'
57
+ SearchCtrlNameStr = 'searchCtrl'
58
+ DirDialogNameStr = 'wxDirCtrl'
59
+ TreeCtrlNameStr = 'treeCtrl'
60
+ DialogNameStr = 'dialog'
61
+ CollapsibleHeaderCtrlNameStr = 'collapsibleHeader'
62
+ CollapsiblePaneNameStr = 'collapsiblePane'
63
+ BannerWindowNameStr = 'bannerwindow'
64
+ GridNameStr = 'grid'
65
+ TreeListCtrlNameStr = 'wxTreeListCtrl'
66
+ HtmlListBoxNameStr = 'htmlListBox'
67
+ SimpleHtmlListBoxNameStr = 'simpleHtmlListBox'
68
+ EditableListBoxNameStr = 'editableListBox'
69
+ VListBoxNameStr = 'wxVListBox'
70
+ CollapsiblePaneNameStr = 'collapsiblePane'
71
+ MSWHeaderCtrlNameStr = 'wxMSWHeaderCtrl'
72
+ PropertyGridManagerNameStr = 'wxPropertyGridManager'
73
+ PropertyGridNameStr = 'wxPropertyGrid'
74
+ STCNameStr = 'stcwindow'
75
+ STCNameStr = 'stcwindow'
76
+
77
+ end
@@ -0,0 +1,16 @@
1
+
2
+ class Wx::Cursor
3
+
4
+ # Searches for an art file with basename 'name' and creates a Cursor if found.
5
+ # Raises an ArgumentError if not found.
6
+ # Wx::ArtLocator::find_art is used to look up the art file using ::Kernel#caller_locations to
7
+ # determine the values for the 'art_path' and 'art_owner' arguments ('art_path' is set to the
8
+ # absolute path to the folder holding the caller's code and 'art_owner' to the basename of the
9
+ # caller's source file). The 'art_type' argument is set to <code>:icon</code>.
10
+ # @param [String,Symbol] name base name of art file
11
+ # @param [Wx::BitmapType,nil] bmp_type bitmap type for art file (nil means any supported type)
12
+ # @return [Wx::Cursor]
13
+ # @see Wx::ArtLocator::find_art
14
+ def self.Cursor(name, bmp_type = nil); end
15
+
16
+ end
@@ -80,8 +80,7 @@ module Wx
80
80
  # The default implementation calls #_get_data and determines the size of the returned data string (if any).
81
81
  # As this is not very optimal for more complex (and larger data objects) very often this method will be
82
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).
83
+ # @note **IMPORTANT** Please note that it is necessary to return the **size in bytes** of the data string returned by #_get_data (not the size in characters).
85
84
  # @return [Integer]
86
85
  def _get_data_size; end
87
86
  protected :_get_data_size
data/lib/wx/doc/dc.rb CHANGED
@@ -1,49 +1,66 @@
1
1
 
2
- class Wx::DC
3
-
4
- # Provides similar functionality like wxDCBrushChanger setting the given brush as the active
5
- # brush for the DC for the duration of the block execution restoring the previous brush afterwards.
6
- # @param [Wx::Brush] brush new brush to use during block execution
7
- # @return [void]
8
- # @yieldparam [Wx::DC] dc the DC (self)
9
- def with_brush(brush) end
10
-
11
- # Provides similar functionality like wxDCPenChanger setting the given pen as the active
12
- # pen for the DC for the duration of the block execution restoring the previous pen afterwards.
13
- # @param [Wx::Pen] pen new pen to use during block execution
14
- # @return [void]
15
- # @yieldparam [Wx::DC] dc the DC (self)
16
- def with_pen(pen) end
17
-
18
- # Provides similar functionality like wxDCFontChanger setting the given font as the active
19
- # font for the DC for the duration of the block execution restoring the previous font afterwards.
20
- # @param [Wx::Font] font new font to use during block execution
21
- # @return [void]
22
- # @yieldparam [Wx::DC] dc the DC (self)
23
- def with_font(font) end
24
-
25
- # Provides similar functionality like wxDCTextColourChanger setting the given colour as the active
26
- # text foreground colour for the DC for the duration of the block execution restoring the previous colour afterwards.
27
- # @param [Wx::Colour] clr new colour to use during block execution
28
- # @return [void]
29
- # @yieldparam [Wx::DC] dc the DC (self)
30
- def with_text_foreground(clr) end
31
- alias :with_text_fg :with_text_foreground
32
-
33
- # Provides similar functionality like wxDCTextBgColourChanger setting the given colour as the active
34
- # text background colour for the DC for the duration of the block execution restoring the previous colour afterwards.
35
- # @param [Wx::Colour] clr new colour to use during block execution
36
- # @return [void]
37
- # @yieldparam [Wx::DC] dc the DC (self)
38
- def with_text_background(clr) end
39
- alias :with_text_bg :with_text_background
40
-
41
- # Provides similar functionality like wxDCTextBgModeChanger setting the given mode as the active
42
- # background mode for the DC for the duration of the block execution restoring the previous mode afterwards.
43
- # @param [Integer] mode new mode to use during block execution
44
- # @return [void]
45
- # @yieldparam [Wx::DC] dc the DC (self)
46
- def with_background_mode(mode) end
47
- alias :with_bg_mode :with_background_mode
2
+ module Wx
3
+ class DC
4
+
5
+ # Provides similar functionality like wxDCBrushChanger setting the given brush as the active
6
+ # brush for the DC for the duration of the block execution restoring the previous brush afterwards.
7
+ # @param [Wx::Brush] brush new brush to use during block execution
8
+ # @return [void]
9
+ # @yieldparam [Wx::DC] dc the DC (self)
10
+ def with_brush(brush) end
11
+
12
+ # Provides similar functionality like wxDCPenChanger setting the given pen as the active
13
+ # pen for the DC for the duration of the block execution restoring the previous pen afterwards.
14
+ # @param [Wx::Pen] pen new pen to use during block execution
15
+ # @return [void]
16
+ # @yieldparam [Wx::DC] dc the DC (self)
17
+ def with_pen(pen) end
18
+
19
+ # Provides similar functionality like wxDCFontChanger setting the given font as the active
20
+ # font for the DC for the duration of the block execution restoring the previous font afterwards.
21
+ # @param [Wx::Font] font new font to use during block execution
22
+ # @return [void]
23
+ # @yieldparam [Wx::DC] dc the DC (self)
24
+ def with_font(font) end
25
+
26
+ # Provides similar functionality like wxDCTextColourChanger setting the given colour as the active
27
+ # text foreground colour for the DC for the duration of the block execution restoring the previous colour afterwards.
28
+ # @param [Wx::Colour] clr new colour to use during block execution
29
+ # @return [void]
30
+ # @yieldparam [Wx::DC] dc the DC (self)
31
+ def with_text_foreground(clr) end
32
+ alias :with_text_fg :with_text_foreground
33
+
34
+ # Provides similar functionality like wxDCTextBgColourChanger setting the given colour as the active
35
+ # text background colour for the DC for the duration of the block execution restoring the previous colour afterwards.
36
+ # @param [Wx::Colour] clr new colour to use during block execution
37
+ # @return [void]
38
+ # @yieldparam [Wx::DC] dc the DC (self)
39
+ def with_text_background(clr) end
40
+ alias :with_text_bg :with_text_background
41
+
42
+ # Provides similar functionality like wxDCTextBgModeChanger setting the given mode as the active
43
+ # background mode for the DC for the duration of the block execution restoring the previous mode afterwards.
44
+ # @param [Integer] mode new mode to use during block execution
45
+ # @return [void]
46
+ # @yieldparam [Wx::DC] dc the DC (self)
47
+ def with_background_mode(mode) end
48
+ alias :with_bg_mode :with_background_mode
49
+
50
+ end
51
+
52
+ class MemoryDC
53
+
54
+ # Creates a Memory DC and passes that to the given block to draw on.
55
+ # Automatically unselects any source object of the MemoryDC after the block finishes.
56
+ # @overload self.draw_on(bitmap)
57
+ # @param [Wx::Bitmap]
58
+ # @yieldparam [WxMemoryDC] dc
59
+ # @overload self.draw_on(dc)
60
+ # @param [Wx::DC]
61
+ # @yieldparam [WxMemoryDC] dc
62
+ def self.draw_on(arg, &block) end
63
+
64
+ end
48
65
 
49
66
  end
@@ -0,0 +1,24 @@
1
+
2
+ module Wx
3
+
4
+ class Event
5
+
6
+ # Constructor
7
+ # @param [Integer] evt_type
8
+ # @param [Integer] id
9
+ # @param [Wx::EventPropagation] prop_level
10
+ def initialize(evt_type = Wx::EVT_NULL, id = 0, prop_level = Wx::EVENT_PROPAGATE_NONE) end
11
+
12
+ # Returns a copy of the event.
13
+ # Any event that is posted to the wxRuby event system for later action (via {Wx::EvtHandler#add_pending_event},
14
+ # {Wx::EvtHandler#queue_event} or {Wx::EvtHandler#post_event}) must implement this method.
15
+ # All standard wxRuby events fully implement this method and wxRuby has taken care of correctly handling this
16
+ # for any user defined event classes derived from either Wx::Event or Wx::CommandEvent.
17
+ # Creating user defined event classes derived for other classes than Wx::Event or Wx::CommandEvent is currently
18
+ # *not* supported in wxRuby.
19
+ # @return [Wx::Event]
20
+ def clone; end
21
+
22
+ end
23
+
24
+ end
@@ -0,0 +1,14 @@
1
+
2
+ module Wx
3
+
4
+ EVT_COMMAND_SCROLL_TOP = EVT_SCROLL_TOP
5
+ EVT_COMMAND_SCROLL_BOTTOM = EVT_SCROLL_BOTTOM
6
+ EVT_COMMAND_SCROLL_LINEUP = EVT_SCROLL_LINEUP
7
+ EVT_COMMAND_SCROLL_LINEDOWN = EVT_SCROLL_LINEDOWN
8
+ EVT_COMMAND_SCROLL_PAGEUP = EVT_SCROLL_PAGEUP
9
+ EVT_COMMAND_SCROLL_PAGEDOWN = EVT_SCROLL_PAGEDOWN
10
+ EVT_COMMAND_SCROLL_THUMBTRACK = EVT_SCROLL_THUMBTRACK
11
+ EVT_COMMAND_SCROLL_THUMBRELEASE = EVT_SCROLL_THUMBRELEASE
12
+ EVT_COMMAND_SCROLL_CHANGED = EVT_SCROLL_CHANGED
13
+
14
+ end
@@ -65,11 +65,26 @@ class Wx::EvtHandler
65
65
 
66
66
  # Convenience evt_handler to listen to all mouse events.
67
67
  # @yieldparam [Wx::MouseEvent] event event to handle
68
- def evt_mouse_events(&block) end
68
+ def evt_mouse_events(*args, &block) end
69
69
 
70
- # Convenience evt handler to listen to all scrollwin events.
70
+ # Convenience evt handler to listen to all scrollwin events
71
+ # (from Wx::ScrolledWindow).
72
+ # @param [String,Symbol,Method,Proc] meth (name of) method or event handling proc
73
+ # @yieldparam [Wx::ScrollWinEvent] event event to handle
74
+ def evt_scrollwin(meth = nil, &block) end
75
+
76
+ # Convenience evt handler to listen to all scroll events
77
+ # (from Wx::Slider and Wx::ScrollBar).
78
+ # @param [String,Symbol,Method,Proc] meth (name of) method or event handling proc
79
+ # @yieldparam [Wx::ScrollWinEvent] event event to handle
80
+ def evt_scroll(meth = nil, &block) end
81
+
82
+ # Convenience evt handler to listen to all scroll events
83
+ # (from Wx::Slider and Wx::ScrollBar) with an id.
84
+ # @param [Integer] id window identifier
85
+ # @param [String,Symbol,Method,Proc] meth (name of) method or event handling proc
71
86
  # @yieldparam [Wx::ScrollWinEvent] event event to handle
72
- def evt_scrollwin(&block) end
87
+ def evt_scroll_command(id, meth = nil, &block) end
73
88
 
74
89
  # Processes Wx::WindowDestroyEvent events.
75
90
  # In wxRuby Wx::Event#skipped will be forced to true after the provided
@@ -78,6 +93,12 @@ class Wx::EvtHandler
78
93
  # @yieldparam [Wx::WindowDestroyEvent] event event to handle
79
94
  def evt_window_destroy(&block) end
80
95
 
96
+ # Processes {Wx::EVT_TIMER} events. See {Wx::TimerEvent}.
97
+ # @param [Integer,Wx::Enum,Wx::Timer] id timer id
98
+ # @param [String,Symbol,Method,Proc] meth (name of) method or event handling proc
99
+ # @yieldparam [Wx::TimerEvent] event the event to handle
100
+ def evt_timer(id, meth = nil, &block) end
101
+
81
102
  # Schedule a call for asynchronous execution (at idle time).
82
103
  # @param meth [Symbol,String,Method,Proc] (name of) method or proc to call
83
104
  # @param args [Array<Object>] optional arguments to pass to the call
@@ -151,4 +151,4 @@ distributes implementations over various sub-modules. These sub-modules can be l
151
151
  The core module still provides the toplevel `Wx` namespace and all classes and constants declared in that namespace.
152
152
  All other modules add to that (and **all** require the core module).
153
153
 
154
- See [here](packages.md) for more details on wxRuby sub-modules.
154
+ See [here](01_packages.md) for more details on wxRuby sub-modules.
@@ -5,7 +5,7 @@
5
5
 
6
6
  # 6. wxRuby Geometry classes
7
7
 
8
- ## Size (Wx::Size) and position (Wx::Point)
8
+ ## Size (Wx::Size) and position (Wx::Point and Wx::RealPoint)
9
9
 
10
10
  The wxWidgets API has a lot methods that require either `wxSize`, `wxPoint` or both type of value as argument. Although
11
11
  this can be specified in C++ still relatively concise like
@@ -19,13 +19,13 @@ Wx::Frame.new(nil, -1, 'title', Wx::Point.new(0,0), Wx::Size.new(500,400))
19
19
  which starts to feel awkward to specify what are in essence just pairs of integers.
20
20
 
21
21
  To provide a simpler, more compact and more Ruby-like, alternative the wxRuby API therefor supports specifying arrays
22
- of integer pairs in (almost) all cases where `Wx::Size` or `Wx::Point` is expected. So the following code is equivalent
23
- to the previous code:
22
+ of integer (or float in case of Wx::RealPoint) pairs in (almost) all cases where `Wx::Size` or `Wx::Point`
23
+ (or Wx::RealPoint) is expected. So the following code is equivalent to the previous code:
24
24
  ```ruby
25
25
  Wx::Frame.new(nil, -1, 'title', [0,0], [500,400])
26
26
  ```
27
27
 
28
- In addition `Wx::Size` and `Wx::Point` support parallel assignment semantics such that you can write code like
28
+ In addition `Wx::Size`, `Wx::Point` and `Wx::RealPoint` support parallel assignment semantics such that you can write code like
29
29
  ```ruby
30
30
  win.paint do | dc |
31
31
  # ...
@@ -44,6 +44,12 @@ instead of
44
44
  end
45
45
  ```
46
46
 
47
+ Instances of these classes can also be converted (back) to arrays with their `#to_ary` methods.
48
+
49
+ Lastly wxRuby also extends the standard Ruby Array class with conversion methods to explicitly convert
50
+ arrays to `Wx::Size`, `Wx::Point` or `Wx::RealPoint`; respectively the `#to_size`, `#to_point` and `#to_real_point`
51
+ methods.
52
+
47
53
  ## Areas (Wx::Rect)
48
54
 
49
55
  Like `Wx::Size` and `Wx::Point` wxRuby supports parallel assignment for `Wx::Rect` such that you can write code like