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
data/ext/wxToplevel.hpp
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* wxToplevel.hpp
|
|
3
|
+
*
|
|
4
|
+
* Created on: 05.02.2012
|
|
5
|
+
* Author: hanmac
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#ifndef WXTOPLEVEL_HPP_
|
|
9
|
+
#define WXTOPLEVEL_HPP_
|
|
10
|
+
|
|
11
|
+
#include "wxWindow.hpp"
|
|
12
|
+
|
|
13
|
+
extern VALUE rb_cWXTopLevel;
|
|
14
|
+
DLL_LOCAL void Init_WXTopLevel(VALUE rb_mWX);
|
|
15
|
+
|
|
16
|
+
namespace RubyWX {
|
|
17
|
+
namespace TopLevel {
|
|
18
|
+
|
|
19
|
+
void set_style_flags(VALUE hash,int& flags);
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
#endif /* WXTOPLEVEL_HPP_ */
|
data/ext/wxTreeBook.cpp
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* wxTreeBook.cpp
|
|
3
|
+
*
|
|
4
|
+
* Created on: 26.01.2014
|
|
5
|
+
* Author: hanmac
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#include "wxTreeBook.hpp"
|
|
9
|
+
#include "wxBookCtrl.hpp"
|
|
10
|
+
|
|
11
|
+
VALUE rb_cWXTreebook;
|
|
12
|
+
|
|
13
|
+
#if wxUSE_TREEBOOK
|
|
14
|
+
#define _self unwrap<wxTreebook*>(self)
|
|
15
|
+
|
|
16
|
+
namespace RubyWX {
|
|
17
|
+
namespace Treebook {
|
|
18
|
+
|
|
19
|
+
APP_PROTECT(wxTreebook)
|
|
20
|
+
|
|
21
|
+
singlereturn(GetTreeCtrl)
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* call-seq:
|
|
25
|
+
* TreeBookCtrl.new(parent, name, [options])
|
|
26
|
+
* TreeBookCtrl.new(parent, [options])
|
|
27
|
+
*
|
|
28
|
+
* creates a new TreeBookCtrl widget.
|
|
29
|
+
* ===Arguments
|
|
30
|
+
* * parent of this window or nil
|
|
31
|
+
*
|
|
32
|
+
* *options: Hash with possible options to set
|
|
33
|
+
*/
|
|
34
|
+
DLL_LOCAL VALUE _initialize(int argc,VALUE *argv,VALUE self)
|
|
35
|
+
{
|
|
36
|
+
VALUE parent,name,hash;
|
|
37
|
+
|
|
38
|
+
rb_scan_args(argc, argv, "11:",&parent,&name,&hash);
|
|
39
|
+
if(!_created && !rb_obj_is_kind_of(name,rb_cString))
|
|
40
|
+
{
|
|
41
|
+
wxWindowID id(wxID_ANY);
|
|
42
|
+
int style(wxBK_DEFAULT);
|
|
43
|
+
|
|
44
|
+
if(rb_obj_is_kind_of(hash,rb_cHash))
|
|
45
|
+
{
|
|
46
|
+
set_hash_option(hash,"id",id,unwrapID);
|
|
47
|
+
set_hash_option(hash,"style",style);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
_self->Create(unwrap<wxWindow*>(parent),id,wxDefaultPosition,wxDefaultSize,style);
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
rb_call_super(argc,argv);
|
|
55
|
+
|
|
56
|
+
return self;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
DLL_LOCAL bool check_imagelist(wxTreebook* self, VALUE imageid, int& iid)
|
|
62
|
+
{
|
|
63
|
+
if(NIL_P(imageid))
|
|
64
|
+
return true;
|
|
65
|
+
|
|
66
|
+
iid = NUM2INT(imageid);
|
|
67
|
+
wxImageList *imglist = self->GetImageList();
|
|
68
|
+
if(imglist)
|
|
69
|
+
return check_index(iid,imglist->GetImageCount());
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
DLL_LOCAL bool check_window(VALUE self,VALUE hash, VALUE window, wxWindow*& w)
|
|
74
|
+
{
|
|
75
|
+
|
|
76
|
+
if(rb_obj_is_kind_of(window,rb_cClass) && rb_class_inherited(window,rb_cWXWindow)) {
|
|
77
|
+
VALUE argv2[] = {self, hash };
|
|
78
|
+
w = unwrap<wxWindow*>(rb_class_new_instance(2,argv2,window));
|
|
79
|
+
return true;
|
|
80
|
+
}else if(nil_check(window,false))
|
|
81
|
+
{
|
|
82
|
+
return window_parent_check(window,_self,w);
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
/*
|
|
89
|
+
* call-seq:
|
|
90
|
+
* add_sub_page(window, text, [select], [bitmap]) -> true/false
|
|
91
|
+
* add_sub_page(WindowClass, text, [select], [bitmap],**options) [{|window| }] -> true/false
|
|
92
|
+
*
|
|
93
|
+
* adds a new page to the BookCtrl widget.
|
|
94
|
+
*
|
|
95
|
+
* ===Arguments
|
|
96
|
+
* * window is a WX::Window instance
|
|
97
|
+
* * text is the Label of the page. String
|
|
98
|
+
* * select is true/false and says if the new page should be selected
|
|
99
|
+
* * bitmap is a Integer and says the position of the bitmap in the image_list
|
|
100
|
+
* ===Return value
|
|
101
|
+
* true/false
|
|
102
|
+
* === Exceptions
|
|
103
|
+
* [IndexError]
|
|
104
|
+
* * bitmap is greater than the list of bitmaps in the image_list
|
|
105
|
+
* [ArgumentError]
|
|
106
|
+
* * window does not have this BookCtrl as parent
|
|
107
|
+
*
|
|
108
|
+
*/
|
|
109
|
+
DLL_LOCAL VALUE _addSubPage(int argc,VALUE *argv,VALUE self)
|
|
110
|
+
{
|
|
111
|
+
VALUE window,text,select,imageid,hash;
|
|
112
|
+
wxWindow *w = NULL;
|
|
113
|
+
bool sel = false;
|
|
114
|
+
int iid = -1;
|
|
115
|
+
rb_scan_args(argc, argv, "22:",&window,&text,&select,&imageid,&hash);
|
|
116
|
+
|
|
117
|
+
if(!NIL_P(select))
|
|
118
|
+
sel = RTEST(select);
|
|
119
|
+
|
|
120
|
+
check_imagelist(_self,imageid,iid);
|
|
121
|
+
check_window(self,hash,window,w);
|
|
122
|
+
|
|
123
|
+
return wrap(_self->AddSubPage(w,unwrap<wxString>(text),sel,iid));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
/*
|
|
128
|
+
* call-seq:
|
|
129
|
+
* insert_sub_page(pos, window, text, [select], [bitmap]) -> true/false
|
|
130
|
+
* insert_sub_page(pos, WindowClass, text, [select], [bitmap],**options) [{|window| }] -> true/false
|
|
131
|
+
*
|
|
132
|
+
* inserts a new page to the BookCtrl widget into the given position.
|
|
133
|
+
*
|
|
134
|
+
* ===Arguments
|
|
135
|
+
* * pos is a Integer
|
|
136
|
+
* * window is a WX::Window instance
|
|
137
|
+
* * text is the Label of the page. String
|
|
138
|
+
* * select is true/false and says if the new page should be selected
|
|
139
|
+
* * bitmap is a Integer and says the position of the bitmap in the image_list
|
|
140
|
+
* ===Return value
|
|
141
|
+
* true/false
|
|
142
|
+
* === Exceptions
|
|
143
|
+
* [IndexError]
|
|
144
|
+
* * bitmap is greater than the list of bitmaps in the image_list
|
|
145
|
+
* [ArgumentError]
|
|
146
|
+
* * window does not have this BookCtrl as parent
|
|
147
|
+
*
|
|
148
|
+
*/
|
|
149
|
+
DLL_LOCAL VALUE _insertSubPage(int argc,VALUE *argv,VALUE self)
|
|
150
|
+
{
|
|
151
|
+
VALUE n,window,text,select,imageid,hash;
|
|
152
|
+
wxWindow *w = NULL;
|
|
153
|
+
bool sel = false;
|
|
154
|
+
int iid = -1;
|
|
155
|
+
rb_scan_args(argc, argv, "32:",&n,&window,&text,&select,&imageid,&hash);
|
|
156
|
+
|
|
157
|
+
check_imagelist(_self,imageid,iid);
|
|
158
|
+
check_window(self,hash,window,w);
|
|
159
|
+
|
|
160
|
+
return wrap(_self->InsertSubPage(NUM2INT(n),w,unwrap<wxString>(text),sel,iid));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
/*
|
|
165
|
+
* call-seq:
|
|
166
|
+
* prepend_sub_page(window, text, [select], [bitmap]) -> true/false
|
|
167
|
+
* prepend_sub_page(WindowClass, text, [select], [bitmap],**options) [{|window| }] -> true/false
|
|
168
|
+
*
|
|
169
|
+
* prepends a new page to the BookCtrl widget.
|
|
170
|
+
*
|
|
171
|
+
* ===Arguments
|
|
172
|
+
* * window is a WX::Window instance
|
|
173
|
+
* * text is the Label of the page. String
|
|
174
|
+
* * select is true/false and says if the new page should be selected
|
|
175
|
+
* * bitmap is a Integer and says the position of the bitmap in the image_list
|
|
176
|
+
* ===Return value
|
|
177
|
+
* true/false
|
|
178
|
+
* === Exceptions
|
|
179
|
+
* [IndexError]
|
|
180
|
+
* * bitmap is greater than the list of bitmaps in the image_list
|
|
181
|
+
* [ArgumentError]
|
|
182
|
+
* * window does not have this BookCtrl as parent
|
|
183
|
+
*
|
|
184
|
+
*/
|
|
185
|
+
DLL_LOCAL VALUE _prependSubPage(int argc,VALUE *argv,VALUE self)
|
|
186
|
+
{
|
|
187
|
+
VALUE window,text,select,imageid,hash;
|
|
188
|
+
wxWindow *w = NULL;
|
|
189
|
+
bool sel = false;
|
|
190
|
+
int iid = -1;
|
|
191
|
+
rb_scan_args(argc, argv, "22:",&window,&text,&select,&imageid,&hash);
|
|
192
|
+
|
|
193
|
+
if(!NIL_P(select))
|
|
194
|
+
sel = RTEST(select);
|
|
195
|
+
|
|
196
|
+
check_imagelist(_self,imageid,iid);
|
|
197
|
+
check_window(self,hash,window,w);
|
|
198
|
+
|
|
199
|
+
return wrap(_self->InsertSubPage(0,w,unwrap<wxString>(text),sel,iid));
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
#endif
|
|
204
|
+
DLL_LOCAL void Init_WXTreeBookCtrl(VALUE rb_mWX)
|
|
205
|
+
{
|
|
206
|
+
#if 0
|
|
207
|
+
rb_mWX = rb_define_module("WX");
|
|
208
|
+
rb_mWXEvtHandler = rb_define_module_under(rb_mWX,"EvtHandler");
|
|
209
|
+
|
|
210
|
+
rb_cWXWindow = rb_define_class_under(rb_mWX,"Window",rb_cObject);
|
|
211
|
+
rb_cWXControl = rb_define_class_under(rb_mWX,"Control",rb_cWXWindow);
|
|
212
|
+
rb_cWXBookCtrlBase = rb_define_class_under(rb_mWX,"BookCtrl",rb_cWXControl);
|
|
213
|
+
#endif
|
|
214
|
+
|
|
215
|
+
#if wxUSE_TREEBOOK
|
|
216
|
+
using namespace RubyWX::Treebook;
|
|
217
|
+
rb_cWXTreebook = rb_define_class_under(rb_mWX,"TreeBookCtrl",rb_cWXBookCtrlBase);
|
|
218
|
+
rb_define_alloc_func(rb_cWXTreebook,_alloc);
|
|
219
|
+
|
|
220
|
+
rb_define_method(rb_cWXTreebook,"initialize",RUBY_METHOD_FUNC(_initialize),-1);
|
|
221
|
+
|
|
222
|
+
rb_define_method(rb_cWXTreebook,"add_sub_page",RUBY_METHOD_FUNC(_addSubPage),-1);
|
|
223
|
+
rb_define_method(rb_cWXTreebook,"insert_sub_page",RUBY_METHOD_FUNC(_insertSubPage),-1);
|
|
224
|
+
rb_define_method(rb_cWXTreebook,"prepend_sub_page",RUBY_METHOD_FUNC(_prependSubPage),-1);
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
registerInfo<wxTreebook>(rb_cWXTreebook);
|
|
228
|
+
|
|
229
|
+
registerEventType<wxBookCtrlEvent>("treebook_page_changed",wxEVT_TREEBOOK_PAGE_CHANGED);
|
|
230
|
+
registerEventType<wxBookCtrlEvent>("treebook_page_changing",wxEVT_TREEBOOK_PAGE_CHANGING);
|
|
231
|
+
registerEventType<wxBookCtrlEvent>("treebook_node_collapsed",wxEVT_TREEBOOK_NODE_COLLAPSED);
|
|
232
|
+
registerEventType<wxBookCtrlEvent>("treebook_node_expanded",wxEVT_TREEBOOK_NODE_EXPANDED);
|
|
233
|
+
#endif
|
|
234
|
+
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
data/ext/wxTreeBook.hpp
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* wxTreebook.hpp
|
|
3
|
+
*
|
|
4
|
+
* Created on: 26.01.2014
|
|
5
|
+
* Author: hanmac
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#ifndef WXTREEBOOK_HPP_
|
|
9
|
+
#define WXTREEBOOK_HPP_
|
|
10
|
+
|
|
11
|
+
#include "wxEvtHandler.hpp"
|
|
12
|
+
|
|
13
|
+
extern VALUE rb_cWXTreebook;
|
|
14
|
+
|
|
15
|
+
void Init_WXTreeBookCtrl(VALUE rb_mWX);
|
|
16
|
+
|
|
17
|
+
#if wxUSE_TREEBOOK
|
|
18
|
+
#include <wx/treebook.h>
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
#endif /* WXTREEBOOK_HPP_ */
|
data/ext/wxTreeCtrl.cpp
ADDED
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* wxTreeCtrl.cpp
|
|
3
|
+
*
|
|
4
|
+
* Created on: 12.03.2012
|
|
5
|
+
* Author: hanmac
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#include "wxTreeCtrl.hpp"
|
|
9
|
+
#include "wxFont.hpp"
|
|
10
|
+
#include "wxColor.hpp"
|
|
11
|
+
#include "wxBitmap.hpp"
|
|
12
|
+
|
|
13
|
+
#include "wxPoint.hpp"
|
|
14
|
+
|
|
15
|
+
VALUE rb_cWXTreeCtrl,rb_cWXTreeCtrlItem,rb_cWXTreeCtrlEvent;
|
|
16
|
+
#if wxUSE_TREECTRL
|
|
17
|
+
|
|
18
|
+
template <>
|
|
19
|
+
wxTreeItemId unwrap< wxTreeItemId >(const VALUE &vwindow)
|
|
20
|
+
{
|
|
21
|
+
return unwrapTypedPtr<RubyTreeCtrlItem>(vwindow, rb_cWXTreeCtrl)->GetId();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
namespace RubyWX {
|
|
25
|
+
namespace TreeCtrl {
|
|
26
|
+
|
|
27
|
+
#define _self unwrap<wxTreeCtrl*>(self)
|
|
28
|
+
|
|
29
|
+
macro_attr(Indent,unsigned int)
|
|
30
|
+
macro_attr(Spacing,unsigned int)
|
|
31
|
+
|
|
32
|
+
macro_attr(ImageList,wxImageList*)
|
|
33
|
+
macro_attr(StateImageList,wxImageList*)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
APP_PROTECT(wxTreeCtrl)
|
|
37
|
+
|
|
38
|
+
DLL_LOCAL VALUE _initialize(int argc,VALUE *argv,VALUE self)
|
|
39
|
+
{
|
|
40
|
+
VALUE parent,name,hash;
|
|
41
|
+
rb_scan_args(argc, argv, "11:",&parent,&name,&hash);
|
|
42
|
+
if(!_created && !rb_obj_is_kind_of(name,rb_cString)) {
|
|
43
|
+
wxWindowID id(wxID_ANY);
|
|
44
|
+
wxString label(wxEmptyString);
|
|
45
|
+
int style(wxTR_DEFAULT_STYLE);
|
|
46
|
+
|
|
47
|
+
if(rb_obj_is_kind_of(hash,rb_cHash)) {
|
|
48
|
+
set_hash_option(hash,"id",id,unwrapID);
|
|
49
|
+
set_hash_option(hash,"label",label);
|
|
50
|
+
set_hash_option(hash,"style",style);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
_self->Create(
|
|
54
|
+
unwrap<wxWindow*>(parent),id,
|
|
55
|
+
wxDefaultPosition,wxDefaultSize,
|
|
56
|
+
style
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
rb_call_super(argc,argv);
|
|
62
|
+
rb_call_super(argc,argv);
|
|
63
|
+
return self;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
DLL_LOCAL VALUE _root(int argc,VALUE *argv,VALUE self)
|
|
67
|
+
{
|
|
68
|
+
VALUE str, id, selid;
|
|
69
|
+
rb_scan_args(argc, argv, "03",&str, &id, &selid);
|
|
70
|
+
int cid = -1,cselid = -1;
|
|
71
|
+
if(NIL_P(str) || _self->GetRootItem().IsOk())
|
|
72
|
+
return wrap(_self,_self->GetRootItem());
|
|
73
|
+
if(!NIL_P(id))
|
|
74
|
+
cid = NUM2INT(id);
|
|
75
|
+
if(!NIL_P(selid))
|
|
76
|
+
cid = NUM2INT(selid);
|
|
77
|
+
VALUE result = wrap(_self,_self->AddRoot(unwrap<wxString>(str),cid,cselid));
|
|
78
|
+
if(rb_block_given_p())
|
|
79
|
+
rb_yield(result);
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
DLL_LOCAL VALUE _getSelection(VALUE self)
|
|
84
|
+
{
|
|
85
|
+
return wrap(_self,_self->GetSelection());
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
DLL_LOCAL VALUE _setSelection(VALUE self,VALUE item)
|
|
90
|
+
{
|
|
91
|
+
_self->SelectItem(unwrap<wxTreeItemId>(item));
|
|
92
|
+
return item;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
namespace Item {
|
|
96
|
+
#undef _self
|
|
97
|
+
#define _self unwrapTypedPtr<RubyTreeCtrlItem>(self, rb_cWXTreeCtrlItem)
|
|
98
|
+
|
|
99
|
+
macro_attr(State,int)
|
|
100
|
+
macro_attr(Bold,bool)
|
|
101
|
+
macro_attr(Text,wxString)
|
|
102
|
+
macro_attr(Font,wxFont)
|
|
103
|
+
macro_attr(TextColour,wxColour)
|
|
104
|
+
macro_attr(BackgroundColour,wxColour)
|
|
105
|
+
|
|
106
|
+
singlefunc(Delete)
|
|
107
|
+
|
|
108
|
+
DLL_LOCAL VALUE _AppendItem(int argc,VALUE *argv,VALUE self)
|
|
109
|
+
{
|
|
110
|
+
VALUE str, id, selid;
|
|
111
|
+
rb_scan_args(argc, argv, "12",&str, &id, &selid);
|
|
112
|
+
int cid = -1,cselid = -1;
|
|
113
|
+
if(!NIL_P(id))
|
|
114
|
+
cid = NUM2INT(id);
|
|
115
|
+
if(!NIL_P(selid))
|
|
116
|
+
cid = NUM2INT(selid);
|
|
117
|
+
VALUE result = _self->AppendItem(unwrap<wxString>(str),cid,cselid);
|
|
118
|
+
|
|
119
|
+
if(rb_block_given_p())
|
|
120
|
+
rb_yield(result);
|
|
121
|
+
return result;
|
|
122
|
+
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
DLL_LOCAL VALUE _PrependItem(int argc,VALUE *argv,VALUE self)
|
|
126
|
+
{
|
|
127
|
+
VALUE str, id, selid;
|
|
128
|
+
rb_scan_args(argc, argv, "12",&str, &id, &selid);
|
|
129
|
+
int cid = -1,cselid = -1;
|
|
130
|
+
if(!NIL_P(id))
|
|
131
|
+
cid = NUM2INT(id);
|
|
132
|
+
if(!NIL_P(selid))
|
|
133
|
+
cid = NUM2INT(selid);
|
|
134
|
+
VALUE result = _self->PrependItem(unwrap<wxString>(str),cid,cselid);
|
|
135
|
+
|
|
136
|
+
if(rb_block_given_p())
|
|
137
|
+
rb_yield(result);
|
|
138
|
+
return result;
|
|
139
|
+
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
DLL_LOCAL VALUE _GetNextSibling(VALUE self)
|
|
143
|
+
{
|
|
144
|
+
return _self->GetNextSibling();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
DLL_LOCAL VALUE _GetPrevSibling(VALUE self)
|
|
148
|
+
{
|
|
149
|
+
return _self->GetPrevSibling();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
DLL_LOCAL VALUE _compare(VALUE self,VALUE other)
|
|
153
|
+
{
|
|
154
|
+
return _self->compare(unwrapTypedPtr<RubyTreeCtrlItem>(self, rb_cWXTreeCtrlItem));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
DLL_LOCAL VALUE _each(VALUE self)
|
|
158
|
+
{
|
|
159
|
+
RETURN_ENUMERATOR(self,0,NULL);
|
|
160
|
+
_self->each();
|
|
161
|
+
return self;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
namespace Event {
|
|
168
|
+
|
|
169
|
+
#undef _self
|
|
170
|
+
#define _self unwrapTypedPtr<wxTreeEvent>(self, rb_cWXTreeCtrlEvent)
|
|
171
|
+
|
|
172
|
+
macro_attr(Label,wxString)
|
|
173
|
+
macro_attr(ToolTip,wxString)
|
|
174
|
+
|
|
175
|
+
macro_attr(Point,wxPoint)
|
|
176
|
+
|
|
177
|
+
DLL_LOCAL VALUE _GetItem(VALUE self)
|
|
178
|
+
{
|
|
179
|
+
return wrap(static_cast<wxTreeCtrl*>(_self->GetEventObject()),_self->GetItem());
|
|
180
|
+
}
|
|
181
|
+
DLL_LOCAL VALUE _SetItem(VALUE self,VALUE val)
|
|
182
|
+
{
|
|
183
|
+
_self->SetItem(unwrap< wxTreeItemId >(val));
|
|
184
|
+
return val;
|
|
185
|
+
}
|
|
186
|
+
DLL_LOCAL VALUE _GetOldItem(VALUE self)
|
|
187
|
+
{
|
|
188
|
+
return wrap(static_cast<wxTreeCtrl*>(_self->GetEventObject()),_self->GetOldItem());
|
|
189
|
+
}
|
|
190
|
+
DLL_LOCAL VALUE _SetOldItem(VALUE self,VALUE val)
|
|
191
|
+
{
|
|
192
|
+
_self->SetOldItem(unwrap< wxTreeItemId >(val));
|
|
193
|
+
return val;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
RubyTreeCtrlItem::RubyTreeCtrlItem(wxTreeCtrl* tree,wxTreeItemId id) : wxTreeItemData(),
|
|
202
|
+
mRuby(wrapTypedPtr(this,rb_cWXTreeCtrlItem)), mTree(tree)
|
|
203
|
+
{
|
|
204
|
+
SetId(id);
|
|
205
|
+
tree->SetItemData(id,this);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
RubyTreeCtrlItem::~RubyTreeCtrlItem()
|
|
209
|
+
{
|
|
210
|
+
SetId(NULL);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
int RubyTreeCtrlItem::GetState()
|
|
214
|
+
{
|
|
215
|
+
checkDestroyed();
|
|
216
|
+
return mTree->GetItemState(GetId());
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
bool RubyTreeCtrlItem::GetBold()
|
|
220
|
+
{
|
|
221
|
+
checkDestroyed();
|
|
222
|
+
return mTree->IsBold(GetId());
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
wxString RubyTreeCtrlItem::GetText()
|
|
226
|
+
{
|
|
227
|
+
checkDestroyed();
|
|
228
|
+
return mTree->GetItemText(GetId());
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
wxColour RubyTreeCtrlItem::GetTextColour()
|
|
232
|
+
{
|
|
233
|
+
checkDestroyed();
|
|
234
|
+
return mTree->GetItemTextColour(GetId());
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
wxColour RubyTreeCtrlItem::GetBackgroundColour()
|
|
238
|
+
{
|
|
239
|
+
checkDestroyed();
|
|
240
|
+
return mTree->GetItemBackgroundColour(GetId());
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
wxFont RubyTreeCtrlItem::GetFont()
|
|
244
|
+
{
|
|
245
|
+
checkDestroyed();
|
|
246
|
+
return mTree->GetItemFont(GetId());
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
void RubyTreeCtrlItem::SetState(int state)
|
|
251
|
+
{
|
|
252
|
+
checkDestroyed();
|
|
253
|
+
mTree->SetItemState(GetId(),state);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
void RubyTreeCtrlItem::SetBold(bool bold)
|
|
257
|
+
{
|
|
258
|
+
checkDestroyed();
|
|
259
|
+
mTree->SetItemBold(GetId(),bold);
|
|
260
|
+
}
|
|
261
|
+
void RubyTreeCtrlItem::SetText(const wxString& text)
|
|
262
|
+
{
|
|
263
|
+
checkDestroyed();
|
|
264
|
+
mTree->SetItemText(GetId(),text);
|
|
265
|
+
}
|
|
266
|
+
void RubyTreeCtrlItem::SetTextColour(const wxColour& col)
|
|
267
|
+
{
|
|
268
|
+
checkDestroyed();
|
|
269
|
+
mTree->SetItemTextColour(GetId(),col);
|
|
270
|
+
}
|
|
271
|
+
void RubyTreeCtrlItem::SetBackgroundColour(const wxColour& col)
|
|
272
|
+
{
|
|
273
|
+
checkDestroyed();
|
|
274
|
+
mTree->SetItemBackgroundColour(GetId(),col);
|
|
275
|
+
}
|
|
276
|
+
void RubyTreeCtrlItem::SetFont(const wxFont& font)
|
|
277
|
+
{
|
|
278
|
+
checkDestroyed();
|
|
279
|
+
mTree->SetItemFont(GetId(),font);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
void RubyTreeCtrlItem::Delete()
|
|
283
|
+
{
|
|
284
|
+
checkDestroyed();
|
|
285
|
+
mTree->Delete(GetId());
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
void RubyTreeCtrlItem::each()
|
|
289
|
+
{
|
|
290
|
+
wxTreeItemIdValue cookie;
|
|
291
|
+
wxTreeItemId id = mTree->GetFirstChild(GetId(), cookie);
|
|
292
|
+
while(id) {
|
|
293
|
+
rb_yield(wrap(mTree,id));
|
|
294
|
+
id = mTree->GetNextChild(GetId(),cookie);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
VALUE RubyTreeCtrlItem::compare(RubyTreeCtrlItem *cother)
|
|
299
|
+
{
|
|
300
|
+
if(!cother || GetId().IsOk() || !cother->GetId().IsOk() || mTree != cother->mTree)
|
|
301
|
+
return Qnil;
|
|
302
|
+
return INT2FIX(mTree->OnCompareItems(GetId(),cother->GetId()));
|
|
303
|
+
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
VALUE RubyTreeCtrlItem::AppendItem(const wxString& text, int image, int selImage)
|
|
307
|
+
{
|
|
308
|
+
checkDestroyed();
|
|
309
|
+
return wrap(mTree,mTree->AppendItem(GetId(),text,image,selImage));
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
VALUE RubyTreeCtrlItem::PrependItem(const wxString& text, int image, int selImage)
|
|
313
|
+
{
|
|
314
|
+
checkDestroyed();
|
|
315
|
+
return wrap(mTree,mTree->PrependItem(GetId(),text,image,selImage));
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
VALUE RubyTreeCtrlItem::GetNextSibling()
|
|
319
|
+
{
|
|
320
|
+
checkDestroyed();
|
|
321
|
+
return wrap(mTree,mTree->GetNextSibling(GetId()));
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
VALUE RubyTreeCtrlItem::GetPrevSibling()
|
|
325
|
+
{
|
|
326
|
+
checkDestroyed();
|
|
327
|
+
return wrap(mTree,mTree->GetPrevSibling(GetId()));
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
void RubyTreeCtrlItem::checkDestroyed()
|
|
332
|
+
{
|
|
333
|
+
if(!GetId().IsOk())
|
|
334
|
+
rb_raise(rb_eTypeError,"%s has been destroyed",rb_class2name(rb_cWXTreeCtrlItem));
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
VALUE wrap(wxTreeCtrl* tree,wxTreeItemId id)
|
|
339
|
+
{
|
|
340
|
+
if(!id.IsOk())
|
|
341
|
+
return Qnil;
|
|
342
|
+
if(tree->GetItemData(id))
|
|
343
|
+
{
|
|
344
|
+
return dynamic_cast<RubyTreeCtrlItem*>(tree->GetItemData(id))->getRuby();
|
|
345
|
+
}else
|
|
346
|
+
{
|
|
347
|
+
RubyTreeCtrlItem *itemdata = new RubyTreeCtrlItem(tree,id);
|
|
348
|
+
return itemdata->getRuby();
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
#endif
|
|
353
|
+
DLL_LOCAL void Init_WXTreeCtrl(VALUE rb_mWX)
|
|
354
|
+
{
|
|
355
|
+
#if 0
|
|
356
|
+
rb_mWX = rb_define_module("WX");
|
|
357
|
+
rb_cWXWindow = rb_define_class_under(rb_mWX,"Window",rb_cObject);
|
|
358
|
+
|
|
359
|
+
rb_cWXControl = rb_define_class_under(rb_mWX,"Control",rb_cWXWindow);
|
|
360
|
+
#endif
|
|
361
|
+
|
|
362
|
+
#if wxUSE_TREECTRL
|
|
363
|
+
using namespace RubyWX::TreeCtrl;
|
|
364
|
+
rb_cWXTreeCtrl = rb_define_class_under(rb_mWX,"TreeCtrl",rb_cWXControl);
|
|
365
|
+
rb_define_alloc_func(rb_cWXTreeCtrl,_alloc);
|
|
366
|
+
|
|
367
|
+
rb_define_method(rb_cWXTreeCtrl,"initialize",RUBY_METHOD_FUNC(_initialize),-1);
|
|
368
|
+
|
|
369
|
+
rb_define_method(rb_cWXTreeCtrl,"root",RUBY_METHOD_FUNC(_root),-1);
|
|
370
|
+
|
|
371
|
+
rb_define_attr_method(rb_cWXTreeCtrl,"indent",_getIndent,_setIndent);
|
|
372
|
+
rb_define_attr_method(rb_cWXTreeCtrl,"spacing",_getSpacing,_setSpacing);
|
|
373
|
+
|
|
374
|
+
rb_define_attr_method(rb_cWXTreeCtrl,"image_list",_getImageList,_setImageList);
|
|
375
|
+
rb_define_attr_method(rb_cWXTreeCtrl,"state_image_list",_getStateImageList,_setStateImageList);
|
|
376
|
+
|
|
377
|
+
rb_define_attr_method(rb_cWXTreeCtrl,"selection",_getSelection,_setSelection);
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
registerInfo<wxTreeCtrl>(rb_cWXTreeCtrl);
|
|
381
|
+
|
|
382
|
+
rb_cWXTreeCtrlItem = rb_define_class_under(rb_cWXTreeCtrl,"Item",rb_cObject);
|
|
383
|
+
rb_undef_alloc_func(rb_cWXTreeCtrlItem);
|
|
384
|
+
|
|
385
|
+
{
|
|
386
|
+
|
|
387
|
+
using namespace Item;
|
|
388
|
+
rb_define_attr_method(rb_cWXTreeCtrlItem,"state",_getState,_setState);
|
|
389
|
+
rb_define_attr_method(rb_cWXTreeCtrlItem,"bold",_getBold,_setBold);
|
|
390
|
+
rb_define_attr_method(rb_cWXTreeCtrlItem,"text",_getText,_setText);
|
|
391
|
+
rb_define_attr_method(rb_cWXTreeCtrlItem,"font",_getFont,_setFont);
|
|
392
|
+
rb_define_attr_method(rb_cWXTreeCtrlItem,"text_color",_getTextColour,_setTextColour);
|
|
393
|
+
rb_define_attr_method(rb_cWXTreeCtrlItem,"background_color",_getBackgroundColour,_setBackgroundColour);
|
|
394
|
+
|
|
395
|
+
rb_define_method(rb_cWXTreeCtrlItem,"each",RUBY_METHOD_FUNC(_each),0);
|
|
396
|
+
rb_define_method(rb_cWXTreeCtrlItem,"<=>",RUBY_METHOD_FUNC(_compare),1);
|
|
397
|
+
rb_include_module(rb_cWXTreeCtrlItem,rb_mEnumerable);
|
|
398
|
+
rb_include_module(rb_cWXTreeCtrlItem,rb_mComparable);
|
|
399
|
+
|
|
400
|
+
rb_define_method(rb_cWXTreeCtrlItem,"next_sibling",RUBY_METHOD_FUNC(_GetNextSibling),0);
|
|
401
|
+
rb_define_method(rb_cWXTreeCtrlItem,"prev_sibling",RUBY_METHOD_FUNC(_GetPrevSibling),0);
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
rb_define_method(rb_cWXTreeCtrlItem,"delete",RUBY_METHOD_FUNC(_Delete),0);
|
|
405
|
+
|
|
406
|
+
rb_define_method(rb_cWXTreeCtrlItem,"append",RUBY_METHOD_FUNC(_AppendItem),-1);
|
|
407
|
+
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
rb_cWXTreeCtrlEvent = rb_define_class_under(rb_cWXEvent,"TreeCtrl",rb_cWXEvent);
|
|
411
|
+
registerEventType<wxTreeEvent>("tree_begin_drag", wxEVT_TREE_BEGIN_DRAG, rb_cWXTreeCtrlEvent);
|
|
412
|
+
registerEventType<wxTreeEvent>("tree_begin_rdrag", wxEVT_TREE_BEGIN_RDRAG, rb_cWXTreeCtrlEvent);
|
|
413
|
+
registerEventType<wxTreeEvent>("tree_begin_label_edit", wxEVT_TREE_BEGIN_LABEL_EDIT, rb_cWXTreeCtrlEvent);
|
|
414
|
+
registerEventType<wxTreeEvent>("tree_end_label_edit", wxEVT_TREE_END_LABEL_EDIT, rb_cWXTreeCtrlEvent);
|
|
415
|
+
registerEventType<wxTreeEvent>("tree_delete_item", wxEVT_TREE_DELETE_ITEM, rb_cWXTreeCtrlEvent);
|
|
416
|
+
registerEventType<wxTreeEvent>("tree_get_info", wxEVT_TREE_GET_INFO, rb_cWXTreeCtrlEvent);
|
|
417
|
+
registerEventType<wxTreeEvent>("tree_set_info", wxEVT_TREE_SET_INFO, rb_cWXTreeCtrlEvent);
|
|
418
|
+
registerEventType<wxTreeEvent>("tree_item_expanded", wxEVT_TREE_ITEM_EXPANDED, rb_cWXTreeCtrlEvent);
|
|
419
|
+
registerEventType<wxTreeEvent>("tree_item_expanding", wxEVT_TREE_ITEM_EXPANDING, rb_cWXTreeCtrlEvent);
|
|
420
|
+
registerEventType<wxTreeEvent>("tree_item_collapsed", wxEVT_TREE_ITEM_COLLAPSED, rb_cWXTreeCtrlEvent);
|
|
421
|
+
registerEventType<wxTreeEvent>("tree_item_collaping", wxEVT_TREE_ITEM_COLLAPSING, rb_cWXTreeCtrlEvent);
|
|
422
|
+
registerEventType<wxTreeEvent>("tree_sel_changed", wxEVT_TREE_SEL_CHANGED, rb_cWXTreeCtrlEvent);
|
|
423
|
+
registerEventType<wxTreeEvent>("tree_sel_changing", wxEVT_TREE_SEL_CHANGING, rb_cWXTreeCtrlEvent);
|
|
424
|
+
registerEventType<wxTreeEvent>("tree_key_down", wxEVT_TREE_KEY_DOWN, rb_cWXTreeCtrlEvent);
|
|
425
|
+
registerEventType<wxTreeEvent>("tree_item_activated", wxEVT_TREE_ITEM_ACTIVATED, rb_cWXTreeCtrlEvent);
|
|
426
|
+
registerEventType<wxTreeEvent>("tree_item_right_click", wxEVT_TREE_ITEM_RIGHT_CLICK, rb_cWXTreeCtrlEvent);
|
|
427
|
+
registerEventType<wxTreeEvent>("tree_item_middle_click", wxEVT_TREE_ITEM_MIDDLE_CLICK, rb_cWXTreeCtrlEvent);
|
|
428
|
+
registerEventType<wxTreeEvent>("tree_end_drag", wxEVT_TREE_END_DRAG, rb_cWXTreeCtrlEvent);
|
|
429
|
+
registerEventType<wxTreeEvent>("tree_state_image_click", wxEVT_TREE_STATE_IMAGE_CLICK, rb_cWXTreeCtrlEvent);
|
|
430
|
+
registerEventType<wxTreeEvent>("tree_item_gettooltip", wxEVT_TREE_ITEM_GETTOOLTIP, rb_cWXTreeCtrlEvent);
|
|
431
|
+
registerEventType<wxTreeEvent>("tree_item_menu", wxEVT_TREE_ITEM_MENU, rb_cWXTreeCtrlEvent);
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
using namespace Event;
|
|
435
|
+
rb_define_attr_method(rb_cWXTreeCtrlEvent,"label",_getLabel,_setLabel);
|
|
436
|
+
rb_define_attr_method(rb_cWXTreeCtrlEvent,"tooltip",_getToolTip,_setToolTip);
|
|
437
|
+
rb_define_attr_method(rb_cWXTreeCtrlEvent,"point",_getPoint,_setPoint);
|
|
438
|
+
rb_define_attr_method(rb_cWXTreeCtrlEvent,"item",_GetItem,_SetItem);
|
|
439
|
+
rb_define_attr_method(rb_cWXTreeCtrlEvent,"old_item",_GetOldItem,_SetOldItem);
|
|
440
|
+
#endif
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
|