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.
- checksums.yaml +7 -0
- data/.gitignore +49 -0
- data/COPYING +0 -0
- data/README.rdoc +0 -0
- data/Rakefile +100 -0
- data/VERSION +1 -0
- data/ext/extconf.rb +112 -0
- data/ext/main.cpp +432 -0
- data/ext/main.hpp +454 -0
- data/ext/rwx.cpp +472 -0
- data/ext/wxAboutDlg.cpp +213 -0
- data/ext/wxAboutDlg.hpp +19 -0
- data/ext/wxAnyButton.cpp +141 -0
- data/ext/wxAnyButton.hpp +17 -0
- data/ext/wxAnyChoiceDialog.cpp +93 -0
- data/ext/wxAnyChoiceDialog.hpp +19 -0
- data/ext/wxApp.cpp +205 -0
- data/ext/wxApp.hpp +48 -0
- data/ext/wxAui.hpp +19 -0
- data/ext/wxAuiBook.cpp +453 -0
- data/ext/wxAuiBook.hpp +21 -0
- data/ext/wxAuiManager.cpp +79 -0
- data/ext/wxAuiManager.hpp +18 -0
- data/ext/wxAuiPane.cpp +343 -0
- data/ext/wxAuiPane.hpp +29 -0
- data/ext/wxAuiToolBar.cpp +47 -0
- data/ext/wxAuiToolBar.hpp +17 -0
- data/ext/wxBitmap.cpp +368 -0
- data/ext/wxBitmap.hpp +60 -0
- data/ext/wxBitmapButton.cpp +82 -0
- data/ext/wxBitmapButton.hpp +17 -0
- data/ext/wxBitmapComboBox.cpp +284 -0
- data/ext/wxBitmapComboBox.hpp +22 -0
- data/ext/wxBitmapToggleButton.cpp +82 -0
- data/ext/wxBitmapToggleButton.hpp +17 -0
- data/ext/wxBookCtrl.cpp +633 -0
- data/ext/wxBookCtrl.hpp +22 -0
- data/ext/wxBoxSizer.cpp +60 -0
- data/ext/wxBoxSizer.hpp +17 -0
- data/ext/wxBrush.cpp +281 -0
- data/ext/wxBrush.hpp +28 -0
- data/ext/wxButton.cpp +85 -0
- data/ext/wxButton.hpp +17 -0
- data/ext/wxButtonToolBar.cpp +54 -0
- data/ext/wxButtonToolBar.hpp +21 -0
- data/ext/wxCalendarCtrl.cpp +91 -0
- data/ext/wxCalendarCtrl.hpp +17 -0
- data/ext/wxCalendarCtrlBase.cpp +55 -0
- data/ext/wxCalendarCtrlBase.hpp +26 -0
- data/ext/wxCalendarCtrlGeneric.cpp +102 -0
- data/ext/wxCalendarCtrlGeneric.hpp +21 -0
- data/ext/wxCheckBox.cpp +157 -0
- data/ext/wxCheckBox.hpp +17 -0
- data/ext/wxCheckListBox.cpp +191 -0
- data/ext/wxCheckListBox.hpp +20 -0
- data/ext/wxChoice.cpp +133 -0
- data/ext/wxChoice.hpp +30 -0
- data/ext/wxChoiceBook.cpp +90 -0
- data/ext/wxChoiceBook.hpp +23 -0
- data/ext/wxCollapsiblePane.cpp +110 -0
- data/ext/wxCollapsiblePane.hpp +21 -0
- data/ext/wxColor.cpp +435 -0
- data/ext/wxColor.hpp +38 -0
- data/ext/wxColorDialog.cpp +97 -0
- data/ext/wxColorDialog.hpp +19 -0
- data/ext/wxColorPicker.cpp +131 -0
- data/ext/wxColorPicker.hpp +20 -0
- data/ext/wxColorPickerWidget.cpp +105 -0
- data/ext/wxColorPickerWidget.hpp +20 -0
- data/ext/wxComboBox.cpp +214 -0
- data/ext/wxComboBox.hpp +22 -0
- data/ext/wxCommandEvent.cpp +45 -0
- data/ext/wxCommandEvent.hpp +16 -0
- data/ext/wxConfig.cpp +19 -0
- data/ext/wxConfig.hpp +17 -0
- data/ext/wxContextHelpButton.cpp +93 -0
- data/ext/wxContextHelpButton.hpp +21 -0
- data/ext/wxControl.cpp +90 -0
- data/ext/wxControl.hpp +15 -0
- data/ext/wxCursor.cpp +108 -0
- data/ext/wxCursor.hpp +25 -0
- data/ext/wxDC.cpp +252 -0
- data/ext/wxDC.hpp +18 -0
- data/ext/wxDataView.cpp +224 -0
- data/ext/wxDataView.hpp +45 -0
- data/ext/wxDataViewList.cpp +190 -0
- data/ext/wxDataViewList.hpp +17 -0
- data/ext/wxDatePicker.cpp +103 -0
- data/ext/wxDatePicker.hpp +22 -0
- data/ext/wxDialog.cpp +120 -0
- data/ext/wxDialog.hpp +17 -0
- data/ext/wxDirDialog.cpp +152 -0
- data/ext/wxDirDialog.hpp +20 -0
- data/ext/wxDirPicker.cpp +134 -0
- data/ext/wxDirPicker.hpp +28 -0
- data/ext/wxDirPickerWidget.cpp +127 -0
- data/ext/wxDirPickerWidget.hpp +20 -0
- data/ext/wxError.cpp +67 -0
- data/ext/wxError.hpp +17 -0
- data/ext/wxEvent.cpp +60 -0
- data/ext/wxEvent.hpp +17 -0
- data/ext/wxEvtHandler.cpp +291 -0
- data/ext/wxEvtHandler.hpp +85 -0
- data/ext/wxFileCtrl.cpp +98 -0
- data/ext/wxFileCtrl.hpp +17 -0
- data/ext/wxFileCtrlBase.cpp +219 -0
- data/ext/wxFileCtrlBase.hpp +33 -0
- data/ext/wxFileCtrlGeneric.cpp +106 -0
- data/ext/wxFileCtrlGeneric.hpp +19 -0
- data/ext/wxFileDialog.cpp +268 -0
- data/ext/wxFileDialog.hpp +19 -0
- data/ext/wxFileDirPicker.cpp +89 -0
- data/ext/wxFileDirPicker.hpp +29 -0
- data/ext/wxFileHistory.cpp +134 -0
- data/ext/wxFileHistory.hpp +20 -0
- data/ext/wxFilePicker.cpp +160 -0
- data/ext/wxFilePicker.hpp +28 -0
- data/ext/wxFilePickerWidget.cpp +139 -0
- data/ext/wxFilePickerWidget.hpp +20 -0
- data/ext/wxFont.cpp +542 -0
- data/ext/wxFont.hpp +37 -0
- data/ext/wxFontDialog.cpp +143 -0
- data/ext/wxFontDialog.hpp +21 -0
- data/ext/wxFontPicker.cpp +160 -0
- data/ext/wxFontPicker.hpp +21 -0
- data/ext/wxFontPickerWidget.cpp +128 -0
- data/ext/wxFontPickerWidget.hpp +20 -0
- data/ext/wxFrame.cpp +274 -0
- data/ext/wxFrame.hpp +17 -0
- data/ext/wxGauge.cpp +167 -0
- data/ext/wxGauge.hpp +17 -0
- data/ext/wxGrid.cpp +250 -0
- data/ext/wxGrid.hpp +43 -0
- data/ext/wxGridCellAttr.cpp +68 -0
- data/ext/wxGridCellAttr.hpp +26 -0
- data/ext/wxGridCellRenderer.cpp +120 -0
- data/ext/wxGridCellRenderer.hpp +30 -0
- data/ext/wxGridTable.cpp +111 -0
- data/ext/wxGridTable.hpp +47 -0
- data/ext/wxHyperLink.cpp +148 -0
- data/ext/wxHyperLink.hpp +20 -0
- data/ext/wxImage.cpp +884 -0
- data/ext/wxImage.hpp +24 -0
- data/ext/wxInfoBar.cpp +85 -0
- data/ext/wxInfoBar.hpp +21 -0
- data/ext/wxInfoBarBase.cpp +145 -0
- data/ext/wxInfoBarBase.hpp +21 -0
- data/ext/wxInfoBarGeneric.cpp +90 -0
- data/ext/wxInfoBarGeneric.hpp +21 -0
- data/ext/wxItemContainer.cpp +313 -0
- data/ext/wxItemContainer.hpp +17 -0
- data/ext/wxKeyEvent.cpp +35 -0
- data/ext/wxKeyEvent.hpp +16 -0
- data/ext/wxListBook.cpp +90 -0
- data/ext/wxListBook.hpp +21 -0
- data/ext/wxListBox.cpp +290 -0
- data/ext/wxListBox.hpp +29 -0
- data/ext/wxMenu.cpp +600 -0
- data/ext/wxMenu.hpp +17 -0
- data/ext/wxMenuBar.cpp +180 -0
- data/ext/wxMenuBar.hpp +17 -0
- data/ext/wxMenuItem.cpp +174 -0
- data/ext/wxMenuItem.hpp +17 -0
- data/ext/wxMessageDialog.cpp +91 -0
- data/ext/wxMessageDialog.hpp +19 -0
- data/ext/wxMessageDialogBase.cpp +152 -0
- data/ext/wxMessageDialogBase.hpp +18 -0
- data/ext/wxMessageDialogGeneric.cpp +91 -0
- data/ext/wxMessageDialogGeneric.hpp +19 -0
- data/ext/wxMouseEvent.cpp +60 -0
- data/ext/wxMouseEvent.hpp +16 -0
- data/ext/wxMultiChoiceDialog.cpp +143 -0
- data/ext/wxMultiChoiceDialog.hpp +19 -0
- data/ext/wxNoteBook.cpp +89 -0
- data/ext/wxNoteBook.hpp +21 -0
- data/ext/wxNotifyEvent.cpp +45 -0
- data/ext/wxNotifyEvent.hpp +16 -0
- data/ext/wxNumberEntryDialog.cpp +131 -0
- data/ext/wxNumberEntryDialog.hpp +20 -0
- data/ext/wxPalette.cpp +214 -0
- data/ext/wxPalette.hpp +24 -0
- data/ext/wxPanel.cpp +77 -0
- data/ext/wxPanel.hpp +19 -0
- data/ext/wxPasswordEntryDialog.cpp +141 -0
- data/ext/wxPasswordEntryDialog.hpp +20 -0
- data/ext/wxPen.cpp +323 -0
- data/ext/wxPen.hpp +37 -0
- data/ext/wxPickerBase.cpp +121 -0
- data/ext/wxPickerBase.hpp +28 -0
- data/ext/wxPoint.cpp +224 -0
- data/ext/wxPoint.hpp +40 -0
- data/ext/wxPreferences.cpp +149 -0
- data/ext/wxPreferences.hpp +18 -0
- data/ext/wxProgressDialog.cpp +171 -0
- data/ext/wxProgressDialog.hpp +20 -0
- data/ext/wxProperty.cpp +723 -0
- data/ext/wxProperty.hpp +16 -0
- data/ext/wxPropertyCell.cpp +99 -0
- data/ext/wxPropertyCell.hpp +16 -0
- data/ext/wxPropertyGrid.cpp +234 -0
- data/ext/wxPropertyGrid.hpp +20 -0
- data/ext/wxPropertyGridInterface.cpp +146 -0
- data/ext/wxPropertyGridInterface.hpp +33 -0
- data/ext/wxPropertyGridManager.cpp +257 -0
- data/ext/wxPropertyGridManager.hpp +20 -0
- data/ext/wxPropertyGridPage.cpp +65 -0
- data/ext/wxPropertyGridPage.hpp +20 -0
- data/ext/wxRadioBox.cpp +405 -0
- data/ext/wxRadioBox.hpp +20 -0
- data/ext/wxRadioButton.cpp +107 -0
- data/ext/wxRadioButton.hpp +16 -0
- data/ext/wxRearrangeCtrl.cpp +89 -0
- data/ext/wxRearrangeCtrl.hpp +20 -0
- data/ext/wxRearrangeDialog.cpp +122 -0
- data/ext/wxRearrangeDialog.hpp +20 -0
- data/ext/wxRearrangeList.cpp +94 -0
- data/ext/wxRearrangeList.hpp +20 -0
- data/ext/wxRect.cpp +281 -0
- data/ext/wxRect.hpp +29 -0
- data/ext/wxRichMessageDialog.cpp +91 -0
- data/ext/wxRichMessageDialog.hpp +21 -0
- data/ext/wxRichTextAttr.cpp +69 -0
- data/ext/wxRichTextAttr.hpp +28 -0
- data/ext/wxRichTextCtrl.cpp +484 -0
- data/ext/wxRichTextCtrl.hpp +21 -0
- data/ext/wxRichTextStyle.cpp +86 -0
- data/ext/wxRichTextStyle.hpp +25 -0
- data/ext/wxRichTextStyleSheet.cpp +497 -0
- data/ext/wxRichTextStyleSheet.hpp +21 -0
- data/ext/wxSTC.cpp +331 -0
- data/ext/wxSTC.hpp +21 -0
- data/ext/wxScrollEvent.cpp +43 -0
- data/ext/wxScrollEvent.hpp +16 -0
- data/ext/wxSearchCtrl.cpp +189 -0
- data/ext/wxSearchCtrl.hpp +21 -0
- data/ext/wxSimpleBook.cpp +89 -0
- data/ext/wxSimpleBook.hpp +21 -0
- data/ext/wxSingleChoiceDialog.cpp +147 -0
- data/ext/wxSingleChoiceDialog.hpp +19 -0
- data/ext/wxSize.cpp +206 -0
- data/ext/wxSize.hpp +32 -0
- data/ext/wxSizer.cpp +368 -0
- data/ext/wxSizer.hpp +23 -0
- data/ext/wxSizerItem.cpp +37 -0
- data/ext/wxSizerItem.hpp +18 -0
- data/ext/wxSlider.cpp +204 -0
- data/ext/wxSlider.hpp +21 -0
- data/ext/wxSpinButton.cpp +158 -0
- data/ext/wxSpinButton.hpp +20 -0
- data/ext/wxSpinCtrl.cpp +132 -0
- data/ext/wxSpinCtrl.hpp +21 -0
- data/ext/wxStartUpTip.cpp +44 -0
- data/ext/wxStartUpTip.hpp +16 -0
- data/ext/wxStaticBitmap.cpp +79 -0
- data/ext/wxStaticBitmap.hpp +17 -0
- data/ext/wxStaticBitmapBase.cpp +46 -0
- data/ext/wxStaticBitmapBase.hpp +22 -0
- data/ext/wxStaticBitmapGeneric.cpp +82 -0
- data/ext/wxStaticBitmapGeneric.hpp +17 -0
- data/ext/wxStaticBox.cpp +92 -0
- data/ext/wxStaticBox.hpp +22 -0
- data/ext/wxStaticLine.cpp +100 -0
- data/ext/wxStaticLine.hpp +22 -0
- data/ext/wxStaticText.cpp +82 -0
- data/ext/wxStaticText.hpp +21 -0
- data/ext/wxStatusBar.cpp +417 -0
- data/ext/wxStatusBar.hpp +17 -0
- data/ext/wxStream.cpp +41 -0
- data/ext/wxStream.hpp +46 -0
- data/ext/wxTaskBar.cpp +104 -0
- data/ext/wxTaskBar.hpp +41 -0
- data/ext/wxTextArea.cpp +141 -0
- data/ext/wxTextArea.hpp +21 -0
- data/ext/wxTextAttr.cpp +320 -0
- data/ext/wxTextAttr.hpp +28 -0
- data/ext/wxTextCtrl.cpp +177 -0
- data/ext/wxTextCtrl.hpp +30 -0
- data/ext/wxTextEntry.cpp +248 -0
- data/ext/wxTextEntry.hpp +19 -0
- data/ext/wxTextEntryDialog.cpp +133 -0
- data/ext/wxTextEntryDialog.hpp +20 -0
- data/ext/wxTimePicker.cpp +105 -0
- data/ext/wxTimePicker.hpp +22 -0
- data/ext/wxTimer.cpp +106 -0
- data/ext/wxTimer.hpp +16 -0
- data/ext/wxToggleButton.cpp +96 -0
- data/ext/wxToggleButton.hpp +21 -0
- data/ext/wxToolBar.cpp +85 -0
- data/ext/wxToolBar.hpp +17 -0
- data/ext/wxToolBarBase.cpp +615 -0
- data/ext/wxToolBarBase.hpp +17 -0
- data/ext/wxToolBarTool.cpp +179 -0
- data/ext/wxToolBarTool.hpp +16 -0
- data/ext/wxToolBook.cpp +96 -0
- data/ext/wxToolBook.hpp +23 -0
- data/ext/wxToplevel.cpp +125 -0
- data/ext/wxToplevel.hpp +25 -0
- data/ext/wxTreeBook.cpp +240 -0
- data/ext/wxTreeBook.hpp +21 -0
- data/ext/wxTreeCtrl.cpp +443 -0
- data/ext/wxTreeCtrl.hpp +66 -0
- data/ext/wxVariant.cpp +65 -0
- data/ext/wxVariant.hpp +17 -0
- data/ext/wxWindow.cpp +980 -0
- data/ext/wxWindow.hpp +35 -0
- data/ext/wxWizard.cpp +321 -0
- data/ext/wxWizard.hpp +19 -0
- data/ext/wxWizardPage.cpp +137 -0
- data/ext/wxWizardPage.hpp +38 -0
- data/ext/wxXRC.cpp +48 -0
- data/ext/wxXRC.hpp +21 -0
- data/old_tests/button.rb +56 -0
- data/old_tests/file.png +0 -0
- data/old_tests/green.xpm +25 -0
- data/old_tests/new16x16.png +0 -0
- data/old_tests/project.xml +10 -0
- data/old_tests/propertygrid.rb +51 -0
- data/old_tests/red.xpm +25 -0
- data/old_tests/ruby32x32.png +0 -0
- data/old_tests/status.rb +45 -0
- data/old_tests/test.rb +580 -0
- data/old_tests/wizard.xrc +40 -0
- data/old_tests/xrc.rb +38 -0
- data/rwx.gemspec +43 -0
- data/samples/controls/controls.rb +143 -0
- data/samples/controls/icons/choice.bmp +0 -0
- data/samples/controls/icons/choice.xpm +27 -0
- data/samples/controls/icons/combo.bmp +0 -0
- data/samples/controls/icons/combo.xpm +27 -0
- data/samples/controls/icons/gauge.bmp +0 -0
- data/samples/controls/icons/gauge.xpm +27 -0
- data/samples/controls/icons/list.bmp +0 -0
- data/samples/controls/icons/list.xpm +27 -0
- data/samples/controls/icons/radio.bmp +0 -0
- data/samples/controls/icons/radio.xpm +27 -0
- data/samples/controls/icons/stattext.xpm +24 -0
- data/samples/controls/icons/text.bmp +0 -0
- data/samples/controls/icons/text.xpm +27 -0
- data/samples/dialog/dialog_sample.rb +227 -0
- data/samples/sample.xpm +44 -0
- data/samples/widgets/icons/bmpbtn.xpm +37 -0
- data/samples/widgets/icons/bmpcombobox.xpm +54 -0
- data/samples/widgets/icons/button.xpm +54 -0
- data/samples/widgets/icons/checkbox.xpm +54 -0
- data/samples/widgets/icons/choice.xpm +27 -0
- data/samples/widgets/icons/choicebk.xpm +54 -0
- data/samples/widgets/icons/clrpicker.xpm +193 -0
- data/samples/widgets/icons/combobox.xpm +54 -0
- data/samples/widgets/icons/datepick.xpm +200 -0
- data/samples/widgets/icons/dirctrl.xpm +54 -0
- data/samples/widgets/icons/dirpicker.xpm +213 -0
- data/samples/widgets/icons/filepicker.xpm +214 -0
- data/samples/widgets/icons/fontpicker.xpm +185 -0
- data/samples/widgets/icons/gauge.xpm +54 -0
- data/samples/widgets/icons/hyperlnk.xpm +54 -0
- data/samples/widgets/icons/listbook.xpm +54 -0
- data/samples/widgets/icons/listbox.xpm +54 -0
- data/samples/widgets/icons/notebook.xpm +54 -0
- data/samples/widgets/icons/odcombobox.xpm +54 -0
- data/samples/widgets/icons/radiobox.xpm +54 -0
- data/samples/widgets/icons/scrolbar.xpm +54 -0
- data/samples/widgets/icons/slider.xpm +54 -0
- data/samples/widgets/icons/spinbtn.xpm +40 -0
- data/samples/widgets/icons/statbmp.xpm +40 -0
- data/samples/widgets/icons/statbox.xpm +54 -0
- data/samples/widgets/icons/stattext.xpm +54 -0
- data/samples/widgets/icons/text.xpm +54 -0
- data/samples/widgets/icons/timepick.xpm +207 -0
- data/samples/widgets/icons/toggle.xpm +54 -0
- data/samples/widgets/pages/colorpicker.rb +66 -0
- data/samples/widgets/pages/common.rb +17 -0
- data/samples/widgets/widgets.rb +29 -0
- data/samples/xrc/samples.xrc +46 -0
- data/samples/xrc/xrc_sample.rb +59 -0
- data/test/test_color.rb +64 -0
- metadata +470 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 7daea4298f8fa4179a561773567028921b532dfa
|
|
4
|
+
data.tar.gz: 086761364b235c6e588cdccfe7642861dc17b2f7
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 5b613965f1aeb188536fa7ad27cb6b9dca2d69a2bcf0283c6cc23339414335142d6a8c4e2c39372aab544a5b2c5dc94dbb272b81733d2367b68238f9810c65c4
|
|
7
|
+
data.tar.gz: 0ee62eed5e4e037f9f88f171de4fbdb85bfbed0656887a02f01fb1b0dcbf5cbc77b356d6ff102e309a6718751b8346596d6d133a359e7071544bab82f7ccf452
|
data/.gitignore
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Compiled Object files
|
|
2
|
+
*.slo
|
|
3
|
+
*.lo
|
|
4
|
+
*.o
|
|
5
|
+
|
|
6
|
+
# Compiled Dynamic libraries
|
|
7
|
+
*.so
|
|
8
|
+
*.dylib
|
|
9
|
+
*.bundle
|
|
10
|
+
|
|
11
|
+
# Compiled Static libraries
|
|
12
|
+
*.lai
|
|
13
|
+
*.la
|
|
14
|
+
*.a
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
#eclipse project files
|
|
18
|
+
.cproject
|
|
19
|
+
.project
|
|
20
|
+
.settings
|
|
21
|
+
|
|
22
|
+
# Ignore mkmf-generated files
|
|
23
|
+
ext/Makefile
|
|
24
|
+
ext/extconf.h
|
|
25
|
+
ext/mkmf.log
|
|
26
|
+
|
|
27
|
+
#ignore temp files
|
|
28
|
+
*.*~
|
|
29
|
+
|
|
30
|
+
# Generated Packages
|
|
31
|
+
*.gem
|
|
32
|
+
*.rbc
|
|
33
|
+
.bundle
|
|
34
|
+
.config
|
|
35
|
+
coverage
|
|
36
|
+
InstalledFiles
|
|
37
|
+
lib/bundler/man
|
|
38
|
+
pkg
|
|
39
|
+
rdoc
|
|
40
|
+
spec/reports
|
|
41
|
+
test/tmp
|
|
42
|
+
test/version_tmp
|
|
43
|
+
tmp
|
|
44
|
+
|
|
45
|
+
# YARD artifacts
|
|
46
|
+
.yardoc
|
|
47
|
+
_yardoc
|
|
48
|
+
doc/
|
|
49
|
+
/Debug
|
data/COPYING
ADDED
|
File without changes
|
data/README.rdoc
ADDED
|
File without changes
|
data/Rakefile
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# -*- mode: ruby; coding: utf-8 -*-
|
|
2
|
+
gem "rdoc"
|
|
3
|
+
require "tmpdir"
|
|
4
|
+
require "rake"
|
|
5
|
+
require "rake/clean"
|
|
6
|
+
require "rake/testtask"
|
|
7
|
+
require "rubygems/package_task"
|
|
8
|
+
require "rdoc/task"
|
|
9
|
+
|
|
10
|
+
begin
|
|
11
|
+
require 'rake/extensiontask'
|
|
12
|
+
rescue LoadError
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
ENV["RDOCOPT"] = "" if ENV["RDOCOPT"]
|
|
16
|
+
if RDoc::VERSION < "4.1"
|
|
17
|
+
TMPSRCDIR = Dir.mktmpdir
|
|
18
|
+
CLEAN.include(TMPSRCDIR)
|
|
19
|
+
end
|
|
20
|
+
CLOBBER.include("rdoc")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
load "rwx.gemspec"
|
|
24
|
+
|
|
25
|
+
Gem::PackageTask.new(GEMSPEC) do |pkg|
|
|
26
|
+
pkg.need_zip = true
|
|
27
|
+
pkg.need_tar = true
|
|
28
|
+
pkg.need_tar_bz2 = true
|
|
29
|
+
pkg.need_tar_gz = true
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
unless Rake.const_defined?(:ExtensionTask)
|
|
33
|
+
desc "Compiles rwx, outputting ext/rwx.so"
|
|
34
|
+
task :compile do
|
|
35
|
+
cd "ext"
|
|
36
|
+
ruby "extconf.rb"
|
|
37
|
+
sh "make"
|
|
38
|
+
cd ".."
|
|
39
|
+
end
|
|
40
|
+
else
|
|
41
|
+
Rake::ExtensionTask.new('rwx',GEMSPEC) do |t|
|
|
42
|
+
t.ext_dir = "ext"
|
|
43
|
+
t.source_pattern = "*.cpp"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
Rake::ExtensionTask.new('rwx',GEMSPEC) do |t|
|
|
47
|
+
t.ext_dir = "ext"
|
|
48
|
+
t.source_pattern = "*.cpp"
|
|
49
|
+
|
|
50
|
+
t.cross_compile = true # enable cross compilation (requires cross compile toolchain)
|
|
51
|
+
t.cross_platform = 'i386-mswin32' # forces the Windows platform instead of the default one
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
Rake::TestTask.new do |t|
|
|
56
|
+
t.verbose = true
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
RDoc::Task.new do |rdoc|
|
|
60
|
+
rdoc.title = "rwx RDocs"
|
|
61
|
+
rdoc.main = "README.rdoc"
|
|
62
|
+
if RDoc::VERSION < "4.1"
|
|
63
|
+
rdoc.rdoc_files.include("*.rdoc", TMPSRCDIR)
|
|
64
|
+
# We will have another 'rdoc' task that depends on this task
|
|
65
|
+
rdoc.name = :docs
|
|
66
|
+
else
|
|
67
|
+
rdoc.rdoc_files.include("*.rdoc", "ext/*.cpp")
|
|
68
|
+
end
|
|
69
|
+
rdoc.rdoc_dir = "rdoc"
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
if RDoc::VERSION < "4.1"
|
|
73
|
+
|
|
74
|
+
# This task removes the DLL_LOCAL statements temporarily to
|
|
75
|
+
# make RDoc work properly. The stripped sources are to be
|
|
76
|
+
# found in TMPSRCDIR afterwards.
|
|
77
|
+
task :prepare_sources do
|
|
78
|
+
rm_r TMPSRCDIR if File.directory?(TMPSRCDIR)
|
|
79
|
+
|
|
80
|
+
mkdir TMPSRCDIR
|
|
81
|
+
|
|
82
|
+
#cp "ext/*.cpp", TMPSRCDIR
|
|
83
|
+
Dir["ext/*.cpp"].each do |path|
|
|
84
|
+
path = path[/\/(.+)/,1]
|
|
85
|
+
puts "Removing DLL_LOCAL in #{path}"
|
|
86
|
+
|
|
87
|
+
File.write("#{TMPSRCDIR}/#{path}",File.read("ext/#{path}").gsub(/DLL_LOCAL\s?/, ""))
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Removes the temporary directory created by :prepare_sources.
|
|
92
|
+
task :clean_sources do
|
|
93
|
+
rm_r TMPSRCDIR
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
desc "Generate the RDoc documentation."
|
|
97
|
+
task :rdoc => [:prepare_sources, :docs, :clean_sources]
|
|
98
|
+
|
|
99
|
+
end
|
|
100
|
+
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.0.1-dev
|
data/ext/extconf.rb
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
require "mkmf"
|
|
2
|
+
|
|
3
|
+
# add check for member function, does need default constructor for class
|
|
4
|
+
def have_member_func(klass,member,header)
|
|
5
|
+
if have_func("#{klass}().#{member}()",header)
|
|
6
|
+
$defs[-1] = "-DHAVE_#{klass.tr_cpp}_#{member.tr_cpp}"
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
dir_config "rwx"
|
|
11
|
+
|
|
12
|
+
if(wx_config = find_executable('wx-config'))
|
|
13
|
+
|
|
14
|
+
if `#{wx_config} --version`.chomp < "3.0.0"
|
|
15
|
+
abort("wx version outdated, please update to 3.0.0 or newer")
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# An ruby extension does need to be build against
|
|
19
|
+
# the same compiler as ruby was
|
|
20
|
+
unless CONFIG["CC"] && find_executable(CONFIG["CC"])
|
|
21
|
+
abort("C compiler not found!")
|
|
22
|
+
end
|
|
23
|
+
unless CONFIG["CXX"] && find_executable(CONFIG["CXX"])
|
|
24
|
+
abort("C++ compiler not found!")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
cc = `#{wx_config} --cc`.chomp
|
|
28
|
+
unless cc == CONFIG["CC"]
|
|
29
|
+
warn("CC compiler missmatch %s == %s" % [cc, CONFIG["CC"]])
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
cxx = `#{wx_config} --cxx`.chomp
|
|
33
|
+
unless cxx == CONFIG["CXX"]
|
|
34
|
+
warn("CXX compiler missmatch %s == %s" % [cxx, CONFIG["CXX"]])
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
#earlier versions of ruby does not have that constant
|
|
38
|
+
$CXXFLAGS = CONFIG["CXXFLAGS"] unless defined?($CXXFLAGS)
|
|
39
|
+
|
|
40
|
+
#for some function add the base classes
|
|
41
|
+
extra_libs = []
|
|
42
|
+
case `#{wx_config} --basename`
|
|
43
|
+
when /gtk2/
|
|
44
|
+
extra_libs << "gtk+-x11-2.0" << "gdk-x11-2.0"
|
|
45
|
+
when /gtk3/
|
|
46
|
+
extra_libs << "gtk+-x11-3.0" << "gdk-x11-3.0"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
extra_libs.each {|l|
|
|
50
|
+
pkg = pkg_config(l)
|
|
51
|
+
#because pkg forgot to add the include paths to cxx flags
|
|
52
|
+
$CXXFLAGS << pkg[0] if pkg && !$CXXFLAGS[pkg[0]]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
all = " -fvisibility-inlines-hidden"
|
|
56
|
+
$CFLAGS << all << " -x c++ -g -Wall "
|
|
57
|
+
$CXXFLAGS << all << " -g -Wall "
|
|
58
|
+
$CPPFLAGS << all << " -g "
|
|
59
|
+
$LDFLAGS << all << " "
|
|
60
|
+
|
|
61
|
+
# add the wx-config flags
|
|
62
|
+
$CFLAGS << `#{wx_config} --cflags`.chomp
|
|
63
|
+
$CXXFLAGS << `#{wx_config} --cxxflags`.chomp
|
|
64
|
+
$CPPFLAGS << `#{wx_config} --cppflags`.chomp
|
|
65
|
+
$LDFLAGS << `#{wx_config} --libs all`.chomp
|
|
66
|
+
|
|
67
|
+
with_cflags(" -x c++ ") {
|
|
68
|
+
# need c++ for some of the tests
|
|
69
|
+
RbConfig::CONFIG["CC"] = CONFIG["CXX"]
|
|
70
|
+
|
|
71
|
+
have_header("wx/preferences.h")
|
|
72
|
+
|
|
73
|
+
#check for better Bind commmand
|
|
74
|
+
unless have_macro("wxHAS_EVENT_BIND","wx/wx.h")
|
|
75
|
+
abort("need wxHAS_EVENT_BIND, update your compiler!")
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
#check for Default-Constructors
|
|
79
|
+
have_func("wxContextHelpButton()","wx/cshelp.h")
|
|
80
|
+
have_func("wxNumberEntryDialog()","wx/numdlg.h")
|
|
81
|
+
have_func("wxPasswordEntryDialog()","wx/textdlg.h")
|
|
82
|
+
have_func("wxProgressDialog()","wx/progdlg.h")
|
|
83
|
+
have_func("wxMessageDialog()","wx/msgdlg.h")
|
|
84
|
+
have_func("wxGenericMessageDialog()","wx/generic/msgdlgg.h")
|
|
85
|
+
have_func("wxRichMessageDialog()","wx/richmsgdlg.h")
|
|
86
|
+
|
|
87
|
+
#check for instance methods, that classes need to have default constuctor
|
|
88
|
+
have_member_func("wxFontPickerCtrl","GetSelectedColour","wx/fontpicker.h")
|
|
89
|
+
have_member_func("wxInfoBar","GetButtonCount","wx/infobar.h")
|
|
90
|
+
|
|
91
|
+
#check for enum flags
|
|
92
|
+
have_const("wxFD_NO_FOLLOW","wx/filedlg.h")
|
|
93
|
+
have_const("wxDIRCTRL_DEFAULT_STYLE",["wx/wx.h", "wx/dirctrl.h"])
|
|
94
|
+
|
|
95
|
+
}
|
|
96
|
+
else
|
|
97
|
+
abort("wx-config executable not found!")
|
|
98
|
+
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
$defs.push("-DRUBY_UNTYPED_DATA_WARNING=1")
|
|
102
|
+
|
|
103
|
+
#drop some of the warn flags because they are not valid for C++
|
|
104
|
+
CONFIG["warnflags"].gsub!(
|
|
105
|
+
Regexp.union(
|
|
106
|
+
"-Wdeclaration-after-statement",
|
|
107
|
+
"-Wimplicit-function-declaration",
|
|
108
|
+
"-Wextra" #wxAUI is a bit buggy
|
|
109
|
+
), "")
|
|
110
|
+
|
|
111
|
+
create_header
|
|
112
|
+
create_makefile "rwx"
|
data/ext/main.cpp
ADDED
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* main.cpp
|
|
3
|
+
*
|
|
4
|
+
* Created on: 04.05.2012
|
|
5
|
+
* Author: hanmac
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#include "main.hpp"
|
|
9
|
+
|
|
10
|
+
#include <wx/arrstr.h>
|
|
11
|
+
|
|
12
|
+
#include <wx/filename.h>
|
|
13
|
+
|
|
14
|
+
infoholdertype infoklassholder;
|
|
15
|
+
typeholdertype typeklassholder;
|
|
16
|
+
|
|
17
|
+
enumregistertype enumregister;
|
|
18
|
+
|
|
19
|
+
datatypeholdertype datatypeholder;
|
|
20
|
+
datatypeholdertype datatypeholder_const;
|
|
21
|
+
|
|
22
|
+
VALUE global_holder;
|
|
23
|
+
|
|
24
|
+
typedef std::map<VALUE,std::size_t> ref_countertype;
|
|
25
|
+
ref_countertype ref_counter;
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
void rwx_refobject(VALUE object)
|
|
29
|
+
{
|
|
30
|
+
if(ref_counter[object] == 0)
|
|
31
|
+
rb_hash_aset(global_holder,INT2NUM(object),object);
|
|
32
|
+
ref_counter[object]++;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
bool rwx_unrefobject(VALUE object)
|
|
36
|
+
{
|
|
37
|
+
if(ref_counter[object] != 0)
|
|
38
|
+
ref_counter[object]--;
|
|
39
|
+
if(ref_counter[object] == 0) {
|
|
40
|
+
rb_hash_delete(global_holder,INT2NUM(object));
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
void registerDataType(VALUE klass, RUBY_DATA_FUNC freefunc, size_t (*sizefunc)(const void *))
|
|
47
|
+
{
|
|
48
|
+
if(!NIL_P(klass))
|
|
49
|
+
{
|
|
50
|
+
rb_data_type_t str = {
|
|
51
|
+
rb_class2name(klass),
|
|
52
|
+
{0, freefunc, sizefunc,},
|
|
53
|
+
unwrapDataType(RCLASS_SUPER(klass)), NULL,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
datatypeholder[klass] = str;
|
|
57
|
+
if(freefunc) {
|
|
58
|
+
rb_data_type_t str_const = {
|
|
59
|
+
(std::string(rb_class2name(klass)) + "(const)").c_str(),
|
|
60
|
+
{0, 0, sizefunc,},
|
|
61
|
+
&datatypeholder[klass], NULL,
|
|
62
|
+
};
|
|
63
|
+
datatypeholder_const[klass] = str_const;
|
|
64
|
+
}else {
|
|
65
|
+
datatypeholder_const[klass] = str;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
void registerDataType(VALUE klass)
|
|
71
|
+
{
|
|
72
|
+
registerDataType(klass, RUBY_TYPED_NEVER_FREE, NULL);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
void* unwrapTypedPtr(const VALUE &obj, rb_data_type_t* rbdata)
|
|
76
|
+
{
|
|
77
|
+
if(NIL_P(obj))
|
|
78
|
+
return NULL;
|
|
79
|
+
|
|
80
|
+
if(!rbdata) {
|
|
81
|
+
rb_raise(rb_eTypeError,"%s unknown datatype", rb_obj_classname(obj));
|
|
82
|
+
return NULL;
|
|
83
|
+
}
|
|
84
|
+
void* data = Check_TypedStruct(obj, rbdata);
|
|
85
|
+
if(!data) {
|
|
86
|
+
rb_raise(
|
|
87
|
+
rb_eRuntimeError, "destroyed object of %s", rb_obj_classname(obj)
|
|
88
|
+
);
|
|
89
|
+
return NULL;
|
|
90
|
+
}
|
|
91
|
+
return data;
|
|
92
|
+
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
VALUE wrapClass(const wxClassInfo * info)
|
|
96
|
+
{
|
|
97
|
+
infoholdertype::iterator it = infoklassholder.find(info);
|
|
98
|
+
if(it != infoklassholder.end())
|
|
99
|
+
return it->second;
|
|
100
|
+
if(const wxClassInfo *base = info->GetBaseClass1())
|
|
101
|
+
return wrapClass(base);
|
|
102
|
+
return Qnil;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
rb_data_type_t* unwrapDataType(const VALUE& klass)
|
|
106
|
+
{
|
|
107
|
+
if(klass == rb_cObject)
|
|
108
|
+
return NULL;
|
|
109
|
+
datatypeholdertype::iterator it = datatypeholder.find(klass);
|
|
110
|
+
if(it != datatypeholder.end())
|
|
111
|
+
return &it->second;
|
|
112
|
+
return unwrapDataType(RCLASS_SUPER(klass));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
VALUE wrapTypedPtr(void *arg,VALUE klass)
|
|
117
|
+
{
|
|
118
|
+
if(arg){
|
|
119
|
+
rb_data_type_t* datatype = unwrapDataType(klass);
|
|
120
|
+
if(!datatype)
|
|
121
|
+
rb_fatal("%s unknown datatype",rb_class2name(klass));
|
|
122
|
+
|
|
123
|
+
return TypedData_Wrap_Struct(klass, datatype, arg);
|
|
124
|
+
}
|
|
125
|
+
return Qnil;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
#define type_wrap(t,get,set) \
|
|
129
|
+
template <>\
|
|
130
|
+
t unwrap< t >(const VALUE &val )\
|
|
131
|
+
{\
|
|
132
|
+
return get(val);\
|
|
133
|
+
}\
|
|
134
|
+
template <>\
|
|
135
|
+
VALUE wrap< t >(const t &st )\
|
|
136
|
+
{\
|
|
137
|
+
return set(st);\
|
|
138
|
+
}\
|
|
139
|
+
|
|
140
|
+
#define type_wrap_array(t) \
|
|
141
|
+
template <>\
|
|
142
|
+
VALUE wrap< t >(const t &st )\
|
|
143
|
+
{\
|
|
144
|
+
VALUE ary = rb_ary_new();\
|
|
145
|
+
for(t::const_iterator it = st.begin(); it != st.end(); ++it)\
|
|
146
|
+
rb_ary_push(ary,wrap(*it));\
|
|
147
|
+
return ary;\
|
|
148
|
+
}\
|
|
149
|
+
template <>\
|
|
150
|
+
t unwrap< t >(const VALUE &val )\
|
|
151
|
+
{\
|
|
152
|
+
t arry;\
|
|
153
|
+
if(NIL_P(val))\
|
|
154
|
+
return arry;\
|
|
155
|
+
VALUE dp(rb_Array(val));\
|
|
156
|
+
std::size_t length = RARRAY_LEN(dp);\
|
|
157
|
+
for(std::size_t i = 0; i < length; ++i)\
|
|
158
|
+
arry.Add(unwrap<t::value_type>(RARRAY_AREF(dp,i)));\
|
|
159
|
+
return arry;\
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
template <>
|
|
163
|
+
bool unwrap< bool >(const VALUE &val )
|
|
164
|
+
{
|
|
165
|
+
return RTEST(val);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
template <>
|
|
169
|
+
VALUE wrap< bool >(const bool &st )
|
|
170
|
+
{
|
|
171
|
+
return st ? Qtrue : Qfalse;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
type_wrap(int,NUM2INT,INT2NUM)
|
|
175
|
+
type_wrap(double,NUM2DBL,DBL2NUM)
|
|
176
|
+
type_wrap(unsigned int,NUM2UINT,UINT2NUM)
|
|
177
|
+
type_wrap(long,NUM2LONG,LONG2NUM)
|
|
178
|
+
type_wrap(unsigned long,NUM2ULONG,ULONG2NUM)
|
|
179
|
+
|
|
180
|
+
template <>
|
|
181
|
+
VALUE wrap< wxString >(const wxString &st )
|
|
182
|
+
{
|
|
183
|
+
#ifdef HAVE_RUBY_ENCODING_H
|
|
184
|
+
return rb_enc_str_new(st.c_str(),strlen(st.c_str()),rb_utf8_encoding());
|
|
185
|
+
#else
|
|
186
|
+
return rb_str_new2(st.c_str());
|
|
187
|
+
#endif
|
|
188
|
+
}
|
|
189
|
+
template <>
|
|
190
|
+
VALUE wrap< wxChar >(const wxChar &c )
|
|
191
|
+
{
|
|
192
|
+
return wrap(wxString(c));
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
template <>
|
|
196
|
+
char* unwrap< char* >(const VALUE &val )
|
|
197
|
+
{
|
|
198
|
+
if(NIL_P(val))
|
|
199
|
+
return NULL;
|
|
200
|
+
if (rb_obj_is_kind_of(val, rb_cString)){
|
|
201
|
+
return RSTRING_PTR(val);
|
|
202
|
+
}
|
|
203
|
+
else
|
|
204
|
+
return unwrap< char* >(rb_String(val));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
template <>
|
|
208
|
+
wxString unwrap< wxString >(const VALUE &val )
|
|
209
|
+
{
|
|
210
|
+
if(NIL_P(val))
|
|
211
|
+
return wxEmptyString;
|
|
212
|
+
else
|
|
213
|
+
return wxString(unwrap< char* >(val));
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
type_wrap_array(wxArrayString)
|
|
217
|
+
type_wrap_array(wxArrayInt)
|
|
218
|
+
|
|
219
|
+
template <>
|
|
220
|
+
VALUE wrap< wxDateTime >(const wxDateTime &st )
|
|
221
|
+
{
|
|
222
|
+
return rb_time_new(st.GetTicks(),st.GetMillisecond() * 10);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
template <>
|
|
226
|
+
wxDateTime unwrap< wxDateTime >(const VALUE &val )
|
|
227
|
+
{
|
|
228
|
+
wxDateTime result;
|
|
229
|
+
result.SetToCurrent();
|
|
230
|
+
result.MakeTimezone(
|
|
231
|
+
NUM2UINT(rb_funcall(val,rb_intern("gmt_offset"),0)) - 3600,
|
|
232
|
+
RTEST(rb_funcall(val,rb_intern("dst?"),0))
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
result.Set(
|
|
236
|
+
NUM2UINT(rb_funcall(val,rb_intern("day"),0)),
|
|
237
|
+
(wxDateTime::Month)(NUM2UINT(rb_funcall(val,rb_intern("month"),0))-1),
|
|
238
|
+
NUM2UINT(rb_funcall(val,rb_intern("year"),0)),
|
|
239
|
+
NUM2UINT(rb_funcall(val,rb_intern("hour"),0)),
|
|
240
|
+
NUM2UINT(rb_funcall(val,rb_intern("min"),0)),
|
|
241
|
+
NUM2UINT(rb_funcall(val,rb_intern("sec"),0)),
|
|
242
|
+
NUM2UINT(rb_funcall(val,rb_intern("usec"),0)) / 1000
|
|
243
|
+
);
|
|
244
|
+
return result;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
enumtype* registerEnum(const std::string& name,const std::string& type ,int def)
|
|
248
|
+
{
|
|
249
|
+
enumtype *etype = new enumtype;
|
|
250
|
+
enumregister.insert(std::make_pair(type,etype));
|
|
251
|
+
etype->name = name;
|
|
252
|
+
etype->allow_array = true;
|
|
253
|
+
etype->defaults = def;
|
|
254
|
+
return etype;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
VALUE wrapenum(const int &arg, const std::string& name)
|
|
259
|
+
{
|
|
260
|
+
enumtype::value_type &enummap = enumregister[name]->values;
|
|
261
|
+
enumtype::value_type::iterator it = enummap.find(arg);
|
|
262
|
+
if(it != enummap.end())
|
|
263
|
+
return ID2SYM(it->second);
|
|
264
|
+
bool found = false;
|
|
265
|
+
|
|
266
|
+
int carg(arg);
|
|
267
|
+
|
|
268
|
+
VALUE result = rb_ary_new();
|
|
269
|
+
for(it = enummap.begin();it != enummap.end();++it)
|
|
270
|
+
{
|
|
271
|
+
if((carg & it->first) != 0)
|
|
272
|
+
{
|
|
273
|
+
found = true;
|
|
274
|
+
rb_ary_push(result,ID2SYM(it->second));
|
|
275
|
+
carg &= ~it->first;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return found ? result : Qnil;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
int unwrapenum(const VALUE &arg, const std::string& name)
|
|
282
|
+
{
|
|
283
|
+
enumregistertype::iterator it = enumregister.find(name);
|
|
284
|
+
if(it != enumregister.end())
|
|
285
|
+
{
|
|
286
|
+
enumtype* etype = it->second;
|
|
287
|
+
if(NIL_P(arg))
|
|
288
|
+
return etype->defaults;
|
|
289
|
+
else if(SYMBOL_P(arg))
|
|
290
|
+
{
|
|
291
|
+
ID id(SYM2ID(arg));
|
|
292
|
+
|
|
293
|
+
for(enumtype::value_type::iterator it2 = etype->values.begin();
|
|
294
|
+
it2 != etype->values.end();
|
|
295
|
+
++it2)
|
|
296
|
+
{
|
|
297
|
+
if(it2->second == id)
|
|
298
|
+
return it2->first;
|
|
299
|
+
}
|
|
300
|
+
rb_raise(rb_eTypeError,"%s is not a %s-Enum.",rb_id2name(id),etype->name.c_str());
|
|
301
|
+
}else if(rb_obj_is_kind_of(arg,rb_cArray) && etype->allow_array )
|
|
302
|
+
{
|
|
303
|
+
int result = 0;
|
|
304
|
+
size_t count = RARRAY_LEN(arg);
|
|
305
|
+
for(size_t i = 0; i < count; ++i)
|
|
306
|
+
result = result | unwrapenum(RARRAY_AREF(arg,i),name);
|
|
307
|
+
}else
|
|
308
|
+
return NUM2INT(arg);
|
|
309
|
+
}
|
|
310
|
+
return 0;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
int unwrap_iconflag(const VALUE &val,int mask)
|
|
314
|
+
{
|
|
315
|
+
int result = unwrapenum(val,"icon_flag");
|
|
316
|
+
|
|
317
|
+
if((result & mask) != result)
|
|
318
|
+
rb_raise(rb_eTypeError,"%"PRIsVALUE" is not a in %d mask", val, mask);
|
|
319
|
+
|
|
320
|
+
return result;
|
|
321
|
+
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
int unwrap_buttonflag(const VALUE& val)
|
|
325
|
+
{
|
|
326
|
+
return unwrapenum(val,"button_flag");
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
bool check_file_loadable(const wxString& path)
|
|
330
|
+
{
|
|
331
|
+
errno = 0;
|
|
332
|
+
wxFileName dir(wxPathOnly(path));
|
|
333
|
+
dir.MakeAbsolute(wxGetCwd());
|
|
334
|
+
|
|
335
|
+
wxFileName file(path);
|
|
336
|
+
file.MakeAbsolute(wxGetCwd());
|
|
337
|
+
|
|
338
|
+
if(dir.DirExists())
|
|
339
|
+
{
|
|
340
|
+
if(file.FileExists()){
|
|
341
|
+
if(!file.IsFileReadable())
|
|
342
|
+
errno = EACCES;
|
|
343
|
+
}else
|
|
344
|
+
errno = ENOENT;
|
|
345
|
+
}else
|
|
346
|
+
errno = ENOENT;
|
|
347
|
+
|
|
348
|
+
if(errno)
|
|
349
|
+
{
|
|
350
|
+
rb_sys_fail(path.c_str());
|
|
351
|
+
return false;
|
|
352
|
+
}
|
|
353
|
+
return true;
|
|
354
|
+
|
|
355
|
+
}
|
|
356
|
+
bool check_file_saveable(const wxString& path)
|
|
357
|
+
{
|
|
358
|
+
errno = 0;
|
|
359
|
+
|
|
360
|
+
wxFileName dir(wxPathOnly(path));
|
|
361
|
+
dir.MakeAbsolute(wxGetCwd());
|
|
362
|
+
|
|
363
|
+
wxFileName file(path);
|
|
364
|
+
file.MakeAbsolute(wxGetCwd());
|
|
365
|
+
if(dir.DirExists())
|
|
366
|
+
{
|
|
367
|
+
if(file.FileExists() && !file.IsFileWritable())
|
|
368
|
+
errno = EACCES;
|
|
369
|
+
else if(!dir.IsDirWritable())
|
|
370
|
+
errno = EACCES;
|
|
371
|
+
}else
|
|
372
|
+
errno = ENOENT;
|
|
373
|
+
|
|
374
|
+
if(errno)
|
|
375
|
+
{
|
|
376
|
+
rb_sys_fail(path.c_str());
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
bool set_hash_flag_option(VALUE hash,const char* name,const int& flag,int& val)
|
|
383
|
+
{
|
|
384
|
+
VALUE temp;
|
|
385
|
+
if(!NIL_P(temp=rb_hash_aref(hash,ID2SYM(rb_intern(name)))))
|
|
386
|
+
{
|
|
387
|
+
if(RTEST(temp))
|
|
388
|
+
val |= flag;
|
|
389
|
+
else
|
|
390
|
+
val &= ~flag;
|
|
391
|
+
|
|
392
|
+
return true;
|
|
393
|
+
}
|
|
394
|
+
return false;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
bool nil_check(VALUE window,const char* type,bool raise)
|
|
398
|
+
{
|
|
399
|
+
bool result = NIL_P(window);
|
|
400
|
+
if(result && raise)
|
|
401
|
+
rb_raise(rb_eTypeError,"%s can't be nil.",type);
|
|
402
|
+
return !result;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
bool nil_check(VALUE window,VALUE klass, bool raise)
|
|
406
|
+
{
|
|
407
|
+
return nil_check(window,rb_class2name(klass),raise);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
bool nil_check(VALUE window, bool raise)
|
|
411
|
+
{
|
|
412
|
+
return nil_check(window,"window",raise);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
bool check_index(int &cidx,const std::size_t &count)
|
|
416
|
+
{
|
|
417
|
+
bool raise = false;
|
|
418
|
+
if(cidx >= (int)count){
|
|
419
|
+
raise = true;
|
|
420
|
+
}else if(cidx < 0)
|
|
421
|
+
{
|
|
422
|
+
int tmp = cidx + count;
|
|
423
|
+
if(tmp > 0 && tmp <= (int)count)
|
|
424
|
+
cidx = tmp;
|
|
425
|
+
else
|
|
426
|
+
raise = true;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
if(raise)
|
|
430
|
+
rb_raise(rb_eIndexError,"%d out of index",cidx);
|
|
431
|
+
return !raise;
|
|
432
|
+
}
|