wxruby3 0.9.0.pre.beta.10 → 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 (126) 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/include/wxruby-ScaledDC.h +549 -0
  8. data/ext/wxruby3/swig/wx.i +1 -1
  9. data/lib/wx/core/array_ext.rb +26 -0
  10. data/lib/wx/core/art_locator.rb +92 -0
  11. data/lib/wx/core/artprovider.rb +1 -1
  12. data/lib/wx/core/bitmap.rb +90 -53
  13. data/lib/wx/core/cursor.rb +12 -0
  14. data/lib/wx/core/data_object.rb +74 -6
  15. data/lib/wx/core/dataformat.rb +3 -1
  16. data/lib/wx/core/dc.rb +76 -52
  17. data/lib/wx/core/enum.rb +4 -0
  18. data/lib/wx/core/event.rb +38 -5
  19. data/lib/wx/core/evthandler.rb +64 -23
  20. data/lib/wx/core/icon.rb +50 -35
  21. data/lib/wx/core/id_helper.rb +32 -0
  22. data/lib/wx/core/image.rb +63 -53
  23. data/lib/wx/core/point.rb +35 -10
  24. data/lib/wx/core/real_point.rb +35 -10
  25. data/lib/wx/core/rect.rb +44 -9
  26. data/lib/wx/core/region_iterator.rb +37 -0
  27. data/lib/wx/core/size.rb +32 -5
  28. data/lib/wx/core/window.rb +8 -31
  29. data/lib/wx/doc/array_ext.rb +27 -0
  30. data/lib/wx/doc/art_locator.rb +57 -0
  31. data/lib/wx/doc/bitmap.rb +27 -0
  32. data/lib/wx/doc/clipboard.rb +12 -0
  33. data/lib/wx/doc/const.rb +77 -0
  34. data/lib/wx/doc/cursor.rb +16 -0
  35. data/lib/wx/doc/data_object.rb +103 -0
  36. data/lib/wx/doc/dc.rb +63 -46
  37. data/lib/wx/doc/event.rb +24 -0
  38. data/lib/wx/doc/events.rb +14 -0
  39. data/lib/wx/doc/evthandler.rb +24 -3
  40. data/lib/wx/doc/extra/00_starting.md +1 -1
  41. data/lib/wx/doc/extra/06_geometry.md +10 -4
  42. data/lib/wx/doc/extra/10_art.md +105 -0
  43. data/lib/wx/doc/gc_dc.rb +21 -0
  44. data/lib/wx/doc/gdi_common.rb +155 -6
  45. data/lib/wx/doc/graphics_context.rb +42 -0
  46. data/lib/wx/doc/icon.rb +18 -0
  47. data/lib/wx/doc/id_helper.rb +25 -0
  48. data/lib/wx/doc/image.rb +33 -0
  49. data/lib/wx/doc/region_iterator.rb +31 -0
  50. data/lib/wx/doc/scaled_dc.rb +17 -0
  51. data/lib/wx/doc/window.rb +18 -0
  52. data/lib/wx/global_const.rb +4 -3
  53. data/lib/wx/version.rb +1 -1
  54. data/lib/wx/wxruby/cmd/sampler.rb +3 -21
  55. data/rakelib/lib/config.rb +4 -4
  56. data/rakelib/lib/core/package.rb +6 -6
  57. data/rakelib/lib/core/spec.rb +2 -0
  58. data/rakelib/lib/director/art_provider.rb +2 -2
  59. data/rakelib/lib/director/busy_info.rb +9 -7
  60. data/rakelib/lib/director/clipboard.rb +1 -1
  61. data/rakelib/lib/director/colour_picker_ctrl.rb +1 -0
  62. data/rakelib/lib/director/data_object.rb +162 -0
  63. data/rakelib/lib/director/data_object_simple_base.rb +123 -0
  64. data/rakelib/lib/director/derived_dc.rb +134 -2
  65. data/rakelib/lib/director/dir_picker_ctrl.rb +1 -0
  66. data/rakelib/lib/director/event.rb +73 -8
  67. data/rakelib/lib/director/events.rb +19 -1
  68. data/rakelib/lib/director/file_picker_ctrl.rb +1 -0
  69. data/rakelib/lib/director/font_picker_ctrl.rb +1 -0
  70. data/rakelib/lib/director/gdicommon.rb +1 -3
  71. data/rakelib/lib/director/graphics_context.rb +89 -0
  72. data/rakelib/lib/director/help_controller.rb +2 -2
  73. data/rakelib/lib/director/html_data_object.rb +37 -0
  74. data/rakelib/lib/director/image.rb +55 -0
  75. data/rakelib/lib/director/region_iterator.rb +48 -0
  76. data/rakelib/lib/director/richtext_buffer.rb +1 -1
  77. data/rakelib/lib/director/richtext_buffer_data_object.rb +45 -0
  78. data/rakelib/lib/director/scroll_bar.rb +39 -0
  79. data/rakelib/lib/director/slider.rb +39 -0
  80. data/rakelib/lib/director/window.rb +36 -5
  81. data/rakelib/lib/director/window_disabler.rb +0 -7
  82. data/rakelib/lib/extractor/class.rb +1 -1
  83. data/rakelib/lib/extractor/function.rb +1 -1
  84. data/rakelib/lib/generate/doc.rb +26 -6
  85. data/rakelib/lib/specs/interfaces.rb +8 -1
  86. data/rakelib/lib/typemap/common.rb +1 -1
  87. data/rakelib/lib/typemap/data_object_data.rb +13 -4
  88. data/rakelib/lib/util/string.rb +29 -8
  89. data/samples/art/wxruby-128x128.png +0 -0
  90. data/samples/art/wxruby-256x256.png +0 -0
  91. data/samples/art/wxruby-64x64.png +0 -0
  92. data/samples/art/wxruby.ico +0 -0
  93. data/samples/art/wxruby.png +0 -0
  94. data/samples/drawing/graphics_drawing.rb +1 -2
  95. data/samples/propgrid/propgrid.rb +65 -65
  96. data/samples/sample.xpm +246 -470
  97. data/samples/treectrl/treectrl.rb +1 -1
  98. data/tests/art/my_art/sample.xpm +251 -0
  99. data/tests/art/sample3.xpm +251 -0
  100. data/tests/art/test_art/bitmap/sample.xpm +251 -0
  101. data/tests/art/test_art/bitmap/wxruby.bmp +0 -0
  102. data/tests/art/test_art/bitmap/wxruby.png +0 -0
  103. data/tests/art/test_art/bitmap/wxruby.xpm +251 -0
  104. data/tests/art/test_art/cursor/wxruby.bmp +0 -0
  105. data/tests/art/test_art/icon/sample.xpm +251 -0
  106. data/tests/art/test_art/icon/wxruby.ico +0 -0
  107. data/tests/art/test_art/icon/wxruby.png +0 -0
  108. data/tests/art/test_art/image/sample.xpm +251 -0
  109. data/tests/art/test_art/image/wxruby.jpg +0 -0
  110. data/tests/art/test_art/image/wxruby.png +0 -0
  111. data/tests/art/test_art/sample2.xpm +251 -0
  112. data/tests/lib/wxapp_runner.rb +64 -0
  113. data/tests/test_art.rb +91 -0
  114. data/tests/test_basic.rb +0 -5
  115. data/tests/test_clipboard.rb +149 -17
  116. data/tests/test_dc.rb +70 -0
  117. data/tests/test_dialog.rb +2 -13
  118. data/tests/test_event_handling.rb +2 -13
  119. data/tests/test_events.rb +14 -6
  120. data/tests/test_geometry.rb +67 -17
  121. data/tests/test_intl.rb +2 -15
  122. data/tests/test_item_data.rb +2 -15
  123. data/tests/test_variant.rb +1 -15
  124. data/tests/testapp.rb +0 -5
  125. data/tests/testapp_noframe.rb +0 -5
  126. metadata +56 -5
@@ -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
@@ -0,0 +1,103 @@
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 returned by #_get_data (not the size in characters).
84
+ # @return [Integer]
85
+ def _get_data_size; end
86
+ protected :_get_data_size
87
+
88
+ # Returns this object's data (default implementation returns nil).
89
+ # Should be overridden in derived classes.
90
+ # @return [String,nil]
91
+ def _get_data; end
92
+ protected :_get_data
93
+
94
+ # Sets this object's data (default implementation does nothing and returns false).
95
+ # Should be overridden in derived classes.
96
+ # @param [String] buf non-nil data
97
+ # @return [Boolean]
98
+ def _set_data(buf); end
99
+ protected :_set_data
100
+
101
+ end
102
+
103
+ end
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
@@ -0,0 +1,105 @@
1
+ <!--
2
+ # @markup markdown
3
+ # @title 10. wxRuby Locating and loading art
4
+ -->
5
+
6
+ # 9. wxRuby Locating and loading art
7
+
8
+ ## Introduction
9
+
10
+ With C++ wxWidgets applications art (icons, bitmaps, cursors, images) can be loaded in a variety
11
+ of ways from embedded resources (platform specific binary resources or embedded XPM files) or from
12
+ binary datasets retrieved from some data source.
13
+
14
+ With wxRuby that is for various reasons not a viable option so we are left with the option to
15
+ load art from files. In and of itself that option is not really too bad but for the issue of locating
16
+ the art files.
17
+ Art that is part of the application's design will preferably be stored with the source code but there
18
+ is not standard for this nor is there any standard support for locating those files from the application
19
+ code like there is for `require`-s of other code modules.
20
+
21
+ The wxRuby framework provides a convenience module `Wx::ArtLocator` to assist in that respect.
22
+ Wx::ArtLocator aims on the one side to standardize folder structures for storing art files and on the
23
+ other side to provide runtime support for locating those files from code.
24
+
25
+ The main locator method provided is:
26
+
27
+ ```ruby
28
+ module Wx::Locator
29
+ def self.find_art(art_name, art_type: nil, art_path: nil, art_section: nil, bmp_type: nil)
30
+ # ...
31
+ end
32
+ end
33
+ ```
34
+
35
+ The 'art_name' argument should provide the base name for matching art files and can be specified as either
36
+ String or Symbol.
37
+
38
+ ## Storage locations
39
+
40
+ Wx::ArtLocator defines a standardized directory structure that is assumed to be used for application art
41
+ file storage.
42
+ Working from a certain (application defined) base search path ('art_path' argument) this structure looks like this:
43
+
44
+ <art_path>
45
+ \art
46
+ \<art_section>
47
+ \<art_type>
48
+
49
+ Where '<art_path>' is an application supplied search path, 'art' is the default name for Art folders (this can be overridden by an application specific name),
50
+ '<art_section>' is an application defined id allowing sub-categorizing art and '<art_type>' is the type of art indicator
51
+ (which can be 'icon', 'bitmap', 'cursor', 'image').
52
+ Art files can be located at any level in this hierarchy and all sub levels in this hierarchy are optional.
53
+ When locating files the art locator will test a file's existence at all levels starting with the
54
+ deepest level working it's way up returning the absolute path of the first file found this way.
55
+
56
+ So locating an art file would involve testing for the file at the following paths:
57
+ 1. \<art_path>/art/<art_section>/<art_type>/
58
+ 2. \<art_path>/art/<art_section>/
59
+ 3. \<art_path>/art/
60
+ 4. \<art_path>/
61
+
62
+ The first location can be skipped by specifying `nil` for 'art_type'.
63
+
64
+ ## Bitmap types
65
+
66
+ Based on platform and specified '<art_type>' (and optionally a specific Wx::BitmapType) art files with a specific
67
+ range of extensions will be tested in a specific order.
68
+ For example for locating an `:icon` (<art_type>) on platform 'WXGTK' the locator will test the preferred extension
69
+ '.xpm' followed by any of supported extensions of all other supported bitmap types.
70
+ For platform 'WXMSW' however the same search would test only the extensions '.ico' and '.xpm' (in that
71
+ order).
72
+ Specifying a specific Wx::BitmapType for a search will restrict the search to testing only the extensions supported
73
+ for the specified Wx::BitmapType.
74
+
75
+ ## Search paths
76
+
77
+ To prevent having to specify base search path for every location request Wx::Locator provides 2 options.
78
+
79
+ When an explicit specification of a base search path ('art_path) is omitted from a location request the locator
80
+ will determine one by using `Kernel#caller_locations` to extract the absolute path for the source file containing
81
+ the caller's code. The result of `File.dirname(src_path)` is than used as base search path.
82
+ If 'art_section' is also omitted the result of `File.basename(src_path, '.*')` will be used instead.
83
+
84
+ This means that calling `Wx::ArtLocator.find_art` from some code in file `/some/lib/path/to/ruby/code.rb` without
85
+ specifying both 'art_path' and 'art_section' would result in looking for an art file with the base search path
86
+ being `/some/lib/path/to/ruby/` and using `code` as 'art_section'.
87
+
88
+ It is also possible to add 'application global' search paths with the method `Wx::ArtLocator.add_search_path`.
89
+ Search paths added in this way will be tested after failing to find any matching art file at the initial 'art_path'
90
+ location. The same location steps apply to these search paths as with the initial 'art_path' (see above).
91
+
92
+ ## Convenience methods
93
+
94
+ Based on the Wx::ArtLocator implementation wxRuby additionally provides a number of convenience methods to
95
+ easily create Icons, Bitmaps, Cursors and Images from simple ids (symbols).
96
+ These methods mimic the ease of use of the `wxICON` and `wxBITMAP` macros used with C++ wxWidgets such that
97
+ creating an Wx::Icon instance could be as easy as:
98
+
99
+ ```ruby
100
+ frame.icon = Wx::Icon(:sample)
101
+ ```
102
+
103
+ As these methods apply the same search path 'automagic' as `Wx::ArtLocator.find_art` (see [Search paths](#Search-paths))
104
+ this would search for an art file with base name 'sample' and an appropriate extension (like '.xpm' for the 'WXGTK' platform)
105
+ in a location starting at the directory in which the caller's code is stored (applying the steps described above).
@@ -0,0 +1,21 @@
1
+
2
+ class Wx
3
+
4
+ class GCDC < Wx::DC
5
+
6
+ private :initialize
7
+
8
+ # Creates a Wx::GCDC instance for target and
9
+ # passes the instance to the given block to draw on.
10
+ # @overload draw_on(dc)
11
+ # @param [Wx::WindowDC,Wx::MemoryDC,Wx::PrinterDC] target DC to draw on
12
+ # @yieldparam [Wx::GCDC] dc GCDC instance to draw on
13
+ # @return [Object] result from block
14
+ # @overload draw_on(dc)
15
+ # @param [Wx::GraphicsContext] gc GraphicsContext to draw on
16
+ # @yieldparam [Wx::GCDC] dc GCDC instance to draw on
17
+ # @return [Object] result from block
18
+ def self.draw_on(arg) end
19
+ end
20
+
21
+ end