wxruby 1.9.6-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (239) hide show
  1. data/LICENSE +53 -0
  2. data/README +297 -0
  3. data/lib/wx/accessors.rb +52 -0
  4. data/lib/wx/classes/acceleratortable.rb +28 -0
  5. data/lib/wx/classes/animation.rb +18 -0
  6. data/lib/wx/classes/app.rb +45 -0
  7. data/lib/wx/classes/artprovider.rb +31 -0
  8. data/lib/wx/classes/bitmap.rb +28 -0
  9. data/lib/wx/classes/busycursor.rb +12 -0
  10. data/lib/wx/classes/checklistbox.rb +45 -0
  11. data/lib/wx/classes/choice.rb +4 -0
  12. data/lib/wx/classes/clientdc.rb +13 -0
  13. data/lib/wx/classes/clipboard.rb +16 -0
  14. data/lib/wx/classes/colour.rb +47 -0
  15. data/lib/wx/classes/combobox.rb +4 -0
  16. data/lib/wx/classes/commandevent.rb +7 -0
  17. data/lib/wx/classes/controlwithitems.rb +10 -0
  18. data/lib/wx/classes/dc.rb +57 -0
  19. data/lib/wx/classes/event.rb +5 -0
  20. data/lib/wx/classes/evthandler.rb +921 -0
  21. data/lib/wx/classes/font.rb +118 -0
  22. data/lib/wx/classes/functions.rb +44 -0
  23. data/lib/wx/classes/gauge.rb +12 -0
  24. data/lib/wx/classes/grid.rb +138 -0
  25. data/lib/wx/classes/helpcontroller.rb +5 -0
  26. data/lib/wx/classes/htmlhelpcontroller.rb +5 -0
  27. data/lib/wx/classes/htmlwindow.rb +14 -0
  28. data/lib/wx/classes/icon.rb +21 -0
  29. data/lib/wx/classes/iconbundle.rb +3 -0
  30. data/lib/wx/classes/image.rb +31 -0
  31. data/lib/wx/classes/imagelist.rb +3 -0
  32. data/lib/wx/classes/listbox.rb +4 -0
  33. data/lib/wx/classes/listctrl.rb +21 -0
  34. data/lib/wx/classes/locale.rb +28 -0
  35. data/lib/wx/classes/mediactrl.rb +22 -0
  36. data/lib/wx/classes/menu.rb +62 -0
  37. data/lib/wx/classes/menuitem.rb +7 -0
  38. data/lib/wx/classes/object.rb +7 -0
  39. data/lib/wx/classes/paintdc.rb +12 -0
  40. data/lib/wx/classes/point.rb +48 -0
  41. data/lib/wx/classes/previewframe.rb +13 -0
  42. data/lib/wx/classes/rect.rb +10 -0
  43. data/lib/wx/classes/size.rb +49 -0
  44. data/lib/wx/classes/sound.rb +23 -0
  45. data/lib/wx/classes/styledtextctrl.rb +92 -0
  46. data/lib/wx/classes/textctrl.rb +14 -0
  47. data/lib/wx/classes/texturlevent.rb +6 -0
  48. data/lib/wx/classes/timer.rb +94 -0
  49. data/lib/wx/classes/toolbartool.rb +4 -0
  50. data/lib/wx/classes/treectrl.rb +44 -0
  51. data/lib/wx/classes/window.rb +82 -0
  52. data/lib/wx/classes/xmlresource.rb +37 -0
  53. data/lib/wx/keyword_ctors.rb +222 -0
  54. data/lib/wx/keyword_defs.rb +492 -0
  55. data/lib/wx/version.rb +3 -0
  56. data/lib/wx.rb +42 -0
  57. data/lib/wxruby2.exp +0 -0
  58. data/lib/wxruby2.lib +0 -0
  59. data/lib/wxruby2.so +0 -0
  60. data/lib/wxruby2.so.manifest +13 -0
  61. data/samples/SAMPLES-LICENSE.TXT +18 -0
  62. data/samples/aui/aui.rb +1356 -0
  63. data/samples/bigdemo/About.rbw +39 -0
  64. data/samples/bigdemo/ColorPanel.rbw +23 -0
  65. data/samples/bigdemo/GridSimple.rbw +78 -0
  66. data/samples/bigdemo/MDIDemo.rbw +57 -0
  67. data/samples/bigdemo/PopupMenu.rbw +149 -0
  68. data/samples/bigdemo/ShapedWindow.rbw +131 -0
  69. data/samples/bigdemo/Sizers.rbw +543 -0
  70. data/samples/bigdemo/bigdemo.rb +823 -0
  71. data/samples/bigdemo/demoTemplate.rbw +33 -0
  72. data/samples/bigdemo/helpfile.htb +0 -0
  73. data/samples/bigdemo/icons/Test 015.jpg +0 -0
  74. data/samples/bigdemo/icons/Test 015.png +0 -0
  75. data/samples/bigdemo/icons/choice.bmp +0 -0
  76. data/samples/bigdemo/icons/choice.xpm +27 -0
  77. data/samples/bigdemo/icons/combo.bmp +0 -0
  78. data/samples/bigdemo/icons/combo.xpm +27 -0
  79. data/samples/bigdemo/icons/copy.xpm +25 -0
  80. data/samples/bigdemo/icons/cut.xpm +24 -0
  81. data/samples/bigdemo/icons/gauge.bmp +0 -0
  82. data/samples/bigdemo/icons/gauge.xpm +27 -0
  83. data/samples/bigdemo/icons/help.xpm +25 -0
  84. data/samples/bigdemo/icons/list.bmp +0 -0
  85. data/samples/bigdemo/icons/list.xpm +27 -0
  86. data/samples/bigdemo/icons/mondrian.ico +0 -0
  87. data/samples/bigdemo/icons/mondrian.xpm +44 -0
  88. data/samples/bigdemo/icons/new.xpm +24 -0
  89. data/samples/bigdemo/icons/ogl.ico +0 -0
  90. data/samples/bigdemo/icons/ogl.xpm +45 -0
  91. data/samples/bigdemo/icons/open.xpm +26 -0
  92. data/samples/bigdemo/icons/paste.bmp +0 -0
  93. data/samples/bigdemo/icons/paste.xpm +38 -0
  94. data/samples/bigdemo/icons/pointy.png +0 -0
  95. data/samples/bigdemo/icons/preview.xpm +26 -0
  96. data/samples/bigdemo/icons/print.xpm +26 -0
  97. data/samples/bigdemo/icons/radio.bmp +0 -0
  98. data/samples/bigdemo/icons/radio.xpm +27 -0
  99. data/samples/bigdemo/icons/robert.xpm +415 -0
  100. data/samples/bigdemo/icons/ruby.png +0 -0
  101. data/samples/bigdemo/icons/sashtest.ico +0 -0
  102. data/samples/bigdemo/icons/save.xpm +25 -0
  103. data/samples/bigdemo/icons/smiles.bmp +0 -0
  104. data/samples/bigdemo/icons/smiles.xpm +39 -0
  105. data/samples/bigdemo/icons/smiley.ico +0 -0
  106. data/samples/bigdemo/icons/smiley.xpm +42 -0
  107. data/samples/bigdemo/icons/stattext.xpm +24 -0
  108. data/samples/bigdemo/icons/test2.bmp +0 -0
  109. data/samples/bigdemo/icons/test2.png +0 -0
  110. data/samples/bigdemo/icons/test2.xpm +79 -0
  111. data/samples/bigdemo/icons/text.bmp +0 -0
  112. data/samples/bigdemo/icons/text.xpm +27 -0
  113. data/samples/bigdemo/icons/tog1.bmp +0 -0
  114. data/samples/bigdemo/icons/tog1.xpm +38 -0
  115. data/samples/bigdemo/icons/tog2.bmp +0 -0
  116. data/samples/bigdemo/icons/tog2.xpm +38 -0
  117. data/samples/bigdemo/icons/wxwin.ico +0 -0
  118. data/samples/bigdemo/icons/wxwin16x16.png +0 -0
  119. data/samples/bigdemo/icons/wxwin16x16.xpm +25 -0
  120. data/samples/bigdemo/icons/wxwin32x32.png +0 -0
  121. data/samples/bigdemo/icons/wxwin48x48.png +0 -0
  122. data/samples/bigdemo/run.rb +90 -0
  123. data/samples/bigdemo/tips.txt +7 -0
  124. data/samples/bigdemo/utils.rb +12 -0
  125. data/samples/bigdemo/wxArtProvider.rbw +281 -0
  126. data/samples/bigdemo/wxBitmapButton.rbw +65 -0
  127. data/samples/bigdemo/wxButton.rbw +64 -0
  128. data/samples/bigdemo/wxCalendarCtrl.rbw +60 -0
  129. data/samples/bigdemo/wxCheckBox.rbw +50 -0
  130. data/samples/bigdemo/wxCheckListBox.rbw +75 -0
  131. data/samples/bigdemo/wxChoice.rbw +47 -0
  132. data/samples/bigdemo/wxChoicebook.rbw +78 -0
  133. data/samples/bigdemo/wxColourDialog.rbw +31 -0
  134. data/samples/bigdemo/wxComboBox.rbw +77 -0
  135. data/samples/bigdemo/wxCursor.rbw +136 -0
  136. data/samples/bigdemo/wxDialog.rbw +74 -0
  137. data/samples/bigdemo/wxDirDialog.rbw +29 -0
  138. data/samples/bigdemo/wxDragImage.rbw +70 -0
  139. data/samples/bigdemo/wxFileDialog.rbw +37 -0
  140. data/samples/bigdemo/wxFileDialog_Save.rbw +35 -0
  141. data/samples/bigdemo/wxFindReplaceDialog.rbw +82 -0
  142. data/samples/bigdemo/wxFontDialog.rbw +173 -0
  143. data/samples/bigdemo/wxFrame.rbw +53 -0
  144. data/samples/bigdemo/wxGauge.rbw +71 -0
  145. data/samples/bigdemo/wxGenericDirCtrl.rbw +74 -0
  146. data/samples/bigdemo/wxGrid.rbw +66 -0
  147. data/samples/bigdemo/wxHtmlHelpController.rbw +52 -0
  148. data/samples/bigdemo/wxListBox.rbw +140 -0
  149. data/samples/bigdemo/wxListCtrl_virtual.rbw +107 -0
  150. data/samples/bigdemo/wxMDIWindows.rbw +50 -0
  151. data/samples/bigdemo/wxMenu.rbw +236 -0
  152. data/samples/bigdemo/wxMessageDialog.rbw +27 -0
  153. data/samples/bigdemo/wxMiniFrame.rbw +70 -0
  154. data/samples/bigdemo/wxMultipleChoiceDialog.rbw +32 -0
  155. data/samples/bigdemo/wxNotebook.rbw +136 -0
  156. data/samples/bigdemo/wxProgressDialog.rbw +43 -0
  157. data/samples/bigdemo/wxRadioBox.rbw +72 -0
  158. data/samples/bigdemo/wxRadioButton.rbw +125 -0
  159. data/samples/bigdemo/wxSashWindow.rbw +141 -0
  160. data/samples/bigdemo/wxScrolledMessageDialog.rbw +57 -0
  161. data/samples/bigdemo/wxScrolledWindow.rbw +199 -0
  162. data/samples/bigdemo/wxSingleChoiceDialog.rbw +33 -0
  163. data/samples/bigdemo/wxSlider.rbw +42 -0
  164. data/samples/bigdemo/wxSpinButton.rbw +50 -0
  165. data/samples/bigdemo/wxSpinCtrl.rbw +51 -0
  166. data/samples/bigdemo/wxSplitterWindow.rbw +63 -0
  167. data/samples/bigdemo/wxStaticBitmap.rbw +51 -0
  168. data/samples/bigdemo/wxStaticText.rbw +55 -0
  169. data/samples/bigdemo/wxStatusBar.rbw +126 -0
  170. data/samples/bigdemo/wxTextCtrl.rbw +149 -0
  171. data/samples/bigdemo/wxTextEntryDialog.rbw +31 -0
  172. data/samples/bigdemo/wxToggleButton.rbw +49 -0
  173. data/samples/bigdemo/wxToolBar.rbw +131 -0
  174. data/samples/bigdemo/wxTreeCtrl.rbw +190 -0
  175. data/samples/calendar/calendar.rb +271 -0
  176. data/samples/caret/caret.rb +282 -0
  177. data/samples/caret/mondrian.xpm +44 -0
  178. data/samples/controls/controls.rb +1136 -0
  179. data/samples/controls/get_item_sample.rb +87 -0
  180. data/samples/controls/icons/choice.xpm +27 -0
  181. data/samples/controls/icons/combo.xpm +27 -0
  182. data/samples/controls/icons/gauge.xpm +27 -0
  183. data/samples/controls/icons/list.xpm +27 -0
  184. data/samples/controls/icons/radio.xpm +27 -0
  185. data/samples/controls/icons/stattext.xpm +24 -0
  186. data/samples/controls/icons/text.xpm +27 -0
  187. data/samples/controls/mondrian.ico +0 -0
  188. data/samples/controls/mondrian.xpm +44 -0
  189. data/samples/controls/test2.bmp +0 -0
  190. data/samples/dialogs/dialogs.rb +723 -0
  191. data/samples/dialogs/tips.txt +18 -0
  192. data/samples/drawing/graphics_drawing.rb +235 -0
  193. data/samples/drawing/images.rb +37 -0
  194. data/samples/drawing/paperclip.png +0 -0
  195. data/samples/etc/activation.rb +102 -0
  196. data/samples/etc/choice.rb +67 -0
  197. data/samples/etc/miniframe.rb +79 -0
  198. data/samples/etc/sash.rb +130 -0
  199. data/samples/etc/scrollwin.rb +110 -0
  200. data/samples/etc/system_settings.rb +252 -0
  201. data/samples/etc/threaded.rb +72 -0
  202. data/samples/etc/wizard.rb +74 -0
  203. data/samples/event/event.rb +182 -0
  204. data/samples/grid/grid.rb +198 -0
  205. data/samples/grid/gridtablebase.rb +134 -0
  206. data/samples/html/html.rb +262 -0
  207. data/samples/listbook/listbook.rb +174 -0
  208. data/samples/listbook/listbook.xrc +370 -0
  209. data/samples/mdi/mdi.rb +82 -0
  210. data/samples/media/mediactrl.rb +167 -0
  211. data/samples/minimal/minimal.rb +77 -0
  212. data/samples/minimal/mondrian.ico +0 -0
  213. data/samples/minimal/mondrian.png +0 -0
  214. data/samples/minimal/nothing.rb +16 -0
  215. data/samples/opengl/cube.rb +117 -0
  216. data/samples/printing/mondrian.ico +0 -0
  217. data/samples/printing/mondrian.xpm +44 -0
  218. data/samples/printing/printing.rb +310 -0
  219. data/samples/sockets/SocketPackets.rb +27 -0
  220. data/samples/sockets/res/message-new.png +0 -0
  221. data/samples/sockets/res/user.png +0 -0
  222. data/samples/sockets/wxClient.rb +395 -0
  223. data/samples/sockets/wxServer.rb +422 -0
  224. data/samples/sockets/wxSocketGUI.rb +97 -0
  225. data/samples/text/mondrian.ico +0 -0
  226. data/samples/text/mondrian.xpm +44 -0
  227. data/samples/text/scintilla.rb +169 -0
  228. data/samples/text/textctrl.rb +113 -0
  229. data/samples/text/unicode.rb +242 -0
  230. data/samples/text/utf8.txt +15 -0
  231. data/samples/treectrl/icon1.xpm +79 -0
  232. data/samples/treectrl/icon2.xpm +53 -0
  233. data/samples/treectrl/icon3.xpm +79 -0
  234. data/samples/treectrl/icon4.xpm +43 -0
  235. data/samples/treectrl/icon5.xpm +79 -0
  236. data/samples/treectrl/treectrl.rb +1174 -0
  237. data/samples/xrc/samples.xrc +46 -0
  238. data/samples/xrc/xrc_sample.rb +96 -0
  239. metadata +316 -0
data/LICENSE ADDED
@@ -0,0 +1,53 @@
1
+ wxRuby2
2
+ Copyright (c) 2004-2007 wxRuby Development Team
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+
22
+
23
+
24
+
25
+
26
+
27
+ ============================================================================
28
+ THE FOLLOWING IS NOT PART OF THE LICENSE, NOR IS IT LEGAL ADVICE!
29
+
30
+ wxRuby and wxWidgets
31
+ --------------------
32
+ Normally, wxRuby is distributed with a binary copy of wxWidgets. If you
33
+ distribute the wxRuby gem, you are bound to the requirements of the
34
+ copy of wxWidgets within. Fortunately, those requirements do not impose
35
+ any serious restrictions.
36
+
37
+
38
+ wxWidgets License Summary (from the wxWidgets README)
39
+ -----------------------------------------------------
40
+ In summary, the licence is LGPL plus a clause allowing unrestricted
41
+ distribution of application binaries. To answer a FAQ, you don't have to
42
+ distribute any source if you wish to write commercial applications using
43
+ wxWidgets.
44
+
45
+
46
+ Required Credits and Attribution
47
+ --------------------------------
48
+
49
+ Generally, neither wxWidgets nor wxRuby require attribution, beyond
50
+ retaining existing copyright notices. However, if you build your own
51
+ custom wxWidgets library, there may be portions that require specific
52
+ attributions or credits, such as TIFF or JPEG support. See the wxWidgets
53
+ README and license files for details.
data/README ADDED
@@ -0,0 +1,297 @@
1
+ README for wxruby2
2
+
3
+ Version 1.9.x
4
+
5
+ This is wxruby2, the second generation of wxRuby, a library
6
+ that allows Ruby programs to use the wxWidgets GUI toolkit.
7
+ It is released under a permissive MIT-style license
8
+ (see the LICENSE file for details).
9
+
10
+ This version is a beta release, in preparation for a stable release of
11
+ wxruby version 2.0.
12
+
13
+ ------------------------FAQ---------------------------
14
+
15
+ - What platforms and operating systems are supported in wxRuby2?
16
+
17
+ Currently the following are fully supported:
18
+
19
+ Windows NT/2000/XP/Vista (i686)
20
+ OS X 10.4+ (i686 and PowerPc)
21
+ Linux (i686 + AMD-64)
22
+
23
+ It is unlikely that support for old Windows OS's (3.1, 95, 98, ME)
24
+ will be added to wxRuby2 in the near future, as these operating
25
+ systems have very limited support for Unicode.
26
+
27
+ - Why would I choose wxruby over FXRuby, Ruby/GTK, or one of the other
28
+ GUI toolkits? Isn't wxruby arriving "too late"?
29
+
30
+ There are several great GUI toolkits available for Ruby, but we
31
+ like wxruby better because it has a combination of features that no
32
+ other toolkit has:
33
+
34
+ - Cross-platform (MSWindows, Mac OS X, Linux)
35
+ - Native widgets when possible
36
+ - Provides a wide selection of widgets
37
+ - Simple license that is compatible with proprietary and Free Software
38
+ - Mature foundation (wxWidgets has been around for over 10 years)
39
+
40
+ The really big feature is native widgets. The only other cross-platform
41
+ toolkits that use native widgets are either limited (Tk) or expensive if
42
+ you want to develop proprietary software (Qt). We are not saying that
43
+ those toolkits are bad! Just that wxruby offers a unique set of
44
+ features.
45
+
46
+ - Why are native widgets important or helpful?
47
+
48
+ For one thing, it means that end-users do not have to adjust to a
49
+ "foreign" interface. It also ensures maximum compatibility with
50
+ "assistive technology" such as screen readers for blind users.
51
+ It also allows apps to respect any themes the user may have chosen
52
+ through their operating system. No matter how hard a toolkit may try
53
+ to emulate a particular UI, there will always be differences in the
54
+ look or behavior.
55
+
56
+ - How does wxruby2 relate to wxruby (and the wxruby 0.6.0 release)?
57
+
58
+ wxruby2 is the "next generation" of wxruby. It is being developed
59
+ by the same wxruby team, and is intended to replace the older
60
+ code base. wxruby2 is built using SWIG, a powerful tool that makes
61
+ it much easier to create and maintain wrappers around C/C++ libraries.
62
+
63
+ - Why should I use wxruby2 instead of wxruby?
64
+
65
+ First, because development on the original wxruby codebase has stopped.
66
+ Everyone is working on wxruby2, so it will continue to improve. Beyond
67
+ that, wxruby2 has these advantages over wxruby 0.6.0:
68
+
69
+ - Available as binary gems for MSWindows, OS X, and Linux (GTK)
70
+ - Support for more classes, and more methods within classes
71
+ - Unicode support
72
+ - Vastly improved support for OS X
73
+ - Looks much better under Linux because it uses GTK+2
74
+ - Simpler and more permissive license
75
+ - Wraps wxWidgets 2.8.7 instead of the older 2.4 series
76
+
77
+ - Is wxruby2 ready for "production" use?
78
+
79
+ Yes, pretty much. This is a beta release, and there may be some bugs
80
+ in some methods, or memory leaks. This release includes all the
81
+ classes and features that are proposed for inclusion in wxruby 2.0.
82
+
83
+ It is considerably more stable and fully-featured than the old 0.6.0
84
+ release, which was never really stable enough for heavy-duty
85
+ production use.
86
+
87
+ - Does wxruby2 support the Xxx class?
88
+
89
+ See the "Documentation" section of the README file, or check the
90
+ wxruby web site: http://wxruby.org
91
+
92
+ - How are the wxruby 0.6.0 and wxruby2 licenses different?
93
+
94
+ wxruby 0.6.0 was released under the wxWindows license, which is a
95
+ modified LGPL. It is a good, fair license, allowing use in both Free
96
+ Software and proprietary applications. However, it is long and complex,
97
+ and is more appropriate for compiled code. wxruby2 is available under a
98
+ *very* simple MIT-style license, which allows just about any use with
99
+ very few restrictions.
100
+
101
+ - I am getting an error trying to compile wxruby2
102
+
103
+ Please double-check the requirements. You may be using the wrong
104
+ version of SWIG, wxWidgets, or some other tool. Double-check the
105
+ instructions on the wxRuby wiki (http://wxruby.rubyforge.org/)
106
+
107
+ If you need help, please ask your question on the wxruby mailing list
108
+ (see the link at http://wxruby.org).
109
+
110
+ - I am getting an error trying to run any wxruby2 application, such as
111
+ the samples that are included in the gem.
112
+
113
+ If you are using Linux, be sure you have configured your system to
114
+ have RUBYOPT=-rubygems. This can be done in .bashrc or /etc/environment,
115
+ depending on your distribution and preferences. [More details to follow].
116
+
117
+ - Why aren't the wx network, file, date, database and other non-GUI
118
+ classes supported?
119
+
120
+ Because Ruby has its own versions of each of them, providing
121
+ cross-platform abstractions of these functions with familiar syntax
122
+ and methods. We assume you are writing your application in Ruby, so it
123
+ makes sense to keep as much code as possible in Ruby. We have only
124
+ wrapped the wx classes that are necessary to write GUI code.
125
+
126
+ There may be some advantages to porting the Wx network classes into
127
+ ruby, if they work better with multi-(native)-threaded code. This is
128
+ currently under evaluation.
129
+
130
+ - Why has it taken so long for wxruby2 to be released?
131
+
132
+ Nobody is getting paid to develop wxruby, so each of the wxruby developers
133
+ are limited in the amount of time they can dedicate to the project. We are
134
+ always looking for more volunteers to help code, test, document, manage
135
+ the bug list, handle publicity, or do other necessary chores.
136
+
137
+ Wrapping wx is a big project that requires a wide variety of skills. As of
138
+ February 2008, the wxRuby project has over 100,000 lines of code, including
139
+ ruby, C++, and SWIG scripts. If we weren't using SWIG it would be far bigger.
140
+
141
+
142
+ For more details, see the project home page:
143
+ http://wxruby.org/
144
+
145
+
146
+ ------------------------USING WXRUBY---------------------------
147
+ INSTALLING:
148
+
149
+ wxRuby is available as binary gems for MS Windows, Mac OS X, and Linux
150
+ with GTK+ 2. Unless you wish to work on wxRuby itself, we strongly
151
+ recommend installing the gem rather than building from source.
152
+
153
+ REQUIREMENTS TO CREATE AND RUN WXRUBY APPS:
154
+
155
+ - Ruby 1.8
156
+ - MS Windows NT/2000/XP/Vista, Mac OS X 10.4+, or Linux with GTK+ 2,
157
+
158
+ - On Windows, gdiplus.pll and msvcp71.dll. These are available on most
159
+ systems, but can be downloaded and installed for free from the
160
+ internet
161
+ - On Linux, libgstreamer. This can be installed from most package sources
162
+
163
+ SAMPLES:
164
+
165
+ There is a samples/ directory containing many small sample wxRuby apps
166
+ that demonstrate how to use various classes. A few samples do not work
167
+ across all platforms at this time.
168
+
169
+ The bigdemo sample is fairly comprehensive, but not all of the
170
+ sections work on all platforms.
171
+
172
+
173
+ WRITING YOUR OWN WXRUBY APP:
174
+
175
+ To use wxruby-swig in your app, use:
176
+ require 'wx'
177
+
178
+ samples/minimal.rb can be used as a template for creating your
179
+ own wxruby application.
180
+
181
+
182
+ DOCUMENTATION:
183
+
184
+ - wxRuby-specific API documentation can be found here:
185
+
186
+ http://wxruby.org/doc/
187
+
188
+ (Note: This documentation is auto-generated from the C++ wxWidgets API
189
+ docs. There are some broken links, some sample code in C++, and some
190
+ sections which do not apply to ruby. The documentation is continually
191
+ being improved.)
192
+
193
+ - The latest version of the documentation can be downloaded from the
194
+ wxRuby 'Files' section on Rubyforge.
195
+
196
+ http://www.rubyforge.org/frs/?group_id=35
197
+
198
+ - Tables summarizing which wx classes are and are not supported can
199
+ be found here:
200
+
201
+ http://wxruby.org/wiki/wiki.pl?ClassesSupportedByCategory
202
+
203
+ - Most wxWidgets and wxPython tutorials and references can also be used, if
204
+ you remember that wxRuby uses ruby_style_naming for methods and variables
205
+ instead of MixedCase as used by wxWidgets.
206
+
207
+
208
+
209
+ API DIFFERENCES FROM WXWIDGETS:
210
+ - In many cases, wxRuby follows the lead of wxPython (or in some cases,
211
+ wxPerl), adjusting certain method calls when the C++ style doesn't fit
212
+ dynamic languages.
213
+ - Since initialize is reserved in ruby, use SplitterWindow#init instead.
214
+ - Many wx classes have not been wrapped because native ruby classes work
215
+ as well or better. These include wxDateTime, wxString, networking
216
+ classes, database classes.
217
+ - log_message and log_status take a single string parameter,
218
+ rather than a format string followed by additional values
219
+ to be inserted. Use Ruby's sprintf if required.
220
+
221
+ ----------------------COMPILING WXRUBY--------------------------
222
+ REQUIREMENTS TO COMPILE/BUILD WXRUBY ITSELF
223
+
224
+ - rake
225
+ - SWIG, version 1.3.32 or later. Earlier versions will not work correctly.
226
+ - wxWidgets 2.8.x SDK. See further information on the wxruby website for
227
+ recommended compile-time options for wxWidgets.
228
+
229
+
230
+ OBTAINING THE SOURCE:
231
+
232
+ Source code is hosted in Subversion at rubyforge.org. See the links on
233
+ the wxruby web site (http://wxruby.org). Check out the wxruby2
234
+ Subversion module (not the old wxruby module).
235
+
236
+
237
+ BUILDING:
238
+
239
+ From the top-level directory (typically wxruby2/),
240
+ just start the rake build with the command:
241
+
242
+ rake
243
+
244
+ There is no ./configure step, nor do you need to run ruby extconf.rb.
245
+
246
+
247
+ INSTALLING THE LIBRARY:
248
+
249
+ You can install the library using:
250
+ rake install
251
+
252
+ Note that on some systems you may need to be "root" to do this.
253
+ To manually install, copy all the files in the lib/ subdirectory
254
+ to somewhere on your ruby library path, such as a ruby extensions
255
+ directory.
256
+
257
+
258
+ PORTING TO OTHER PLATFORMS
259
+
260
+ Platform-dependent rakefiles are used to set up compiler-specific
261
+ settings. The following platforms are currently fully supported:
262
+
263
+ Mac OSX (gcc): rakemacosx.rb
264
+ MS Windows (VC++): rakemswin.rb
265
+ Linux (GTK2 + gcc): rakelinux.rb
266
+
267
+ For other platforms, you may need to edit the appropriate
268
+ platform-dependent rake file if your system is not yet supported, or if
269
+ it is unusual. These files are found in the rake subdirectory:
270
+
271
+ MS Windows BC++: rakebccwin.rb
272
+ MS Windows MingGW: rakemingw.rb
273
+ MS Windows Cygwin: rakecygwin.rb
274
+ NetBSD: rakenetbsd.rb
275
+
276
+ When editing a platform-dependent rakefile, you might
277
+ merely need to set one or more of the following variables:
278
+
279
+ $extra_cppflags
280
+ $extra_ldflags
281
+ $extra_objs
282
+ $extra_libs
283
+
284
+
285
+ CREDITS
286
+
287
+ Kevin Smith set up the wxruby2 project using SWIG and did much of the
288
+ work that still forms the core of the library in its present form. Over
289
+ the years dozens of volunteers have contributed invaluable patches and
290
+ new functionality. The list is too long to give here, but their
291
+ contributions are recorded in the wxruby mailing list archives.
292
+
293
+ -----------------------------------------------------------
294
+
295
+ LEAD MAINTAINER:
296
+ Alex Fenton
297
+ alex at pressure dot to
@@ -0,0 +1,52 @@
1
+ # = WxSugar - Accessors
2
+ #
3
+ # The default WxRuby interface has lots and lots of methods like
4
+ #
5
+ # * get_position()
6
+ # * set_size(a_size)
7
+ # * is_checked()
8
+ #
9
+ # and so on. Methods that retrieve set, or query attributes of an object
10
+ # are more normally in Ruby called simply by the attribute name:
11
+ #
12
+ # * position()
13
+ # * size = a_size
14
+ # * checked?
15
+ #
16
+ # This extension creates an alias for every WxRuby instance method that
17
+ # begins with +get_+, +set_+ or +is_+. Note that if you are calling a
18
+ # 'setter' method on self, you must explicitly send the message to self:
19
+ #
20
+ # # set's self size to be 100px by 100px
21
+ # self.size = Wx::Size.new(100, 100)
22
+ # # only sets the value of a local variable 'size'
23
+ # size = Wx::Size.new
24
+
25
+ module WxRubyStyleAccessors
26
+ def method_missing(sym, *args)
27
+ case sym.to_s
28
+ when /^(.*)\=$/
29
+ meth = "set_#{$1}"
30
+ when /^(.*)\?$/
31
+ meth = "is_#{$1}"
32
+ else
33
+ meth = "get_#{sym}"
34
+ end
35
+ if respond_to?(meth)
36
+ send(meth, *args)
37
+ else
38
+ e = NoMethodError.new("undefined method '#{sym}' for #{self.inspect}")
39
+ e.set_backtrace(caller)
40
+ Kernel.raise e
41
+ end
42
+ end
43
+ end
44
+
45
+ all_classes = Wx::constants.collect { | c | Wx::const_get(c) }.grep(Class)
46
+
47
+ all_classes.each do | klass |
48
+ klass.class_eval do
49
+ include WxRubyStyleAccessors
50
+ extend WxRubyStyleAccessors
51
+ end
52
+ end
@@ -0,0 +1,28 @@
1
+ class Wx::AcceleratorTable
2
+ # Allow new to be called as []
3
+ class << self
4
+ alias :[] :new
5
+ end
6
+
7
+ # Allow initialize to be called with a splat-like list of arguments,
8
+ # and allow entries to be specified in terser form [mod, key, id]
9
+ # rather than full AcceleratorEntry.new call.
10
+ wx_init = self.instance_method(:initialize)
11
+ define_method(:initialize) do | *args |
12
+ # Test for old-style arg passing in a single array
13
+ if args.length == 1 and args.first.kind_of?(Array) and
14
+ args.first.all? { | e | e.kind_of?(Wx::AcceleratorEntry) }
15
+ args = args[0]
16
+ end
17
+ # Convert to array of AccEntries, to pass in as single array
18
+ args = args.map do | entry |
19
+ case entry
20
+ when Wx::AcceleratorEntry then entry
21
+ when Array then Wx::AcceleratorEntry.new(*entry)
22
+ else Kernel.raise ArgumentError,
23
+ "#{entry.inspect} is not a valid AcceleratorTable entry"
24
+ end
25
+ end
26
+ wx_init.bind(self).call(args)
27
+ end
28
+ end
@@ -0,0 +1,18 @@
1
+ class Wx::Animation < Wx::GDIObject
2
+ # Redefine the initialize method so it raises an exception if a
3
+ # non-existent file is given to the constructor; otherwise, wx Widgets
4
+ # just carries on with an empty bitmap, which may cause faults later
5
+ wx_init = self.instance_method(:initialize)
6
+ define_method(:initialize) do | *args |
7
+ if args[0].kind_of? String
8
+ if not File.exist?( File.expand_path(args[0]) )
9
+ Kernel.raise( ArgumentError,
10
+ "Animation file does not exist: #{args[0]}" )
11
+ end
12
+ res = wx_init.bind(self).call()
13
+ res.load_file(args[0], args[1] || Wx::ANIMATION_TYPE_ANY)
14
+ else
15
+ wx_init.bind(self).call(*args)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,45 @@
1
+ # Copyright 2004-2006 by Kevin Smith
2
+ # released under the MIT-style wxruby2 license
3
+
4
+ # Controller class which creates and manages all windows.
5
+ class Wx::App
6
+ # Convenience class method to create simple apps. Starts an
7
+ # application main_loop, setting up initial windows etc as specified
8
+ # in the passed block.
9
+ # block
10
+ def self.run(&block)
11
+ app_klass = Class.new(self)
12
+ app_klass.class_eval do
13
+ define_method(:on_init, &block)
14
+ end
15
+ the_app = app_klass.new
16
+ the_app.main_loop
17
+ end
18
+
19
+ # This is a class method in Wx, but permit it to be an instance method
20
+ # in wxRuby
21
+ def is_main_loop_running
22
+ Wx::App.is_main_loop_running
23
+ end
24
+
25
+ # This method handles failed assertions from within the WxWidgets C++
26
+ # code. These messages are only generated by a DEBUG build of
27
+ # WxRuby. Such messages usually indicate that the API is being used
28
+ # incorrectly; the file/line reference points to the place in the
29
+ # WxWidgets source code where the assertion was made.
30
+ define_method(:on_assert_failure) do | file, line, condition, message |
31
+ warn "Wx WARNING: #{message} (#{file}:#{line})"
32
+ end
33
+
34
+ # For use in development only, of no practical use in production code.
35
+ # This method causes Ruby's garbage collection to run (roughly) at
36
+ # interval +interval+ (seconds) - the default is 1, i.e. every
37
+ # second. This should help ferret out bugs in memory management more
38
+ # quickly.
39
+ def gc_stress(interval = 1)
40
+ t = Wx::Timer.new(self, 9999)
41
+ evt_timer(9999) { Thread.pass }
42
+ Thread.new { loop { sleep interval; GC.start } }
43
+ t.start(100)
44
+ end
45
+ end
@@ -0,0 +1,31 @@
1
+ # Class which can supply icons and bitmaps
2
+ class Wx::ArtProvider
3
+ # Keep a note of supplied ArtProviders to prevent them being GC'd
4
+ @__art_provs = []
5
+
6
+ class << self
7
+ wx_insert = instance_method(:insert)
8
+ define_method(:insert) do | art_prov |
9
+ wx_insert.bind(self).call(art_prov)
10
+ @__art_provs.unshift(art_prov)
11
+ end
12
+
13
+ wx_pop = instance_method(:pop)
14
+ define_method(:pop) do
15
+ wx_pop.bind(self).call
16
+ @__art_provs.pop
17
+ end
18
+
19
+ wx_push = instance_method(:push)
20
+ define_method(:push) do | art_prov |
21
+ wx_push.bind(self).call(art_prov)
22
+ @__art_provs.push(art_prov)
23
+ end
24
+
25
+ wx_remove = instance_method(:remove)
26
+ define_method(:remove) do | art_prov |
27
+ wx_push.bind(self).call(art_prov)
28
+ @__art_provs.delete(art_prov)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,28 @@
1
+ class Wx::Bitmap
2
+ # Constructor copying data from an image
3
+ def self.from_image(img, depth = -1)
4
+ new(img, depth)
5
+ end
6
+
7
+ # Redefine the initialize method so it raises an exception if a
8
+ # non-existent file is given to the constructor; otherwise, wx Widgets
9
+ # just carries on with an empty bitmap, which may cause faults later
10
+ wx_init = self.instance_method(:initialize)
11
+ define_method(:initialize) do | *args |
12
+ if args[0].kind_of? String
13
+ if not File.exist?( File.expand_path(args[0]) )
14
+ Kernel.raise(ArgumentError, "Bitmap file does not exist: #{args[0]}")
15
+ end
16
+ end
17
+ wx_init.bind(self).call(*args)
18
+ end
19
+
20
+ # Accepts a block, which will be passed a device context which can be
21
+ # used to draw upon the Bitmap
22
+ def draw
23
+ dc = Wx::MemoryDC.new
24
+ dc.select_object(self)
25
+ yield dc
26
+ dc.select_object( Wx::NULL_BITMAP )
27
+ end
28
+ end
@@ -0,0 +1,12 @@
1
+ # Emulates the wxWidgets BusyCursor class, by providing a scope within
2
+ # which a busy cursor will be shown
3
+ class Wx::BusyCursor
4
+ # Only one class method, optionally accepting a cursor that should be
5
+ # shown, defaulting to an hour glass cursor.
6
+ def self.busy(cursor = Wx::HOURGLASS_CURSOR)
7
+ Wx::begin_busy_cursor(cursor)
8
+ yield
9
+ ensure
10
+ Wx::end_busy_cursor
11
+ end
12
+ end
@@ -0,0 +1,45 @@
1
+ # A ListBox, where each item has a checkbox next to it
2
+ class Wx::CheckListBox
3
+ # wxRuby redefinitions of core methods to add item data support (not
4
+ # available in wxWidgets). Use a private method to initialize and
5
+ # access the data, rather than in initialize(), b/c can't guarantee
6
+ # that initialize will be called (eg when loaded from XRC)
7
+ def __wx_item_data
8
+ @__wx_item_data ||= []
9
+ end
10
+ private :__wx_item_data
11
+
12
+ # Call method in ControlWithItems, then sync item data
13
+ def append(item, data = nil)
14
+ super(item)
15
+ __wx_item_data[count - 1] = data
16
+ end
17
+
18
+ # Call method in ControlWithItems, then sync item data
19
+ def clear
20
+ super
21
+ __wx_item_data.clear
22
+ end
23
+
24
+ # delete is defined in Wx::CheckListBox, so must be called in this class
25
+ wx_delete = self.instance_method(:delete)
26
+ define_method(:delete) do | n |
27
+ wx_delete.bind(self).call(n)
28
+ __wx_item_data.delete_at(n)
29
+ end
30
+
31
+ # Returns an array of indices of items that are currently checked.
32
+ def get_checked_items
33
+ find_all { | i | checked?(i) }
34
+ end
35
+
36
+ # Wholly redefined here
37
+ def get_item_data(n)
38
+ __wx_item_data[n]
39
+ end
40
+
41
+ # Wholly redefined here
42
+ def set_item_data(n, data)
43
+ __wx_item_data[n] = data
44
+ end
45
+ end
@@ -0,0 +1,4 @@
1
+ class Wx::Choice
2
+ alias :get_item_data :get_client_data
3
+ alias :set_item_data :set_client_data
4
+ end
@@ -0,0 +1,13 @@
1
+ # Device Context to paint on a window outside an on_paint handler. It is
2
+ # recommended that PaintDC is used in preference to this class.
3
+ class Wx::ClientDC
4
+ # This class should not be instantiated directly in wxRuby; it should
5
+ # always be used via Window#paint, which takes a block receiving the
6
+ # DC. This ensures that the DC is cleaned up at the correct time,
7
+ # avoiding errors and segfaults on exit.
8
+ define_method(:initialize) do | *args |
9
+ Kernel.raise RuntimeError,
10
+ "Do not instantiate ClientDC directly; use Window#paint",
11
+ caller[1..-1]
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ class Wx::Clipboard
2
+ class << self
3
+ # Class method to provide access to the clipboard within a ruby
4
+ # block. Tests that the clipboard could be accessed, and ensures
5
+ # that it is closed when the block is finished.
6
+ def open
7
+ clip = Wx::Clipboard.new
8
+ unless clip.open
9
+ Kernel.raise "Could not open clipboard"
10
+ end
11
+ yield clip
12
+ ensure
13
+ clip.close
14
+ end
15
+ end
16
+ end