rwx 0.0.1.dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (376) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +49 -0
  3. data/COPYING +0 -0
  4. data/README.rdoc +0 -0
  5. data/Rakefile +100 -0
  6. data/VERSION +1 -0
  7. data/ext/extconf.rb +112 -0
  8. data/ext/main.cpp +432 -0
  9. data/ext/main.hpp +454 -0
  10. data/ext/rwx.cpp +472 -0
  11. data/ext/wxAboutDlg.cpp +213 -0
  12. data/ext/wxAboutDlg.hpp +19 -0
  13. data/ext/wxAnyButton.cpp +141 -0
  14. data/ext/wxAnyButton.hpp +17 -0
  15. data/ext/wxAnyChoiceDialog.cpp +93 -0
  16. data/ext/wxAnyChoiceDialog.hpp +19 -0
  17. data/ext/wxApp.cpp +205 -0
  18. data/ext/wxApp.hpp +48 -0
  19. data/ext/wxAui.hpp +19 -0
  20. data/ext/wxAuiBook.cpp +453 -0
  21. data/ext/wxAuiBook.hpp +21 -0
  22. data/ext/wxAuiManager.cpp +79 -0
  23. data/ext/wxAuiManager.hpp +18 -0
  24. data/ext/wxAuiPane.cpp +343 -0
  25. data/ext/wxAuiPane.hpp +29 -0
  26. data/ext/wxAuiToolBar.cpp +47 -0
  27. data/ext/wxAuiToolBar.hpp +17 -0
  28. data/ext/wxBitmap.cpp +368 -0
  29. data/ext/wxBitmap.hpp +60 -0
  30. data/ext/wxBitmapButton.cpp +82 -0
  31. data/ext/wxBitmapButton.hpp +17 -0
  32. data/ext/wxBitmapComboBox.cpp +284 -0
  33. data/ext/wxBitmapComboBox.hpp +22 -0
  34. data/ext/wxBitmapToggleButton.cpp +82 -0
  35. data/ext/wxBitmapToggleButton.hpp +17 -0
  36. data/ext/wxBookCtrl.cpp +633 -0
  37. data/ext/wxBookCtrl.hpp +22 -0
  38. data/ext/wxBoxSizer.cpp +60 -0
  39. data/ext/wxBoxSizer.hpp +17 -0
  40. data/ext/wxBrush.cpp +281 -0
  41. data/ext/wxBrush.hpp +28 -0
  42. data/ext/wxButton.cpp +85 -0
  43. data/ext/wxButton.hpp +17 -0
  44. data/ext/wxButtonToolBar.cpp +54 -0
  45. data/ext/wxButtonToolBar.hpp +21 -0
  46. data/ext/wxCalendarCtrl.cpp +91 -0
  47. data/ext/wxCalendarCtrl.hpp +17 -0
  48. data/ext/wxCalendarCtrlBase.cpp +55 -0
  49. data/ext/wxCalendarCtrlBase.hpp +26 -0
  50. data/ext/wxCalendarCtrlGeneric.cpp +102 -0
  51. data/ext/wxCalendarCtrlGeneric.hpp +21 -0
  52. data/ext/wxCheckBox.cpp +157 -0
  53. data/ext/wxCheckBox.hpp +17 -0
  54. data/ext/wxCheckListBox.cpp +191 -0
  55. data/ext/wxCheckListBox.hpp +20 -0
  56. data/ext/wxChoice.cpp +133 -0
  57. data/ext/wxChoice.hpp +30 -0
  58. data/ext/wxChoiceBook.cpp +90 -0
  59. data/ext/wxChoiceBook.hpp +23 -0
  60. data/ext/wxCollapsiblePane.cpp +110 -0
  61. data/ext/wxCollapsiblePane.hpp +21 -0
  62. data/ext/wxColor.cpp +435 -0
  63. data/ext/wxColor.hpp +38 -0
  64. data/ext/wxColorDialog.cpp +97 -0
  65. data/ext/wxColorDialog.hpp +19 -0
  66. data/ext/wxColorPicker.cpp +131 -0
  67. data/ext/wxColorPicker.hpp +20 -0
  68. data/ext/wxColorPickerWidget.cpp +105 -0
  69. data/ext/wxColorPickerWidget.hpp +20 -0
  70. data/ext/wxComboBox.cpp +214 -0
  71. data/ext/wxComboBox.hpp +22 -0
  72. data/ext/wxCommandEvent.cpp +45 -0
  73. data/ext/wxCommandEvent.hpp +16 -0
  74. data/ext/wxConfig.cpp +19 -0
  75. data/ext/wxConfig.hpp +17 -0
  76. data/ext/wxContextHelpButton.cpp +93 -0
  77. data/ext/wxContextHelpButton.hpp +21 -0
  78. data/ext/wxControl.cpp +90 -0
  79. data/ext/wxControl.hpp +15 -0
  80. data/ext/wxCursor.cpp +108 -0
  81. data/ext/wxCursor.hpp +25 -0
  82. data/ext/wxDC.cpp +252 -0
  83. data/ext/wxDC.hpp +18 -0
  84. data/ext/wxDataView.cpp +224 -0
  85. data/ext/wxDataView.hpp +45 -0
  86. data/ext/wxDataViewList.cpp +190 -0
  87. data/ext/wxDataViewList.hpp +17 -0
  88. data/ext/wxDatePicker.cpp +103 -0
  89. data/ext/wxDatePicker.hpp +22 -0
  90. data/ext/wxDialog.cpp +120 -0
  91. data/ext/wxDialog.hpp +17 -0
  92. data/ext/wxDirDialog.cpp +152 -0
  93. data/ext/wxDirDialog.hpp +20 -0
  94. data/ext/wxDirPicker.cpp +134 -0
  95. data/ext/wxDirPicker.hpp +28 -0
  96. data/ext/wxDirPickerWidget.cpp +127 -0
  97. data/ext/wxDirPickerWidget.hpp +20 -0
  98. data/ext/wxError.cpp +67 -0
  99. data/ext/wxError.hpp +17 -0
  100. data/ext/wxEvent.cpp +60 -0
  101. data/ext/wxEvent.hpp +17 -0
  102. data/ext/wxEvtHandler.cpp +291 -0
  103. data/ext/wxEvtHandler.hpp +85 -0
  104. data/ext/wxFileCtrl.cpp +98 -0
  105. data/ext/wxFileCtrl.hpp +17 -0
  106. data/ext/wxFileCtrlBase.cpp +219 -0
  107. data/ext/wxFileCtrlBase.hpp +33 -0
  108. data/ext/wxFileCtrlGeneric.cpp +106 -0
  109. data/ext/wxFileCtrlGeneric.hpp +19 -0
  110. data/ext/wxFileDialog.cpp +268 -0
  111. data/ext/wxFileDialog.hpp +19 -0
  112. data/ext/wxFileDirPicker.cpp +89 -0
  113. data/ext/wxFileDirPicker.hpp +29 -0
  114. data/ext/wxFileHistory.cpp +134 -0
  115. data/ext/wxFileHistory.hpp +20 -0
  116. data/ext/wxFilePicker.cpp +160 -0
  117. data/ext/wxFilePicker.hpp +28 -0
  118. data/ext/wxFilePickerWidget.cpp +139 -0
  119. data/ext/wxFilePickerWidget.hpp +20 -0
  120. data/ext/wxFont.cpp +542 -0
  121. data/ext/wxFont.hpp +37 -0
  122. data/ext/wxFontDialog.cpp +143 -0
  123. data/ext/wxFontDialog.hpp +21 -0
  124. data/ext/wxFontPicker.cpp +160 -0
  125. data/ext/wxFontPicker.hpp +21 -0
  126. data/ext/wxFontPickerWidget.cpp +128 -0
  127. data/ext/wxFontPickerWidget.hpp +20 -0
  128. data/ext/wxFrame.cpp +274 -0
  129. data/ext/wxFrame.hpp +17 -0
  130. data/ext/wxGauge.cpp +167 -0
  131. data/ext/wxGauge.hpp +17 -0
  132. data/ext/wxGrid.cpp +250 -0
  133. data/ext/wxGrid.hpp +43 -0
  134. data/ext/wxGridCellAttr.cpp +68 -0
  135. data/ext/wxGridCellAttr.hpp +26 -0
  136. data/ext/wxGridCellRenderer.cpp +120 -0
  137. data/ext/wxGridCellRenderer.hpp +30 -0
  138. data/ext/wxGridTable.cpp +111 -0
  139. data/ext/wxGridTable.hpp +47 -0
  140. data/ext/wxHyperLink.cpp +148 -0
  141. data/ext/wxHyperLink.hpp +20 -0
  142. data/ext/wxImage.cpp +884 -0
  143. data/ext/wxImage.hpp +24 -0
  144. data/ext/wxInfoBar.cpp +85 -0
  145. data/ext/wxInfoBar.hpp +21 -0
  146. data/ext/wxInfoBarBase.cpp +145 -0
  147. data/ext/wxInfoBarBase.hpp +21 -0
  148. data/ext/wxInfoBarGeneric.cpp +90 -0
  149. data/ext/wxInfoBarGeneric.hpp +21 -0
  150. data/ext/wxItemContainer.cpp +313 -0
  151. data/ext/wxItemContainer.hpp +17 -0
  152. data/ext/wxKeyEvent.cpp +35 -0
  153. data/ext/wxKeyEvent.hpp +16 -0
  154. data/ext/wxListBook.cpp +90 -0
  155. data/ext/wxListBook.hpp +21 -0
  156. data/ext/wxListBox.cpp +290 -0
  157. data/ext/wxListBox.hpp +29 -0
  158. data/ext/wxMenu.cpp +600 -0
  159. data/ext/wxMenu.hpp +17 -0
  160. data/ext/wxMenuBar.cpp +180 -0
  161. data/ext/wxMenuBar.hpp +17 -0
  162. data/ext/wxMenuItem.cpp +174 -0
  163. data/ext/wxMenuItem.hpp +17 -0
  164. data/ext/wxMessageDialog.cpp +91 -0
  165. data/ext/wxMessageDialog.hpp +19 -0
  166. data/ext/wxMessageDialogBase.cpp +152 -0
  167. data/ext/wxMessageDialogBase.hpp +18 -0
  168. data/ext/wxMessageDialogGeneric.cpp +91 -0
  169. data/ext/wxMessageDialogGeneric.hpp +19 -0
  170. data/ext/wxMouseEvent.cpp +60 -0
  171. data/ext/wxMouseEvent.hpp +16 -0
  172. data/ext/wxMultiChoiceDialog.cpp +143 -0
  173. data/ext/wxMultiChoiceDialog.hpp +19 -0
  174. data/ext/wxNoteBook.cpp +89 -0
  175. data/ext/wxNoteBook.hpp +21 -0
  176. data/ext/wxNotifyEvent.cpp +45 -0
  177. data/ext/wxNotifyEvent.hpp +16 -0
  178. data/ext/wxNumberEntryDialog.cpp +131 -0
  179. data/ext/wxNumberEntryDialog.hpp +20 -0
  180. data/ext/wxPalette.cpp +214 -0
  181. data/ext/wxPalette.hpp +24 -0
  182. data/ext/wxPanel.cpp +77 -0
  183. data/ext/wxPanel.hpp +19 -0
  184. data/ext/wxPasswordEntryDialog.cpp +141 -0
  185. data/ext/wxPasswordEntryDialog.hpp +20 -0
  186. data/ext/wxPen.cpp +323 -0
  187. data/ext/wxPen.hpp +37 -0
  188. data/ext/wxPickerBase.cpp +121 -0
  189. data/ext/wxPickerBase.hpp +28 -0
  190. data/ext/wxPoint.cpp +224 -0
  191. data/ext/wxPoint.hpp +40 -0
  192. data/ext/wxPreferences.cpp +149 -0
  193. data/ext/wxPreferences.hpp +18 -0
  194. data/ext/wxProgressDialog.cpp +171 -0
  195. data/ext/wxProgressDialog.hpp +20 -0
  196. data/ext/wxProperty.cpp +723 -0
  197. data/ext/wxProperty.hpp +16 -0
  198. data/ext/wxPropertyCell.cpp +99 -0
  199. data/ext/wxPropertyCell.hpp +16 -0
  200. data/ext/wxPropertyGrid.cpp +234 -0
  201. data/ext/wxPropertyGrid.hpp +20 -0
  202. data/ext/wxPropertyGridInterface.cpp +146 -0
  203. data/ext/wxPropertyGridInterface.hpp +33 -0
  204. data/ext/wxPropertyGridManager.cpp +257 -0
  205. data/ext/wxPropertyGridManager.hpp +20 -0
  206. data/ext/wxPropertyGridPage.cpp +65 -0
  207. data/ext/wxPropertyGridPage.hpp +20 -0
  208. data/ext/wxRadioBox.cpp +405 -0
  209. data/ext/wxRadioBox.hpp +20 -0
  210. data/ext/wxRadioButton.cpp +107 -0
  211. data/ext/wxRadioButton.hpp +16 -0
  212. data/ext/wxRearrangeCtrl.cpp +89 -0
  213. data/ext/wxRearrangeCtrl.hpp +20 -0
  214. data/ext/wxRearrangeDialog.cpp +122 -0
  215. data/ext/wxRearrangeDialog.hpp +20 -0
  216. data/ext/wxRearrangeList.cpp +94 -0
  217. data/ext/wxRearrangeList.hpp +20 -0
  218. data/ext/wxRect.cpp +281 -0
  219. data/ext/wxRect.hpp +29 -0
  220. data/ext/wxRichMessageDialog.cpp +91 -0
  221. data/ext/wxRichMessageDialog.hpp +21 -0
  222. data/ext/wxRichTextAttr.cpp +69 -0
  223. data/ext/wxRichTextAttr.hpp +28 -0
  224. data/ext/wxRichTextCtrl.cpp +484 -0
  225. data/ext/wxRichTextCtrl.hpp +21 -0
  226. data/ext/wxRichTextStyle.cpp +86 -0
  227. data/ext/wxRichTextStyle.hpp +25 -0
  228. data/ext/wxRichTextStyleSheet.cpp +497 -0
  229. data/ext/wxRichTextStyleSheet.hpp +21 -0
  230. data/ext/wxSTC.cpp +331 -0
  231. data/ext/wxSTC.hpp +21 -0
  232. data/ext/wxScrollEvent.cpp +43 -0
  233. data/ext/wxScrollEvent.hpp +16 -0
  234. data/ext/wxSearchCtrl.cpp +189 -0
  235. data/ext/wxSearchCtrl.hpp +21 -0
  236. data/ext/wxSimpleBook.cpp +89 -0
  237. data/ext/wxSimpleBook.hpp +21 -0
  238. data/ext/wxSingleChoiceDialog.cpp +147 -0
  239. data/ext/wxSingleChoiceDialog.hpp +19 -0
  240. data/ext/wxSize.cpp +206 -0
  241. data/ext/wxSize.hpp +32 -0
  242. data/ext/wxSizer.cpp +368 -0
  243. data/ext/wxSizer.hpp +23 -0
  244. data/ext/wxSizerItem.cpp +37 -0
  245. data/ext/wxSizerItem.hpp +18 -0
  246. data/ext/wxSlider.cpp +204 -0
  247. data/ext/wxSlider.hpp +21 -0
  248. data/ext/wxSpinButton.cpp +158 -0
  249. data/ext/wxSpinButton.hpp +20 -0
  250. data/ext/wxSpinCtrl.cpp +132 -0
  251. data/ext/wxSpinCtrl.hpp +21 -0
  252. data/ext/wxStartUpTip.cpp +44 -0
  253. data/ext/wxStartUpTip.hpp +16 -0
  254. data/ext/wxStaticBitmap.cpp +79 -0
  255. data/ext/wxStaticBitmap.hpp +17 -0
  256. data/ext/wxStaticBitmapBase.cpp +46 -0
  257. data/ext/wxStaticBitmapBase.hpp +22 -0
  258. data/ext/wxStaticBitmapGeneric.cpp +82 -0
  259. data/ext/wxStaticBitmapGeneric.hpp +17 -0
  260. data/ext/wxStaticBox.cpp +92 -0
  261. data/ext/wxStaticBox.hpp +22 -0
  262. data/ext/wxStaticLine.cpp +100 -0
  263. data/ext/wxStaticLine.hpp +22 -0
  264. data/ext/wxStaticText.cpp +82 -0
  265. data/ext/wxStaticText.hpp +21 -0
  266. data/ext/wxStatusBar.cpp +417 -0
  267. data/ext/wxStatusBar.hpp +17 -0
  268. data/ext/wxStream.cpp +41 -0
  269. data/ext/wxStream.hpp +46 -0
  270. data/ext/wxTaskBar.cpp +104 -0
  271. data/ext/wxTaskBar.hpp +41 -0
  272. data/ext/wxTextArea.cpp +141 -0
  273. data/ext/wxTextArea.hpp +21 -0
  274. data/ext/wxTextAttr.cpp +320 -0
  275. data/ext/wxTextAttr.hpp +28 -0
  276. data/ext/wxTextCtrl.cpp +177 -0
  277. data/ext/wxTextCtrl.hpp +30 -0
  278. data/ext/wxTextEntry.cpp +248 -0
  279. data/ext/wxTextEntry.hpp +19 -0
  280. data/ext/wxTextEntryDialog.cpp +133 -0
  281. data/ext/wxTextEntryDialog.hpp +20 -0
  282. data/ext/wxTimePicker.cpp +105 -0
  283. data/ext/wxTimePicker.hpp +22 -0
  284. data/ext/wxTimer.cpp +106 -0
  285. data/ext/wxTimer.hpp +16 -0
  286. data/ext/wxToggleButton.cpp +96 -0
  287. data/ext/wxToggleButton.hpp +21 -0
  288. data/ext/wxToolBar.cpp +85 -0
  289. data/ext/wxToolBar.hpp +17 -0
  290. data/ext/wxToolBarBase.cpp +615 -0
  291. data/ext/wxToolBarBase.hpp +17 -0
  292. data/ext/wxToolBarTool.cpp +179 -0
  293. data/ext/wxToolBarTool.hpp +16 -0
  294. data/ext/wxToolBook.cpp +96 -0
  295. data/ext/wxToolBook.hpp +23 -0
  296. data/ext/wxToplevel.cpp +125 -0
  297. data/ext/wxToplevel.hpp +25 -0
  298. data/ext/wxTreeBook.cpp +240 -0
  299. data/ext/wxTreeBook.hpp +21 -0
  300. data/ext/wxTreeCtrl.cpp +443 -0
  301. data/ext/wxTreeCtrl.hpp +66 -0
  302. data/ext/wxVariant.cpp +65 -0
  303. data/ext/wxVariant.hpp +17 -0
  304. data/ext/wxWindow.cpp +980 -0
  305. data/ext/wxWindow.hpp +35 -0
  306. data/ext/wxWizard.cpp +321 -0
  307. data/ext/wxWizard.hpp +19 -0
  308. data/ext/wxWizardPage.cpp +137 -0
  309. data/ext/wxWizardPage.hpp +38 -0
  310. data/ext/wxXRC.cpp +48 -0
  311. data/ext/wxXRC.hpp +21 -0
  312. data/old_tests/button.rb +56 -0
  313. data/old_tests/file.png +0 -0
  314. data/old_tests/green.xpm +25 -0
  315. data/old_tests/new16x16.png +0 -0
  316. data/old_tests/project.xml +10 -0
  317. data/old_tests/propertygrid.rb +51 -0
  318. data/old_tests/red.xpm +25 -0
  319. data/old_tests/ruby32x32.png +0 -0
  320. data/old_tests/status.rb +45 -0
  321. data/old_tests/test.rb +580 -0
  322. data/old_tests/wizard.xrc +40 -0
  323. data/old_tests/xrc.rb +38 -0
  324. data/rwx.gemspec +43 -0
  325. data/samples/controls/controls.rb +143 -0
  326. data/samples/controls/icons/choice.bmp +0 -0
  327. data/samples/controls/icons/choice.xpm +27 -0
  328. data/samples/controls/icons/combo.bmp +0 -0
  329. data/samples/controls/icons/combo.xpm +27 -0
  330. data/samples/controls/icons/gauge.bmp +0 -0
  331. data/samples/controls/icons/gauge.xpm +27 -0
  332. data/samples/controls/icons/list.bmp +0 -0
  333. data/samples/controls/icons/list.xpm +27 -0
  334. data/samples/controls/icons/radio.bmp +0 -0
  335. data/samples/controls/icons/radio.xpm +27 -0
  336. data/samples/controls/icons/stattext.xpm +24 -0
  337. data/samples/controls/icons/text.bmp +0 -0
  338. data/samples/controls/icons/text.xpm +27 -0
  339. data/samples/dialog/dialog_sample.rb +227 -0
  340. data/samples/sample.xpm +44 -0
  341. data/samples/widgets/icons/bmpbtn.xpm +37 -0
  342. data/samples/widgets/icons/bmpcombobox.xpm +54 -0
  343. data/samples/widgets/icons/button.xpm +54 -0
  344. data/samples/widgets/icons/checkbox.xpm +54 -0
  345. data/samples/widgets/icons/choice.xpm +27 -0
  346. data/samples/widgets/icons/choicebk.xpm +54 -0
  347. data/samples/widgets/icons/clrpicker.xpm +193 -0
  348. data/samples/widgets/icons/combobox.xpm +54 -0
  349. data/samples/widgets/icons/datepick.xpm +200 -0
  350. data/samples/widgets/icons/dirctrl.xpm +54 -0
  351. data/samples/widgets/icons/dirpicker.xpm +213 -0
  352. data/samples/widgets/icons/filepicker.xpm +214 -0
  353. data/samples/widgets/icons/fontpicker.xpm +185 -0
  354. data/samples/widgets/icons/gauge.xpm +54 -0
  355. data/samples/widgets/icons/hyperlnk.xpm +54 -0
  356. data/samples/widgets/icons/listbook.xpm +54 -0
  357. data/samples/widgets/icons/listbox.xpm +54 -0
  358. data/samples/widgets/icons/notebook.xpm +54 -0
  359. data/samples/widgets/icons/odcombobox.xpm +54 -0
  360. data/samples/widgets/icons/radiobox.xpm +54 -0
  361. data/samples/widgets/icons/scrolbar.xpm +54 -0
  362. data/samples/widgets/icons/slider.xpm +54 -0
  363. data/samples/widgets/icons/spinbtn.xpm +40 -0
  364. data/samples/widgets/icons/statbmp.xpm +40 -0
  365. data/samples/widgets/icons/statbox.xpm +54 -0
  366. data/samples/widgets/icons/stattext.xpm +54 -0
  367. data/samples/widgets/icons/text.xpm +54 -0
  368. data/samples/widgets/icons/timepick.xpm +207 -0
  369. data/samples/widgets/icons/toggle.xpm +54 -0
  370. data/samples/widgets/pages/colorpicker.rb +66 -0
  371. data/samples/widgets/pages/common.rb +17 -0
  372. data/samples/widgets/widgets.rb +29 -0
  373. data/samples/xrc/samples.xrc +46 -0
  374. data/samples/xrc/xrc_sample.rb +59 -0
  375. data/test/test_color.rb +64 -0
  376. metadata +470 -0
@@ -0,0 +1,149 @@
1
+ /*
2
+ * wxPreferences.cpp
3
+ *
4
+ * Created on: 25.05.2013
5
+ * Author: hanmac
6
+ */
7
+
8
+ #include "main.hpp"
9
+
10
+ #include "wxApp.hpp"
11
+
12
+ VALUE rb_cWXPreferences;
13
+
14
+ #ifdef HAVE_WX_PREFERENCES_H
15
+
16
+ #include <wx/preferences.h>
17
+
18
+ template <>
19
+ VALUE wrap< wxPreferencesEditor >(wxPreferencesEditor *point )
20
+ {
21
+ return wrapTypedPtr(point, rb_cWXPreferences);
22
+ }
23
+
24
+ #define _self unwrap<wxPreferencesEditor*>(self)
25
+
26
+ class RubyPreferencesPageInterface
27
+ {
28
+ public:
29
+ RubyPreferencesPageInterface(VALUE block,VALUE klass) :
30
+ mblock(block),mklass(klass) {}
31
+
32
+ virtual ~RubyPreferencesPageInterface() {}
33
+
34
+ virtual wxWindow *CreateWindow(wxWindow *parent)
35
+ {
36
+ //VALUE argv[] = {wrap(parent)};
37
+ //VALUE result = rb_class_new_instance(1,argv,mklass);
38
+
39
+ VALUE result = rb_funcall(mklass,rb_intern("new"),1,wrap(parent));
40
+
41
+ if(!NIL_P(mblock))
42
+ rb_funcall(mblock,rb_intern("call"),1,result);
43
+
44
+ return unwrap<wxWindow*>(result);
45
+ }
46
+
47
+ private:
48
+ VALUE mblock;
49
+ VALUE mklass;
50
+ };
51
+
52
+ class RubyPreferencesPage : public RubyPreferencesPageInterface,public wxPreferencesPage
53
+ {
54
+ public:
55
+ RubyPreferencesPage(VALUE block,VALUE klass,const wxString &title) :
56
+ RubyPreferencesPageInterface(block,klass),wxPreferencesPage(),mtitle(title) {}
57
+
58
+ //using RubyPreferencesPageInterface::CreateWindow;
59
+ wxWindow *CreateWindow(wxWindow *parent)
60
+ {
61
+ return RubyPreferencesPageInterface::CreateWindow(parent);
62
+ }
63
+
64
+ wxString GetName() const {return mtitle;}
65
+ private:
66
+ wxString mtitle;
67
+ };
68
+
69
+
70
+ class RubyStockPreferencesPage : public RubyPreferencesPageInterface, public wxStockPreferencesPage
71
+ {
72
+ public:
73
+ RubyStockPreferencesPage(VALUE block,VALUE klass,wxStockPreferencesPage::Kind kind) :
74
+ RubyPreferencesPageInterface(block,klass), wxStockPreferencesPage(kind) {}
75
+
76
+ //using RubyPreferencesPageInterface::CreateWindow;
77
+ wxWindow *CreateWindow(wxWindow *parent)
78
+ {
79
+ return RubyPreferencesPageInterface::CreateWindow(parent);
80
+ }
81
+ };
82
+
83
+ namespace RubyWX {
84
+ namespace Preferences {
85
+
86
+ DLL_LOCAL VALUE _add_page(int argc,VALUE *argv,VALUE self)
87
+ {
88
+ VALUE kind, klass,block;
89
+ rb_scan_args(argc, argv, "20&",&kind,&klass,&block);
90
+ wxPreferencesPage *page = NULL;
91
+ //VALUE block = rb_block_proc();
92
+ if(SYMBOL_P(kind))
93
+ {
94
+ wxStockPreferencesPage::Kind wxkind = wxStockPreferencesPage::Kind_General;
95
+ if(SYM2ID(kind) == rb_intern("general"))
96
+ wxkind = wxStockPreferencesPage::Kind_General;
97
+ if(SYM2ID(kind) == rb_intern("advanced"))
98
+ wxkind = wxStockPreferencesPage::Kind_Advanced;
99
+ page = new RubyStockPreferencesPage(block,klass,wxkind);
100
+ }else
101
+ {
102
+ page = new RubyPreferencesPage(block,klass,unwrap<wxString>(kind));
103
+ }
104
+
105
+ _self->AddPage(page);
106
+ return self;
107
+ }
108
+
109
+ DLL_LOCAL VALUE _preferences(int argc,VALUE *argv,VALUE self)
110
+ {
111
+ VALUE window, title;
112
+ rb_scan_args(argc, argv, "11",&window,&title);
113
+
114
+ app_protected();
115
+
116
+ wxPreferencesEditor *pref = new wxPreferencesEditor(unwrap<wxString>(title));
117
+
118
+ if(rb_block_given_p())
119
+ {
120
+ rb_funcall(rb_block_proc(),rb_intern("call"),1,wrap(pref));
121
+ //rb_yield(wrap(pref));
122
+ pref->Show(unwrap<wxWindow*>(window));
123
+ }
124
+
125
+ return self;
126
+ }
127
+
128
+ }
129
+
130
+ }
131
+
132
+ #endif
133
+
134
+ DLL_LOCAL void Init_WXPreferences(VALUE rb_mWX)
135
+ {
136
+ #ifdef HAVE_WX_PREFERENCES_H
137
+ using namespace RubyWX::Preferences;
138
+ rb_cWXPreferences = rb_define_class_under(rb_mWX,"Preferences",rb_cObject);
139
+
140
+ rb_undef_alloc_func(rb_cWXPreferences);
141
+
142
+ rb_define_method(rb_cWXPreferences,"add_page",RUBY_METHOD_FUNC(_add_page),-1);
143
+
144
+ rb_define_module_function(rb_mWX,"preferences",RUBY_METHOD_FUNC(_preferences),-1);
145
+ registerType<wxPreferencesEditor>(rb_cWXPreferences);
146
+ #endif
147
+
148
+ }
149
+
@@ -0,0 +1,18 @@
1
+ /*
2
+ * wxPreferences.hpp
3
+ *
4
+ * Created on: 26.05.2013
5
+ * Author: hanmac
6
+ */
7
+
8
+ #ifndef WXPREFERENCES_HPP_
9
+ #define WXPREFERENCES_HPP_
10
+
11
+ #include "main.hpp"
12
+
13
+ extern VALUE rb_cWXPreferences;
14
+
15
+ DLL_LOCAL void Init_WXPreferences(VALUE rb_mWX);
16
+
17
+
18
+ #endif /* WXPREFERENCES_HPP_ */
@@ -0,0 +1,171 @@
1
+ /*
2
+ * wxProgressDialog.cpp
3
+ *
4
+ * Created on: 11.03.2012
5
+ * Author: hanmac
6
+ */
7
+
8
+ #include "wxProgressDialog.hpp"
9
+
10
+ VALUE rb_cWXProgressDialog;
11
+ #if wxUSE_PROGRESSDLG
12
+
13
+ #ifdef HAVE_WXPROGRESSDIALOG
14
+ #define _self unwrap<wxProgressDialog*>(self)
15
+ #else
16
+ #define _self unwrap<wxGenericProgressDialog*>(self)
17
+ #endif
18
+
19
+
20
+ namespace RubyWX {
21
+ namespace ProgressDialog {
22
+
23
+ macro_attr(Range,int)
24
+
25
+ singlereturn(GetValue)
26
+ singlereturn(GetMessage)
27
+
28
+ #ifdef HAVE_WXPROGRESSDIALOG
29
+ APP_PROTECT(wxProgressDialog)
30
+ #else
31
+ APP_PROTECT(wxGenericProgressDialog)
32
+ #endif
33
+
34
+ DLL_LOCAL VALUE _initialize(int argc,VALUE *argv,VALUE self)
35
+ {
36
+ VALUE parent,name,hash;
37
+ rb_scan_args(argc, argv, "11:",&parent,&name,&hash);
38
+ if(!_created && !rb_obj_is_kind_of(name,rb_cString))
39
+ {
40
+ wxString title(wxEmptyString);
41
+ wxString message(wxEmptyString);
42
+ int max(100);
43
+ int style(wxPD_APP_MODAL | wxPD_AUTO_HIDE);
44
+
45
+ if(rb_obj_is_kind_of(hash,rb_cHash))
46
+ {
47
+ set_hash_option(hash,"title",title);
48
+ set_hash_option(hash,"message",message);
49
+
50
+ set_hash_option(hash,"max",max);
51
+
52
+ set_hash_option(hash,"style",style);
53
+
54
+ TopLevel::set_style_flags(hash,style);
55
+
56
+ set_hash_flag_option(hash,"can_abort",wxPD_CAN_ABORT,style);
57
+ set_hash_flag_option(hash,"app_modal",wxPD_APP_MODAL,style);
58
+ set_hash_flag_option(hash,"auto_hide",wxPD_AUTO_HIDE,style);
59
+ set_hash_flag_option(hash,"smooth",wxPD_SMOOTH,style);
60
+ set_hash_flag_option(hash,"can_skip",wxPD_CAN_SKIP,style);
61
+ set_hash_flag_option(hash,"elapsed_time",wxPD_ELAPSED_TIME,style);
62
+ set_hash_flag_option(hash,"estimated_time",wxPD_ESTIMATED_TIME,style);
63
+ set_hash_flag_option(hash,"remaining_time",wxPD_REMAINING_TIME,style);
64
+
65
+ }
66
+ _self->Create(title,message,max,unwrap<wxWindow*>(parent),style);
67
+
68
+ }
69
+ rb_call_super(argc,argv);
70
+
71
+ return self;
72
+ }
73
+
74
+ DLL_LOCAL VALUE _update(int argc,VALUE *argv,VALUE self)
75
+ {
76
+ VALUE val,message;
77
+ rb_scan_args(argc, argv, "11",&val,&message);
78
+
79
+ int value = NUM2INT(val);
80
+
81
+ if(check_index(value,_self->GetRange()))
82
+ return wrap(_self->Update(value,unwrap<wxString>(message)));
83
+ return Qnil;
84
+ }
85
+
86
+ DLL_LOCAL VALUE _pulse(int argc,VALUE *argv,VALUE self)
87
+ {
88
+ VALUE message;
89
+ rb_scan_args(argc, argv, "01",&message);
90
+
91
+ return wrap(_self->Pulse(unwrap<wxString>(message)));
92
+ }
93
+
94
+
95
+ }
96
+ }
97
+ #endif
98
+
99
+
100
+ /* Document-const: APP_MODAL
101
+ * Make the progress dialog modal.
102
+ * If this flag is not given, it is only "locally" modal
103
+ * - that is the input to the parent window is disabled,
104
+ * but not to the other ones.
105
+ */
106
+ /* Document-const: CAN_ABORT
107
+ * This flag tells the dialog that it should have a "Cancel" button which the user may press.
108
+ * If this happens, the next call to update() will return false
109
+ */
110
+ /* Document-const: CAN_SKIP
111
+ * This flag tells the dialog that it should have a "Skip" button which the user may press.
112
+ * If this happens, the next call to Update() will return true in its skip parameter.
113
+ */
114
+ /* Document-const: AUTO_HIDE
115
+ * Causes the progress dialog to disappear from screen as soon as the maximum value of the progress meter has been reached.
116
+ * If this style is not present, the dialog will become a modal dialog (see WX::Dialog#show_modal) once the maximum value has been reached and wait for the user to dismiss it.
117
+ */
118
+ /* Document-const: SMOOTH
119
+ * Causes smooth progress of the gauge control (uses a WX::Gauge with the WX::Gauge::SMOOTH style).
120
+ */
121
+ /* Document-const: ELAPSED_TIME
122
+ * The text will not be user-editable.
123
+ */
124
+ /* Document-const: ESTIMATED_TIME
125
+ * The text will not be user-editable.
126
+ */
127
+ /* Document-const: REMAINING_TIME
128
+ * The text will not be user-editable.
129
+ */
130
+
131
+
132
+ DLL_LOCAL void Init_WXProgressDialog(VALUE rb_mWX)
133
+ {
134
+ #if 0
135
+ rb_mWX = rb_define_module("WX");
136
+ rb_cWXWindow = rb_define_class_under(rb_mWX,"Window",rb_cObject);
137
+
138
+ rb_cWXTopLevel = rb_define_class_under(rb_mWX,"TopLevel",rb_cWXWindow);
139
+ rb_cWXDialog = rb_define_class_under(rb_mWX,"Dialog",rb_cWXTopLevel);
140
+
141
+ #endif
142
+
143
+ #if wxUSE_PROGRESSDLG
144
+ using namespace RubyWX::ProgressDialog;
145
+ rb_cWXProgressDialog = rb_define_class_under(rb_mWX,"ProgressDialog",rb_cWXDialog);
146
+ rb_define_alloc_func(rb_cWXProgressDialog,_alloc);
147
+ rb_define_method(rb_cWXProgressDialog,"initialize",RUBY_METHOD_FUNC(_initialize),-1);
148
+
149
+ rb_define_method(rb_cWXProgressDialog,"update",RUBY_METHOD_FUNC(_update),-1);
150
+ rb_define_method(rb_cWXProgressDialog,"pulse",RUBY_METHOD_FUNC(_pulse),-1);
151
+
152
+
153
+ rb_define_const(rb_cWXProgressDialog,"CAN_ABORT",INT2NUM(wxPD_CAN_ABORT));
154
+ rb_define_const(rb_cWXProgressDialog,"APP_MODAL",INT2NUM(wxPD_APP_MODAL));
155
+ rb_define_const(rb_cWXProgressDialog,"AUTO_HIDE",INT2NUM(wxPD_AUTO_HIDE));
156
+ rb_define_const(rb_cWXProgressDialog,"ELAPSED_TIME",INT2NUM(wxPD_ELAPSED_TIME));
157
+ rb_define_const(rb_cWXProgressDialog,"ESTIMATED_TIME",INT2NUM(wxPD_ESTIMATED_TIME));
158
+ rb_define_const(rb_cWXProgressDialog,"SMOOTH",INT2NUM(wxPD_SMOOTH));
159
+ rb_define_const(rb_cWXProgressDialog,"REMAINING_TIME",INT2NUM(wxPD_REMAINING_TIME));
160
+ rb_define_const(rb_cWXProgressDialog,"CAN_SKIP",INT2NUM(wxPD_CAN_SKIP));
161
+
162
+ #ifdef HAVE_WXPROGRESSDIALOG
163
+ registerInfo<wxProgressDialog>(rb_cWXProgressDialog);
164
+ #else
165
+ registerInfo<wxGenericProgressDialog>(rb_cWXProgressDialog);
166
+ registerInfo<wxProgressDialog>(rb_cWXProgressDialog);
167
+ #endif
168
+
169
+
170
+ #endif
171
+ }
@@ -0,0 +1,20 @@
1
+ /*
2
+ * wxProgressDialog.hpp
3
+ *
4
+ * Created on: 11.03.2012
5
+ * Author: hanmac
6
+ */
7
+
8
+ #ifndef WXPROGRESSDIALOG_HPP_
9
+ #define WXPROGRESSDIALOG_HPP_
10
+
11
+ #include "wxDialog.hpp"
12
+
13
+ extern VALUE rb_cWXProgressDialog;
14
+
15
+ DLL_LOCAL void Init_WXProgressDialog(VALUE rb_mWX);
16
+ #if wxUSE_PROGRESSDLG
17
+ #include <wx/progdlg.h>
18
+ #endif
19
+
20
+ #endif /* WXPROGRESSDIALOG_HPP_ */
@@ -0,0 +1,723 @@
1
+ /*
2
+ * wxProperty.cpp
3
+ *
4
+ * Created on: 08.05.2012
5
+ * Author: hanmac
6
+ */
7
+
8
+ #include "wxProperty.hpp"
9
+ #include "wxPropertyGrid.hpp"
10
+ #include "wxVariant.hpp"
11
+ #include "wxBitmap.hpp"
12
+ #include "wxColor.hpp"
13
+ #include "wxFont.hpp"
14
+ #include "wxApp.hpp"
15
+
16
+ VALUE rb_cWXProperty;
17
+ #if wxUSE_PROPGRID
18
+
19
+ #include <wx/propgrid/props.h>
20
+ #include <wx/propgrid/advprops.h>
21
+
22
+ template<typename T>
23
+ DLL_LOCAL void registerProperty(VALUE mod,const char* name,const char* parent = NULL)
24
+ {
25
+ VALUE pc = rb_cWXProperty;
26
+
27
+ if(parent)
28
+ pc = rb_const_get(mod,rb_intern(parent));
29
+
30
+ VALUE klass = rb_define_class_under(mod,name,pc);
31
+ registerInfo<T>(klass);
32
+ }
33
+
34
+
35
+ #define _self unwrap<wxPGProperty*>(self)
36
+
37
+ namespace RubyWX {
38
+ namespace Property {
39
+
40
+ //APP_PROTECT(wxPGProperty)
41
+
42
+ DLL_LOCAL VALUE _alloc(VALUE self)
43
+ {
44
+ app_protected();
45
+
46
+ for(VALUE klass = self; klass != rb_cWXProperty; klass = rb_class_get_superclass(klass))
47
+ {
48
+ for(infoholdertype::const_iterator it = infoklassholder.begin(); it != infoklassholder.end();++it) {
49
+ if(it->second == klass) {
50
+ return wrapTypedPtr(it->first->CreateObject(),self);
51
+ }
52
+ }
53
+ }
54
+
55
+ return wrapTypedPtr(new wxPGProperty,self);
56
+ }
57
+
58
+ macro_attr(Name,wxString)
59
+ macro_attr(Label,wxString)
60
+ macro_attr(HelpString,wxString)
61
+
62
+ singlereturn(GetBaseName)
63
+ singlereturn(GetMainParent)
64
+ singlereturn(GetParent)
65
+
66
+ singlereturn(GetDepth)
67
+
68
+ singlereturn(GetGrid)
69
+
70
+ singlereturn(IsVisible)
71
+ singlereturn(IsRoot)
72
+ singlereturn(IsCategory)
73
+
74
+ singlereturn(HasVisibleChildren)
75
+
76
+ singlereturn(GetValue)
77
+ singlereturn(GetDefaultValue)
78
+ singlereturn(GetValueImage)
79
+
80
+ singlereturn(GetValueType)
81
+
82
+ singlefunc(DeleteChildren)
83
+
84
+ macro_attr_selection(ChoiceSelection,GetChoices().GetCount)
85
+
86
+ macro_attr_bool(Expanded)
87
+ macro_attr_bool2(Enabled,Enable)
88
+
89
+ DLL_LOCAL VALUE _setValue(VALUE self,VALUE val)
90
+ {
91
+ rb_check_frozen(self);
92
+ _self->SetValue(unwrapVariant(val,_self->GetValueType()));
93
+ return val;
94
+ }
95
+
96
+ DLL_LOCAL VALUE _setDefaultValue(VALUE self,VALUE val)
97
+ {
98
+ rb_check_frozen(self);
99
+ wxVariant var = unwrapVariant(val,_self->GetValueType());
100
+ _self->SetDefaultValue(var);
101
+ return val;
102
+ }
103
+
104
+ DLL_LOCAL VALUE _setValueImage(VALUE self,VALUE val)
105
+ {
106
+ rb_check_frozen(self);
107
+
108
+ if(_self->GetGrid())
109
+ _self->SetValueImage(unwrap<wxBitmap&>(val));
110
+
111
+ return val;
112
+ }
113
+
114
+
115
+ DLL_LOCAL VALUE _getAttribute(VALUE self,VALUE name)
116
+ {
117
+ return wrap(_self->GetAttribute(unwrap<wxString>(name)));
118
+ }
119
+
120
+ DLL_LOCAL VALUE _setAttribute(VALUE self,VALUE name,VALUE val)
121
+ {
122
+ rb_check_frozen(self);
123
+ _self->SetAttribute(unwrap<wxString>(name),unwrapVariant(val,_self->GetAttribute(unwrap<wxString>(name)).GetType()));
124
+ return val;
125
+ }
126
+
127
+ DLL_LOCAL VALUE _getClass(VALUE self)
128
+ {
129
+ return wrap(wxString(_self->GetClassInfo()->GetClassName()));
130
+ }
131
+
132
+
133
+ DLL_LOCAL VALUE _setVisible(VALUE self,VALUE val)
134
+ {
135
+ rb_check_frozen(self);
136
+ _self->Hide(!RTEST(val));
137
+ return val;
138
+ }
139
+
140
+ /*
141
+ * call-seq:
142
+ * show([recurse]) -> self
143
+ *
144
+ * makes this property visible, children too if recurse is set.
145
+ * ===Arguments
146
+ * * recurse true/false
147
+ * ===Return value
148
+ * self
149
+ *
150
+ */
151
+ DLL_LOCAL VALUE _show(int argc,VALUE *argv,VALUE self)
152
+ {
153
+ rb_check_frozen(self);
154
+
155
+ VALUE recurse;
156
+
157
+ rb_scan_args(argc, argv, "01",&recurse);
158
+
159
+ bool rec = NIL_P(recurse) || RTEST(recurse);
160
+ _self->Hide(false, rec ? wxPG_RECURSE : wxPG_DONT_RECURSE );
161
+ return self;
162
+ }
163
+
164
+
165
+ /*
166
+ * call-seq:
167
+ * hide([recurse]) -> self
168
+ *
169
+ * hides this property, children too if recurse is set.
170
+ * ===Arguments
171
+ * * recurse true/false
172
+ * ===Return value
173
+ * self
174
+ *
175
+ */
176
+ DLL_LOCAL VALUE _hide(int argc,VALUE *argv,VALUE self)
177
+ {
178
+ rb_check_frozen(self);
179
+
180
+ VALUE recurse;
181
+
182
+ rb_scan_args(argc, argv, "01",&recurse);
183
+
184
+ bool rec = NIL_P(recurse) || RTEST(recurse);
185
+ _self->Hide(true, rec ? wxPG_RECURSE : wxPG_DONT_RECURSE );
186
+ return self;
187
+ }
188
+
189
+
190
+
191
+ DLL_LOCAL VALUE _each_child_size(VALUE self)
192
+ {
193
+ return UINT2NUM(_self->GetChildCount());
194
+ }
195
+
196
+
197
+
198
+ /*
199
+ * call-seq:
200
+ * each_child -> Enumerator
201
+ * each_child { |child| } -> self
202
+ *
203
+ * iterates the children in this property.
204
+ * ===Return value
205
+ * self
206
+ *
207
+ */
208
+ DLL_LOCAL VALUE _each_child(VALUE self)
209
+ {
210
+ RETURN_SIZED_ENUMERATOR(self,0,NULL,RUBY_METHOD_FUNC(_each_child_size));
211
+ std::size_t count = _self->GetChildCount();
212
+ for(std::size_t i = 0; i < count; ++i)
213
+ rb_yield(wrap(_self->Item(i)));
214
+ return self;
215
+ }
216
+
217
+ DLL_LOCAL VALUE _each_choice_count(VALUE self)
218
+ {
219
+ const wxPGChoices& choices = _self->GetChoices();
220
+ if(!choices.IsOk())
221
+ return INT2FIX(0);
222
+
223
+ return wrap(choices.GetCount());
224
+ }
225
+
226
+
227
+
228
+ /*
229
+ * call-seq:
230
+ * each_choice -> Enumerator
231
+ * each_choice { |child| } -> self
232
+ *
233
+ * iterates the choices in this property.
234
+ * ===Return value
235
+ * self
236
+ *
237
+ */
238
+ DLL_LOCAL VALUE _each_choice(VALUE self)
239
+ {
240
+ RETURN_SIZED_ENUMERATOR(self,0,NULL,RUBY_METHOD_FUNC(_each_choice_count));
241
+ wxPGChoices& choices = const_cast<wxPGChoices&>(_self->GetChoices());
242
+
243
+ if(!choices.IsOk())
244
+ return self;
245
+
246
+ std::size_t count = choices.GetCount();
247
+ for(std::size_t i = 0; i < count; ++i)
248
+ {
249
+ rb_yield(wrap(&dynamic_cast<wxPGCell&>(choices[i])));
250
+ }
251
+
252
+
253
+ return self;
254
+ }
255
+
256
+
257
+ VALUE _set_choice(wxPGProperty* self,int idx,VALUE hash)
258
+ {
259
+ wxPGChoices& choices = const_cast<wxPGChoices&>(self->GetChoices());
260
+
261
+ if(!choices.IsOk())
262
+ return Qnil;
263
+
264
+ wxPGChoiceEntry& item = choices[idx];
265
+
266
+ if(rb_obj_is_kind_of(hash,rb_cHash))
267
+ {
268
+ wxBitmap bitmap;
269
+ wxColour fg,bg;
270
+ wxFont font(wxNullFont);
271
+
272
+ if(set_hash_option(hash,"bitmap",bitmap))
273
+ item.SetBitmap(bitmap);
274
+
275
+ if(set_hash_option(hash,"bg_col",bg))
276
+ item.SetBgCol(bg);
277
+ if(set_hash_option(hash,"fg_col",fg))
278
+ item.SetFgCol(fg);
279
+ if(set_hash_option(hash,"font",font))
280
+ item.SetFont(font);
281
+ }
282
+ return wrap(&dynamic_cast<wxPGCell&>(item));
283
+ }
284
+
285
+
286
+ /*
287
+ * call-seq:
288
+ * add_choice(label,[value],**options) -> WX::PropertyCell
289
+ *
290
+ * adds a new choice into this property
291
+ * ===Arguments
292
+ * * label String
293
+ * * value Integer/nil
294
+ * * options:
295
+ * * bitmap WX::Bitmap
296
+ * * bg_col WX::Color
297
+ * * fg_col WX::Color
298
+ * * font WX::Font
299
+ * ===Return value
300
+ * WX::PropertyCell
301
+ *
302
+ */
303
+ DLL_LOCAL VALUE _add_choice(int argc,VALUE *argv,VALUE self)
304
+ {
305
+ VALUE label,value,hash;
306
+
307
+ rb_scan_args(argc, argv, "11:",&label,&value,&hash);
308
+
309
+ int cvalue = wxPG_INVALID_VALUE;
310
+
311
+ if(!NIL_P(value))
312
+ cvalue = NUM2INT(value);
313
+
314
+ return _set_choice(_self,_self->AddChoice(unwrap<wxString>(label),cvalue),hash);
315
+
316
+ }
317
+
318
+ /*
319
+ * call-seq:
320
+ * prepend_choice(pos,label,[value],**options) -> WX::PropertyCell
321
+ *
322
+ * prepends a new choice into this property
323
+ * ===Arguments
324
+ * * pos position of the new choice. Integer
325
+ * * label String
326
+ * * value Integer/nil
327
+ * * options:
328
+ * * bitmap WX::Bitmap
329
+ * * bg_col WX::Color
330
+ * * fg_col WX::Color
331
+ * * font WX::Font
332
+ * ===Return value
333
+ * WX::PropertyCell
334
+ * === Exceptions
335
+ * [IndexError]
336
+ * * pos is greater than the count of choices
337
+ *
338
+ */
339
+ DLL_LOCAL VALUE _insert_choice(int argc,VALUE *argv,VALUE self)
340
+ {
341
+ VALUE label,idx,value,hash;
342
+
343
+ rb_scan_args(argc, argv, "21:",&idx,&label,&value,&hash);
344
+
345
+ int cvalue = wxPG_INVALID_VALUE;
346
+
347
+ int cidx = NUM2INT(idx);
348
+
349
+ std::size_t size = 0;
350
+
351
+ const wxPGChoices& choices = _self->GetChoices();
352
+ if(choices.IsOk())
353
+ size = choices.GetCount();
354
+
355
+ if(!NIL_P(value))
356
+ cvalue = NUM2INT(value);
357
+
358
+ if(check_index(cidx,size+1))
359
+ return _set_choice(_self,_self->InsertChoice(unwrap<wxString>(label),cidx,cvalue),hash);
360
+ return Qnil;
361
+ }
362
+
363
+
364
+ /*
365
+ * call-seq:
366
+ * prepend_choice(label,[value],**options) -> WX::PropertyCell
367
+ *
368
+ * prepends a new choice into this property
369
+ * ===Arguments
370
+ * * label String
371
+ * * value Integer/nil
372
+ * * options:
373
+ * * bitmap WX::Bitmap
374
+ * * bg_col WX::Color
375
+ * * fg_col WX::Color
376
+ * * font WX::Font
377
+ * ===Return value
378
+ * WX::PropertyCell
379
+ *
380
+ */
381
+ DLL_LOCAL VALUE _prepend_choice(int argc,VALUE *argv,VALUE self)
382
+ {
383
+ VALUE label,value,hash;
384
+
385
+ rb_scan_args(argc, argv, "11:",&label,&value,&hash);
386
+
387
+ int cvalue = wxPG_INVALID_VALUE;
388
+
389
+ if(!NIL_P(value))
390
+ cvalue = NUM2INT(value);
391
+
392
+ return _set_choice(_self,_self->InsertChoice(unwrap<wxString>(label),0,cvalue),hash);
393
+
394
+ }
395
+
396
+
397
+ /*
398
+ * call-seq:
399
+ * delete_choice(pos) -> self
400
+ *
401
+ * delete the choice at the given position.
402
+ * ===Arguments
403
+ * * pos position of the deleting choice. Integer
404
+ * ===Return value
405
+ * self
406
+ * === Exceptions
407
+ * [IndexError]
408
+ * * pos is greater than the count of choices
409
+ *
410
+ */
411
+ DLL_LOCAL VALUE _delete_choice(VALUE self,VALUE idx)
412
+ {
413
+
414
+ int cidx = NUM2INT(idx);
415
+
416
+ std::size_t size = 0;
417
+
418
+ const wxPGChoices& choices = _self->GetChoices();
419
+ if(choices.IsOk())
420
+ size = choices.GetCount();
421
+
422
+ if(check_index(cidx,size))
423
+ _self->DeleteChoice(cidx);
424
+
425
+ return self;
426
+ }
427
+
428
+
429
+ /*
430
+ * call-seq:
431
+ * add_child(property) -> WX::Property
432
+ * add_child(property) { |property| } -> WX::Property
433
+ *
434
+ * adds a new Property as child into this one
435
+ * ===Arguments
436
+ * * property WX::Property or class that inherits from WX::Property
437
+ * ===Return value
438
+ * WX::Property
439
+ *
440
+ */
441
+ DLL_LOCAL VALUE _add_child(VALUE self,VALUE prop)
442
+ {
443
+ return wrap(_self->AppendChild(unwrap<wxPGProperty*>(prop)));
444
+ }
445
+
446
+
447
+ /*
448
+ * call-seq:
449
+ * add_private_child(property) -> self
450
+ *
451
+ * adds a new Property as private child into this one
452
+ * ===Arguments
453
+ * * property WX::Property or class that inherits from WX::Property
454
+ * ===Return value
455
+ * self
456
+ *
457
+ */
458
+ DLL_LOCAL VALUE _add_private_child(VALUE self,VALUE prop)
459
+ {
460
+ _self->AddPrivateChild(unwrap<wxPGProperty*>(prop));
461
+ return self;
462
+ }
463
+
464
+
465
+ /*
466
+ * call-seq:
467
+ * insert_child(pos,property) -> WX::Property
468
+ * insert_child(pos,property) { |property| } -> WX::Property
469
+ *
470
+ * adds a new Property as child into this one
471
+ * ===Arguments
472
+ * * pos position of the new child property. Integer
473
+ * * property WX::Property or class that inherits from WX::Property
474
+ * ===Return value
475
+ * WX::Property
476
+ * === Exceptions
477
+ * [IndexError]
478
+ * * pos is greater than the count of children
479
+ *
480
+ */
481
+ DLL_LOCAL VALUE _insert_child(VALUE self,VALUE idx,VALUE prop)
482
+ {
483
+ int cidx = NUM2INT(idx);
484
+
485
+ if(check_index(cidx,_self->GetChildCount()+1))
486
+ return wrap(_self->InsertChild(cidx,unwrap<wxPGProperty*>(prop)));
487
+
488
+ return Qnil;
489
+ }
490
+
491
+
492
+ /*
493
+ * call-seq:
494
+ * prepend_child(property) -> WX::Property
495
+ * prepend_child(property) { |property| } -> WX::Property
496
+ *
497
+ * prepends a new Property as child into this one
498
+ * ===Arguments
499
+ * * property WX::Property or class that inherits from WX::Property
500
+ * ===Return value
501
+ * WX::Property
502
+ *
503
+ */
504
+ DLL_LOCAL VALUE _prepend_child(VALUE self,VALUE prop)
505
+ {
506
+ return wrap(_self->InsertChild(0,unwrap<wxPGProperty*>(prop)));
507
+ }
508
+
509
+
510
+
511
+
512
+ DLL_LOCAL VALUE _each_attribute_size(VALUE self)
513
+ {
514
+ return wrap(_self->GetAttributes().GetCount());
515
+ }
516
+
517
+
518
+ /*
519
+ * call-seq:
520
+ * each_attribute -> Enumerator
521
+ * each_attribute { |name, value| } -> self
522
+ *
523
+ * iterates the attributes in this property.
524
+ * ===Return value
525
+ * self
526
+ *
527
+ */
528
+ DLL_LOCAL VALUE _each_attribute(VALUE self)
529
+ {
530
+ RETURN_SIZED_ENUMERATOR(self,0,NULL,RUBY_METHOD_FUNC(_each_attribute_size));
531
+
532
+ const wxPGAttributeStorage& attrs = _self->GetAttributes();
533
+
534
+ wxPGAttributeStorage::const_iterator it = attrs.StartIteration();
535
+ wxVariant var;
536
+ while(attrs.GetNext(it,var))
537
+ rb_yield_values(2,wrap(var.GetName()),wrap(var));
538
+ return self;
539
+ }
540
+
541
+
542
+ VALUE find_prop_class(VALUE self,VALUE name)
543
+ {
544
+ return wxClassInfo::FindClass(wxString("wx") + unwrap<wxString>(name)) ? Qtrue : Qfalse;
545
+ }
546
+
547
+ }
548
+ }
549
+
550
+ #endif
551
+
552
+ /* Document-attr: label
553
+ * the label of the Property. String
554
+ */
555
+ /* Document-attr: name
556
+ * the name of the Property. String
557
+ */
558
+ /* Document-attr: help_string
559
+ * the help string of the Property. String
560
+ */
561
+ /* Document-attr: value
562
+ * the value of the Property.
563
+ */
564
+ /* Document-attr: default_value
565
+ * the default_value of the Property.
566
+ */
567
+ /* Document-attr: value_image
568
+ * the image of the Property. WX::Bitmap
569
+ */
570
+
571
+ /* Document-attr: visible
572
+ * the visible of the Property. bool
573
+ */
574
+
575
+ /* Document-attr: expanded
576
+ * the expanded of the Property. bool
577
+ */
578
+
579
+ /* Document-attr: enabled
580
+ * the enabled of the Property. bool
581
+ */
582
+
583
+ /* Document-attr: choice_selection
584
+ * the index with choice of the Property is selected. Integer/nil
585
+ */
586
+
587
+
588
+ /* Document-attr: parent
589
+ * the parent property of this one. WX::Property or nil
590
+ */
591
+ /* Document-attr: main_parent
592
+ * highest level parent property of this one. WX::Property or nil
593
+ */
594
+ /* Document-attr: base_name
595
+ * the base name of the Property. String
596
+ */
597
+
598
+ /* Document-attr: depth
599
+ * the depth of this property inside a grid. Integer
600
+ */
601
+ /* Document-attr: grid
602
+ * the property grid that has this property. WX::PropertyGrid or nil
603
+ */
604
+ DLL_LOCAL void Init_WXProperty(VALUE rb_mWX)
605
+ {
606
+ #if 0
607
+
608
+ rb_define_attr(rb_cWXProperty,"name",1,1);
609
+ rb_define_attr(rb_cWXProperty,"label",1,1);
610
+ rb_define_attr(rb_cWXProperty,"help_string",1,1);
611
+
612
+ rb_define_attr(rb_cWXProperty,"value",1,1);
613
+ rb_define_attr(rb_cWXProperty,"default_value",1,1);
614
+ rb_define_attr(rb_cWXProperty,"value_image",1,1);
615
+
616
+ rb_define_attr(rb_cWXProperty,"visible",1,1);
617
+ rb_define_attr(rb_cWXProperty,"expanded",1,1);
618
+ rb_define_attr(rb_cWXProperty,"enabled",1,1);
619
+
620
+ rb_define_attr(rb_cWXProperty,"choice_selection",1,1);
621
+
622
+ rb_define_attr(rb_cWXProperty,"base_name",1,0);
623
+ rb_define_attr(rb_cWXProperty,"main_parent",1,0);
624
+ rb_define_attr(rb_cWXProperty,"parent",1,0);
625
+
626
+ rb_define_attr(rb_cWXProperty,"depth",1,0);
627
+ rb_define_attr(rb_cWXProperty,"grid",1,0);
628
+
629
+ #endif
630
+
631
+ #if wxUSE_PROPGRID
632
+ using namespace RubyWX::Property;
633
+ rb_cWXProperty = rb_define_class_under(rb_mWX,"Property",rb_cObject);
634
+ rb_define_alloc_func(rb_cWXProperty,_alloc);
635
+
636
+ //TODO check if its possible to add this methods
637
+ rb_undef_method(rb_cWXProperty,"initialize_copy");
638
+ rb_undef_method(rb_cWXProperty,"_load");
639
+ rb_undef_method(rb_cWXProperty,"_dump");
640
+
641
+ rb_define_method(rb_cWXProperty,"visible_children?",RUBY_METHOD_FUNC(_HasVisibleChildren),0);
642
+ rb_define_method(rb_cWXProperty,"root?",RUBY_METHOD_FUNC(_IsRoot),0);
643
+ rb_define_method(rb_cWXProperty,"category?",RUBY_METHOD_FUNC(_IsCategory),0);
644
+
645
+ rb_define_attr_method(rb_cWXProperty,"name",_getName,_setName);
646
+ rb_define_attr_method(rb_cWXProperty,"label",_getLabel,_setLabel);
647
+ rb_define_attr_method(rb_cWXProperty,"help_string",_getHelpString,_setHelpString);
648
+
649
+ rb_define_attr_method(rb_cWXProperty,"value",_GetValue,_setValue);
650
+ rb_define_attr_method(rb_cWXProperty,"default_value",_GetDefaultValue,_setDefaultValue);
651
+ rb_define_attr_method(rb_cWXProperty,"value_image",_GetValueImage,_setValueImage);
652
+
653
+ rb_define_attr_method(rb_cWXProperty,"visible",_IsVisible,_setVisible);
654
+ rb_define_attr_method(rb_cWXProperty,"expanded",_getExpanded,_setExpanded);
655
+ rb_define_attr_method(rb_cWXProperty,"enabled",_getEnabled,_setEnabled);
656
+
657
+ rb_define_attr_method(rb_cWXProperty,"choice_selection",_getChoiceSelection,_setChoiceSelection);
658
+
659
+ rb_define_attr_method(rb_cWXProperty,"base_name",_GetBaseName,0);
660
+ rb_define_attr_method(rb_cWXProperty,"main_parent",_GetMainParent,0);
661
+ rb_define_attr_method(rb_cWXProperty,"parent",_GetParent,0);
662
+
663
+ rb_define_attr_method(rb_cWXProperty,"depth",_GetDepth,0);
664
+ rb_define_attr_method(rb_cWXProperty,"grid",_GetGrid,0);
665
+
666
+ rb_define_method(rb_cWXProperty,"show",RUBY_METHOD_FUNC(_show),-1);
667
+ rb_define_method(rb_cWXProperty,"hide",RUBY_METHOD_FUNC(_hide),-1);
668
+
669
+ rb_define_method(rb_cWXProperty,"add_child",RUBY_METHOD_FUNC(_add_child),1);
670
+ rb_define_method(rb_cWXProperty,"add_private_child",RUBY_METHOD_FUNC(_add_private_child),1);
671
+ rb_define_method(rb_cWXProperty,"insert_child",RUBY_METHOD_FUNC(_insert_child),2);
672
+ rb_define_method(rb_cWXProperty,"prepend_child",RUBY_METHOD_FUNC(_prepend_child),1);
673
+
674
+ rb_define_method(rb_cWXProperty,"add_choice",RUBY_METHOD_FUNC(_add_choice),-1);
675
+ rb_define_method(rb_cWXProperty,"insert_choice",RUBY_METHOD_FUNC(_insert_choice),-1);
676
+ rb_define_method(rb_cWXProperty,"prepend_choice",RUBY_METHOD_FUNC(_prepend_choice),-1);
677
+
678
+ rb_define_method(rb_cWXProperty,"delete_children",RUBY_METHOD_FUNC(_DeleteChildren),0);
679
+ rb_define_method(rb_cWXProperty,"delete_choice",RUBY_METHOD_FUNC(_delete_choice),1);
680
+
681
+ rb_define_method(rb_cWXProperty,"each_child",RUBY_METHOD_FUNC(_each_child),0);
682
+ rb_define_method(rb_cWXProperty,"each_choice",RUBY_METHOD_FUNC(_each_choice),0);
683
+ rb_define_method(rb_cWXProperty,"each_attribute",RUBY_METHOD_FUNC(_each_attribute),0);
684
+
685
+ rb_define_method(rb_cWXProperty,"wxclass",RUBY_METHOD_FUNC(_getClass),0);
686
+ rb_define_method(rb_cWXProperty,"type",RUBY_METHOD_FUNC(_GetValueType),0);
687
+
688
+ rb_define_method(rb_cWXProperty,"[]",RUBY_METHOD_FUNC(_getAttribute),1);
689
+ rb_define_method(rb_cWXProperty,"[]=",RUBY_METHOD_FUNC(_setAttribute),2);
690
+
691
+ registerInfo<wxPGProperty>(rb_cWXProperty);
692
+
693
+ rb_define_singleton_method(rb_cWXProperty,"find",RUBY_METHOD_FUNC(find_prop_class),1);
694
+
695
+ registerProperty<wxIntProperty>(rb_mWX,"IntProperty");
696
+ registerProperty<wxPropertyCategory>(rb_mWX,"CategoryProperty");
697
+ registerProperty<wxBoolProperty>(rb_mWX,"BoolProperty");
698
+ registerProperty<wxFontProperty>(rb_mWX,"FontProperty");
699
+ registerProperty<wxFileProperty>(rb_mWX,"FileProperty");
700
+
701
+ #if wxUSE_IMAGE
702
+ registerProperty<wxImageFileProperty>(rb_mWX,"ImageFileProperty","FileProperty");
703
+ #endif
704
+
705
+ #if wxUSE_DATETIME
706
+ registerProperty<wxDateProperty>(rb_mWX,"DateProperty");
707
+ #endif
708
+
709
+ registerProperty<wxStringProperty>(rb_mWX,"StringProperty");
710
+ registerProperty<wxArrayStringProperty>(rb_mWX,"ArrayStringProperty");
711
+
712
+ registerProperty<wxEnumProperty>(rb_mWX,"EnumProperty");
713
+ registerProperty<wxFlagsProperty>(rb_mWX,"FlagsProperty");
714
+
715
+ registerProperty<wxSystemColourProperty>(rb_mWX,"SystemColorProperty","EnumProperty");
716
+ registerProperty<wxColourProperty>(rb_mWX,"ColorProperty","SystemColorProperty");
717
+ registerProperty<wxCursorProperty>(rb_mWX,"CursorProperty","EnumProperty");
718
+
719
+ #endif
720
+ }
721
+
722
+
723
+