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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* wxToggleButton.hpp
|
|
3
|
+
*
|
|
4
|
+
* Created on: 10.12.2013
|
|
5
|
+
* Author: hanmac
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#ifndef WXTOGGLEBUTTON_HPP_
|
|
9
|
+
#define WXTOGGLEBUTTON_HPP_
|
|
10
|
+
|
|
11
|
+
#include "wxAnyButton.hpp"
|
|
12
|
+
|
|
13
|
+
extern VALUE rb_cWXToggleButton;
|
|
14
|
+
|
|
15
|
+
void Init_WXToggleButton(VALUE rb_mWX);
|
|
16
|
+
|
|
17
|
+
#if wxUSE_TOGGLEBTN
|
|
18
|
+
#include <wx/tglbtn.h>
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
#endif /* WXTOGGLEBUTTON_HPP_ */
|
data/ext/wxToolBar.cpp
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* wxToolBar.cpp
|
|
3
|
+
*
|
|
4
|
+
* Created on: 26.02.2012
|
|
5
|
+
* Author: hanmac
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
#include "wxToolBar.hpp"
|
|
10
|
+
#include "wxToolBarBase.hpp"
|
|
11
|
+
|
|
12
|
+
VALUE rb_cWXToolBar;
|
|
13
|
+
|
|
14
|
+
#if wxUSE_TOOLBAR
|
|
15
|
+
|
|
16
|
+
#define _self unwrap<wxToolBar*>(self)
|
|
17
|
+
|
|
18
|
+
namespace RubyWX {
|
|
19
|
+
namespace ToolBar {
|
|
20
|
+
|
|
21
|
+
APP_PROTECT(wxToolBar)
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* call-seq:
|
|
25
|
+
* ToolBar.new(parent, name, [options])
|
|
26
|
+
* ToolBar.new(parent, [options])
|
|
27
|
+
*
|
|
28
|
+
* creates a new ToolBar widget.
|
|
29
|
+
* ===Arguments
|
|
30
|
+
* * parent of this window or nil
|
|
31
|
+
* * name is a String describing a resource in a loaded xrc
|
|
32
|
+
*
|
|
33
|
+
* *options: Hash with possible options to set
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
DLL_LOCAL VALUE _initialize(int argc,VALUE *argv,VALUE self)
|
|
37
|
+
{
|
|
38
|
+
VALUE parent, name, hash;
|
|
39
|
+
rb_scan_args(argc, argv, "11:",&parent,&name,&hash);
|
|
40
|
+
if(!_created && !rb_obj_is_kind_of(name,rb_cString))
|
|
41
|
+
{
|
|
42
|
+
wxWindowID id(wxID_ANY);
|
|
43
|
+
int style(wxTB_HORIZONTAL);
|
|
44
|
+
|
|
45
|
+
if(rb_obj_is_kind_of(hash,rb_cHash))
|
|
46
|
+
{
|
|
47
|
+
set_hash_option(hash,"id",id,unwrapID);
|
|
48
|
+
set_hash_option(hash,"style",style);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
_self->Create(unwrap<wxWindow*>(parent),id,wxDefaultPosition,wxDefaultSize,style);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
rb_call_super(argc,argv);
|
|
55
|
+
return self;
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
#endif
|
|
63
|
+
|
|
64
|
+
DLL_LOCAL void Init_WXToolBar(VALUE rb_mWX)
|
|
65
|
+
{
|
|
66
|
+
#if 0
|
|
67
|
+
rb_mWX = rb_define_module("WX");
|
|
68
|
+
rb_cWXWindow = rb_define_class_under(rb_mWX,"Window",rb_cObject);
|
|
69
|
+
|
|
70
|
+
rb_cWXControl = rb_define_class_under(rb_mWX,"Control",rb_cWXWindow);
|
|
71
|
+
|
|
72
|
+
rb_cWXToolBarBase = rb_define_class_under(rb_mWX,"ToolBarBase",rb_cWXControl);
|
|
73
|
+
#endif
|
|
74
|
+
#if wxUSE_TOOLBAR
|
|
75
|
+
using namespace RubyWX::ToolBar;
|
|
76
|
+
rb_cWXToolBar = rb_define_class_under(rb_mWX,"ToolBar",rb_cWXToolBarBase);
|
|
77
|
+
rb_define_alloc_func(rb_cWXToolBar,_alloc);
|
|
78
|
+
|
|
79
|
+
rb_define_method(rb_cWXToolBar,"initialize",RUBY_METHOD_FUNC(_initialize),-1);
|
|
80
|
+
|
|
81
|
+
registerInfo<wxToolBar>(rb_cWXToolBar);
|
|
82
|
+
#endif
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
data/ext/wxToolBar.hpp
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* wxToolBar.hpp
|
|
3
|
+
*
|
|
4
|
+
* Created on: 26.02.2012
|
|
5
|
+
* Author: hanmac
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#ifndef WXTOOLBAR_HPP_
|
|
9
|
+
#define WXTOOLBAR_HPP_
|
|
10
|
+
|
|
11
|
+
#include "main.hpp"
|
|
12
|
+
|
|
13
|
+
extern VALUE rb_cWXToolBar;
|
|
14
|
+
|
|
15
|
+
void Init_WXToolBar(VALUE rb_mWX);
|
|
16
|
+
|
|
17
|
+
#endif /* WXTOOLBAR_HPP_ */
|
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* wxToolBarBase.cpp
|
|
3
|
+
*
|
|
4
|
+
* Created on: 30.03.2012
|
|
5
|
+
* Author: hanmac
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#include "wxToolBarBase.hpp"
|
|
9
|
+
#include "wxBitmap.hpp"
|
|
10
|
+
#include "wxToolBarTool.hpp"
|
|
11
|
+
#include "wxControl.hpp"
|
|
12
|
+
|
|
13
|
+
VALUE rb_cWXToolBarBase;
|
|
14
|
+
|
|
15
|
+
#if wxUSE_TOOLBAR
|
|
16
|
+
|
|
17
|
+
#define _self unwrapTypedPtr<wxToolBarBase>(self,rb_cWXToolBarBase)
|
|
18
|
+
|
|
19
|
+
namespace RubyWX {
|
|
20
|
+
namespace ToolBarBase {
|
|
21
|
+
|
|
22
|
+
macro_attr(ToolBitmapSize,wxSize)
|
|
23
|
+
macro_attr(Margins,wxSize)
|
|
24
|
+
|
|
25
|
+
macro_attr(ToolPacking,int)
|
|
26
|
+
macro_attr(ToolSeparation,int)
|
|
27
|
+
|
|
28
|
+
void bind_callback(wxToolBarBase* toolbar,wxWindowID id)
|
|
29
|
+
{
|
|
30
|
+
if(rb_block_given_p()){
|
|
31
|
+
VALUE proc = rb_block_proc();
|
|
32
|
+
|
|
33
|
+
toolbar->Bind(wxEVT_MENU,RubyFunctor(proc),id);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
wxControl* create_control(VALUE self,VALUE ctrl,VALUE hash)
|
|
38
|
+
{
|
|
39
|
+
wxControl *c = NULL;
|
|
40
|
+
if(rb_obj_is_kind_of(ctrl,rb_cClass) && rb_class_inherited(ctrl,rb_cWXControl)) {
|
|
41
|
+
VALUE argv2[] = {self, hash };
|
|
42
|
+
c = unwrap<wxControl*>(rb_class_new_instance(2,argv2,ctrl));
|
|
43
|
+
}else if(nil_check(ctrl)) {
|
|
44
|
+
window_parent_check(ctrl,_self,c);
|
|
45
|
+
}
|
|
46
|
+
return c;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
DLL_LOCAL wxToolBarToolBase* _add_base(int argc,VALUE *argv,VALUE self,wxItemKind kind)
|
|
50
|
+
{
|
|
51
|
+
VALUE id,text,bitmap,bmpDisabled,shorthelp,longhelp;
|
|
52
|
+
rb_scan_args(argc, argv, "24",&id,&text,&bitmap,&bmpDisabled,&shorthelp,&longhelp);
|
|
53
|
+
wxWindowID wxid = unwrapID(id);
|
|
54
|
+
wxToolBarToolBase *tool = _self->AddTool(wxid, unwrap<wxString>(text),
|
|
55
|
+
wrapBitmap(bitmap,wxid,WRAP_BITMAP_RAISE,wxART_TOOLBAR),
|
|
56
|
+
wrapBitmap(bmpDisabled,wxid,WRAP_BITMAP_NULL,wxART_TOOLBAR),kind,
|
|
57
|
+
unwrap<wxString>(shorthelp), unwrap<wxString>(longhelp));
|
|
58
|
+
bind_callback(_self,tool->GetId());
|
|
59
|
+
return tool;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
* call-seq:
|
|
65
|
+
* add_normal(id, text, [bitmap], [disabled_bitmap], [short_help], [long_help]) -> WX::ToolBarBase::Tool
|
|
66
|
+
* add_normal(id, text, [bitmap], [disabled_bitmap], [short_help], [long_help]) {|event| ... } -> WX::ToolBarBase::Tool
|
|
67
|
+
*
|
|
68
|
+
* adds a new normal tool item to the ToolBar widget.
|
|
69
|
+
* when block is given, bind the block to the event of the tool item.
|
|
70
|
+
* ===Arguments
|
|
71
|
+
* * id of the tool item: Symbol/Integer/nil
|
|
72
|
+
* * text is the Label of the tool item. String
|
|
73
|
+
* * bitmap is the icon shown for the tool item. WX::Bitmap, when nil try to get bitmap from id
|
|
74
|
+
* * disabled_bitmap is the icon shown when the tool item is disabled. WX::Bitmap, when nil make one from gray-scaled bitmap.
|
|
75
|
+
* * short_help shown in WX::StatusBar. String
|
|
76
|
+
* * long_help shown in ToolTip. String
|
|
77
|
+
* ===Return value
|
|
78
|
+
* WX::ToolBarBase::Tool
|
|
79
|
+
*
|
|
80
|
+
*/
|
|
81
|
+
DLL_LOCAL VALUE _addNormal(int argc,VALUE *argv,VALUE self)
|
|
82
|
+
{
|
|
83
|
+
return wrap(_add_base(argc,argv,self,wxITEM_NORMAL));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/*
|
|
87
|
+
* call-seq:
|
|
88
|
+
* add_check(id, text, [bitmap], [disabled_bitmap], [short_help], [long_help]) -> WX::ToolBarBase::Tool
|
|
89
|
+
* add_check(id, text, [bitmap], [disabled_bitmap], [short_help], [long_help]) {|event| ... } -> WX::ToolBarBase::Tool
|
|
90
|
+
*
|
|
91
|
+
* adds a new check tool item to the ToolBar widget.
|
|
92
|
+
* when block is given, bind the block to the event of the tool item.
|
|
93
|
+
* ===Arguments
|
|
94
|
+
* * id of the tool item: Symbol/Integer/nil
|
|
95
|
+
* * text is the Label of the tool item. String
|
|
96
|
+
* * bitmap is the icon shown for the tool item. WX::Bitmap, when nil try to get bitmap from id
|
|
97
|
+
* * disabled_bitmap is the icon shown when the tool item is disabled. WX::Bitmap, when nil make one from gray-scaled bitmap.
|
|
98
|
+
* * short_help shown in WX::StatusBar. String
|
|
99
|
+
* * long_help shown in ToolTip. String
|
|
100
|
+
* ===Return value
|
|
101
|
+
* WX::ToolBarBase::Tool
|
|
102
|
+
*
|
|
103
|
+
*/
|
|
104
|
+
DLL_LOCAL VALUE _addCheck(int argc,VALUE *argv,VALUE self)
|
|
105
|
+
{
|
|
106
|
+
return wrap(_add_base(argc,argv,self,wxITEM_CHECK));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/*
|
|
110
|
+
* call-seq:
|
|
111
|
+
* add_radio(id, text, [bitmap], [disabled_bitmap], [short_help], [long_help]) -> WX::ToolBarBase::Tool
|
|
112
|
+
* add_radio(id, text, [bitmap], [disabled_bitmap], [short_help], [long_help]) {|event| ... } -> WX::ToolBarBase::Tool
|
|
113
|
+
*
|
|
114
|
+
* adds a new radio tool item to the ToolBar widget.
|
|
115
|
+
* when block is given, bind the block to the event of the tool item.
|
|
116
|
+
* ===Arguments
|
|
117
|
+
* * id of the tool item: Symbol/Integer/nil
|
|
118
|
+
* * text is the Label of the tool item. String
|
|
119
|
+
* * bitmap is the icon shown for the tool item. WX::Bitmap, when nil try to get bitmap from id
|
|
120
|
+
* * disabled_bitmap is the icon shown when the tool item is disabled. WX::Bitmap, when nil make one from gray-scaled bitmap.
|
|
121
|
+
* * short_help shown in WX::StatusBar. String
|
|
122
|
+
* * long_help shown in ToolTip. String
|
|
123
|
+
* ===Return value
|
|
124
|
+
* WX::ToolBarBase::Tool
|
|
125
|
+
*
|
|
126
|
+
*/
|
|
127
|
+
DLL_LOCAL VALUE _addRadio(int argc,VALUE *argv,VALUE self)
|
|
128
|
+
{
|
|
129
|
+
return wrap(_add_base(argc,argv,self,wxITEM_RADIO));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
/*
|
|
134
|
+
* call-seq:
|
|
135
|
+
* add_control(control, [text]) -> WX::ToolBarBase::Tool
|
|
136
|
+
* add_control(klass, [text], ...) [{|control| ... }] -> WX::ToolBarBase::Tool
|
|
137
|
+
*
|
|
138
|
+
* adds a new control tool item to the ToolBar widget.
|
|
139
|
+
* in the second form create the control from the given class.
|
|
140
|
+
* ===Arguments
|
|
141
|
+
* * control WX::Control widget that will be added to the tool bar. the Tool bar need to be the parent of the widget.
|
|
142
|
+
* * text is the Label of the tool item. String
|
|
143
|
+
* * klass, Class from which the control will be created, it need to inherit from WX::Control
|
|
144
|
+
* ===Return value
|
|
145
|
+
* WX::ToolBarBase::Tool
|
|
146
|
+
* === Exceptions
|
|
147
|
+
* [TypeError]
|
|
148
|
+
* * control is nil or can't be converted into an WX::Control instance
|
|
149
|
+
* [ArgumentError]
|
|
150
|
+
* * control does not have this ToolBar as parent
|
|
151
|
+
*
|
|
152
|
+
*/
|
|
153
|
+
DLL_LOCAL VALUE _addControl(int argc,VALUE *argv,VALUE self)
|
|
154
|
+
{
|
|
155
|
+
VALUE id,text,arg;
|
|
156
|
+
|
|
157
|
+
rb_scan_args(argc, argv, "11:",&id,&text,&arg);
|
|
158
|
+
|
|
159
|
+
wxControl *c = create_control(self,id,arg);
|
|
160
|
+
|
|
161
|
+
return wrap( _self->AddControl(c,unwrap<wxString>(text)));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
DLL_LOCAL wxToolBarToolBase* _insert_base(int argc,VALUE *argv,VALUE self, wxItemKind kind )
|
|
166
|
+
{
|
|
167
|
+
VALUE idx,id,text,bitmap,bmpDisabled,shorthelp,longhelp;
|
|
168
|
+
rb_scan_args(argc, argv, "34",&idx,&id,&text,&bitmap,&bmpDisabled,&shorthelp,&longhelp);
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
int cidx = NUM2INT(idx);
|
|
172
|
+
if(check_index(cidx,_self->GetToolsCount()+1))
|
|
173
|
+
{
|
|
174
|
+
wxWindowID wxid = unwrapID(id);
|
|
175
|
+
|
|
176
|
+
wxToolBarToolBase *tool = _self->InsertTool(cidx, wxid, unwrap<wxString>(text),
|
|
177
|
+
wrapBitmap(bitmap,wxid,WRAP_BITMAP_RAISE,wxART_TOOLBAR),
|
|
178
|
+
wrapBitmap(bmpDisabled,wxid,WRAP_BITMAP_NULL,wxART_TOOLBAR),kind,
|
|
179
|
+
unwrap<wxString>(shorthelp), unwrap<wxString>(longhelp));
|
|
180
|
+
bind_callback(_self,tool->GetId());
|
|
181
|
+
return tool;
|
|
182
|
+
}
|
|
183
|
+
return NULL;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
/*
|
|
189
|
+
* call-seq:
|
|
190
|
+
* insert_normal(pos, id, text, [bitmap], [disabled_bitmap], [short_help], [long_help]) -> WX::ToolBarBase::Tool
|
|
191
|
+
* insert_normal(pos, id, text, [bitmap], [disabled_bitmap], [short_help], [long_help]) {|event| ... } -> WX::ToolBarBase::Tool
|
|
192
|
+
*
|
|
193
|
+
* insert a new normal tool item to the ToolBar widget at the given position.
|
|
194
|
+
* when block is given, bind the block to the event of the tool item.
|
|
195
|
+
* ===Arguments
|
|
196
|
+
* * pos position of the new tool item. Integer
|
|
197
|
+
* * id of the tool item: Symbol/Integer/nil
|
|
198
|
+
* * text is the Label of the tool item. String
|
|
199
|
+
* * bitmap is the icon shown for the tool item. WX::Bitmap, when nil try to get bitmap from id
|
|
200
|
+
* * disabled_bitmap is the icon shown when the tool item is disabled. WX::Bitmap, when nil make one from gray-scaled bitmap.
|
|
201
|
+
* * short_help shown in WX::StatusBar. String
|
|
202
|
+
* * long_help shown in ToolTip. String
|
|
203
|
+
* ===Return value
|
|
204
|
+
* WX::ToolBarBase::Tool
|
|
205
|
+
* === Exceptions
|
|
206
|
+
* [IndexError]
|
|
207
|
+
* * pos is greater than the count of ToolBarItems
|
|
208
|
+
* [ArgumentError]
|
|
209
|
+
* * does raise when either bitmap or disabled_bitmap can't converted into an WX::Bitmap
|
|
210
|
+
*
|
|
211
|
+
*/
|
|
212
|
+
DLL_LOCAL VALUE _insertNormal(int argc,VALUE *argv,VALUE self)
|
|
213
|
+
{
|
|
214
|
+
return wrap(_insert_base(argc,argv,self,wxITEM_NORMAL));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/*
|
|
218
|
+
* call-seq:
|
|
219
|
+
* insert_check(pos, id, text, [bitmap], [disabled_bitmap], [short_help], [long_help]) -> WX::ToolBarBase::Tool
|
|
220
|
+
* insert_check(pos, id, text, [bitmap], [disabled_bitmap], [short_help], [long_help]) {|event| ... } -> WX::ToolBarBase::Tool
|
|
221
|
+
*
|
|
222
|
+
* insert a new check tool item to the ToolBar widget at the given position.
|
|
223
|
+
* when block is given, bind the block to the event of the tool item.
|
|
224
|
+
* ===Arguments
|
|
225
|
+
* * pos position of the new tool item. Integer
|
|
226
|
+
* * id of the tool item: Symbol/Integer/nil
|
|
227
|
+
* * text is the Label of the tool item. String
|
|
228
|
+
* * bitmap is the icon shown for the tool item. WX::Bitmap, when nil try to get bitmap from id
|
|
229
|
+
* * disabled_bitmap is the icon shown when the tool item is disabled. WX::Bitmap, when nil make one from gray-scaled bitmap.
|
|
230
|
+
* * short_help shown in WX::StatusBar. String
|
|
231
|
+
* * long_help shown in ToolTip. String
|
|
232
|
+
* ===Return value
|
|
233
|
+
* WX::ToolBarBase::Tool
|
|
234
|
+
* === Exceptions
|
|
235
|
+
* [IndexError]
|
|
236
|
+
* * pos is greater than the count of ToolBarItems
|
|
237
|
+
* [ArgumentError]
|
|
238
|
+
* * does raise when either bitmap or disabled_bitmap can't converted into an WX::Bitmap
|
|
239
|
+
*
|
|
240
|
+
*/
|
|
241
|
+
DLL_LOCAL VALUE _insertCheck(int argc,VALUE *argv,VALUE self)
|
|
242
|
+
{
|
|
243
|
+
return wrap(_insert_base(argc,argv,self,wxITEM_CHECK));
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
/*
|
|
248
|
+
* call-seq:
|
|
249
|
+
* insert_radio(pos, id, text, [bitmap], [disabled_bitmap], [short_help], [long_help]) -> WX::ToolBarBase::Tool
|
|
250
|
+
* insert_radio(pos, id, text, [bitmap], [disabled_bitmap], [short_help], [long_help]) {|event| ... } -> WX::ToolBarBase::Tool
|
|
251
|
+
*
|
|
252
|
+
* insert a new radio tool item to the ToolBar widget at the given position.
|
|
253
|
+
* when block is given, bind the block to the event of the tool item.
|
|
254
|
+
* ===Arguments
|
|
255
|
+
* * pos position of the new tool item. Integer
|
|
256
|
+
* * id of the tool item: Symbol/Integer/nil
|
|
257
|
+
* * text is the Label of the tool item. String
|
|
258
|
+
* * bitmap is the icon shown for the tool item. WX::Bitmap, when nil try to get bitmap from id
|
|
259
|
+
* * disabled_bitmap is the icon shown when the tool item is disabled. WX::Bitmap, when nil make one from gray-scaled bitmap.
|
|
260
|
+
* * short_help shown in WX::StatusBar. String
|
|
261
|
+
* * long_help shown in ToolTip. String
|
|
262
|
+
* ===Return value
|
|
263
|
+
* WX::ToolBarBase::Tool
|
|
264
|
+
* === Exceptions
|
|
265
|
+
* [IndexError]
|
|
266
|
+
* * pos is greater than the count of ToolBarItems
|
|
267
|
+
* [ArgumentError]
|
|
268
|
+
* * does raise when either bitmap or disabled_bitmap can't converted into an WX::Bitmap
|
|
269
|
+
*
|
|
270
|
+
*/
|
|
271
|
+
DLL_LOCAL VALUE _insertRadio(int argc,VALUE *argv,VALUE self)
|
|
272
|
+
{
|
|
273
|
+
return wrap(_insert_base(argc,argv,self,wxITEM_RADIO));
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
/*
|
|
278
|
+
* call-seq:
|
|
279
|
+
* insert_control(pos, control, [text]) -> WX::ToolBarBase::Tool
|
|
280
|
+
* insert_control(pos, klass, [text], ...) [{|control| ... }] -> WX::ToolBarBase::Tool
|
|
281
|
+
*
|
|
282
|
+
* inserts a new control tool item to the ToolBar widget into the given position.
|
|
283
|
+
* in the second form create the control from the given class.
|
|
284
|
+
* ===Arguments
|
|
285
|
+
* * pos position of the new tool item. Integer
|
|
286
|
+
* * control WX::Control widget that will be added to the tool bar. the Tool bar need to be the parent of the widget.
|
|
287
|
+
* * text is the Label of the tool item. String
|
|
288
|
+
* * klass, Class from which the control will be created, it need to inherit from WX::Control
|
|
289
|
+
* ===Return value
|
|
290
|
+
* WX::ToolBarBase::Tool
|
|
291
|
+
* === Exceptions
|
|
292
|
+
* [IndexError]
|
|
293
|
+
* * pos is greater than the count of ToolBarItems
|
|
294
|
+
* [TypeError]
|
|
295
|
+
* * control is nil or can't be converted into an WX::Control instance
|
|
296
|
+
* [ArgumentError]
|
|
297
|
+
* * control does not have this ToolBar as parent
|
|
298
|
+
*/
|
|
299
|
+
DLL_LOCAL VALUE _insertControl(int argc,VALUE *argv,VALUE self)
|
|
300
|
+
{
|
|
301
|
+
VALUE idx,id,text,arg;
|
|
302
|
+
rb_scan_args(argc, argv, "21:",&idx,&id,&text,&arg);
|
|
303
|
+
int cidx = NUM2INT(idx);
|
|
304
|
+
if(check_index(cidx,_self->GetToolsCount()+1))
|
|
305
|
+
{
|
|
306
|
+
|
|
307
|
+
wxControl *c = create_control(self,id,arg);
|
|
308
|
+
|
|
309
|
+
return wrap( _self->InsertControl(NUM2UINT(idx),c,unwrap<wxString>(text)));
|
|
310
|
+
}
|
|
311
|
+
return Qnil;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/*
|
|
315
|
+
* call-seq:
|
|
316
|
+
* insert_separator(pos) -> WX::ToolBarBase::Tool
|
|
317
|
+
*
|
|
318
|
+
* insert a new separator tool item to the ToolBar widget at the given position.
|
|
319
|
+
* ===Arguments
|
|
320
|
+
* * pos position of the new tool item. Integer
|
|
321
|
+
* ===Return value
|
|
322
|
+
* WX::ToolBarBase::Tool
|
|
323
|
+
* === Exceptions
|
|
324
|
+
* [IndexError]
|
|
325
|
+
* * pos is greater than the count of ToolBarItems
|
|
326
|
+
*/
|
|
327
|
+
DLL_LOCAL VALUE _insert_separator(VALUE self,VALUE idx)
|
|
328
|
+
{
|
|
329
|
+
int cidx = NUM2INT(idx);
|
|
330
|
+
if(check_index(cidx,_self->GetToolsCount()+1))
|
|
331
|
+
{
|
|
332
|
+
return wrap(_self->InsertSeparator(cidx));
|
|
333
|
+
}
|
|
334
|
+
return Qnil;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/*
|
|
338
|
+
* call-seq:
|
|
339
|
+
* insert_stretchable_space(pos) -> WX::ToolBarBase::Tool
|
|
340
|
+
*
|
|
341
|
+
* insert a new stretchable space tool item to the ToolBar widget at the given position.
|
|
342
|
+
* ===Arguments
|
|
343
|
+
* * pos position of the new tool item. Integer
|
|
344
|
+
* ===Return value
|
|
345
|
+
* WX::ToolBarBase::Tool
|
|
346
|
+
* === Exceptions
|
|
347
|
+
* [IndexError]
|
|
348
|
+
* * pos is greater than the count of ToolBarItems
|
|
349
|
+
*/
|
|
350
|
+
DLL_LOCAL VALUE _insert_stretchable_space(VALUE self,VALUE idx)
|
|
351
|
+
{
|
|
352
|
+
int cidx = NUM2INT(idx);
|
|
353
|
+
if(check_index(cidx,_self->GetToolsCount()+1))
|
|
354
|
+
{
|
|
355
|
+
return wrap(_self->InsertStretchableSpace(cidx));
|
|
356
|
+
}
|
|
357
|
+
return Qnil;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
DLL_LOCAL wxToolBarToolBase* _prepend_base(int argc,VALUE *argv,VALUE self, wxItemKind kind )
|
|
363
|
+
{
|
|
364
|
+
VALUE id,text,bitmap,bmpDisabled,shorthelp,longhelp;
|
|
365
|
+
rb_scan_args(argc, argv, "24",&id,&text,&bitmap,&bmpDisabled,&shorthelp,&longhelp);
|
|
366
|
+
|
|
367
|
+
wxWindowID wxid = unwrapID(id);
|
|
368
|
+
wxToolBarToolBase *tool = _self->InsertTool(0, wxid, unwrap<wxString>(text),
|
|
369
|
+
wrapBitmap(bitmap,wxid,WRAP_BITMAP_RAISE,wxART_TOOLBAR),
|
|
370
|
+
wrapBitmap(bmpDisabled,wxid,WRAP_BITMAP_NULL,wxART_TOOLBAR),kind,
|
|
371
|
+
unwrap<wxString>(shorthelp), unwrap<wxString>(longhelp));
|
|
372
|
+
bind_callback(_self,tool->GetId());
|
|
373
|
+
return tool;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
/*
|
|
378
|
+
* call-seq:
|
|
379
|
+
* prepend_normal(id, text, [bitmap], [disabled_bitmap], [short_help], [long_help]) -> WX::ToolBarBase::Tool
|
|
380
|
+
* prepend_normal(id, text, [bitmap], [disabled_bitmap], [short_help], [long_help]) {|event| ... } -> WX::ToolBarBase::Tool
|
|
381
|
+
*
|
|
382
|
+
* prepends a new normal tool item to the ToolBar widget.
|
|
383
|
+
* when block is given, bind the block to the event of the tool item.
|
|
384
|
+
* ===Arguments
|
|
385
|
+
* * id of the tool item: Symbol/Integer/nil
|
|
386
|
+
* * text is the Label of the tool item. String
|
|
387
|
+
* * bitmap is the icon shown for the tool item. WX::Bitmap, when nil try to get bitmap from id
|
|
388
|
+
* * disabled_bitmap is the icon shown when the tool item is disabled. WX::Bitmap, when nil make one from gray-scaled bitmap.
|
|
389
|
+
* * short_help shown in WX::StatusBar. String
|
|
390
|
+
* * long_help shown in ToolTip. String
|
|
391
|
+
* ===Return value
|
|
392
|
+
* WX::ToolBarBase::Tool
|
|
393
|
+
*
|
|
394
|
+
*/
|
|
395
|
+
DLL_LOCAL VALUE _prependNormal(int argc,VALUE *argv,VALUE self)
|
|
396
|
+
{
|
|
397
|
+
return wrap(_prepend_base(argc,argv,self,wxITEM_NORMAL));
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/*
|
|
401
|
+
* call-seq:
|
|
402
|
+
* prepend_check(id, text, [bitmap], [disabled_bitmap], [short_help], [long_help]) -> WX::ToolBarBase::Tool
|
|
403
|
+
* prepend_check(id, text, [bitmap], [disabled_bitmap], [short_help], [long_help]) {|event| ... } -> WX::ToolBarBase::Tool
|
|
404
|
+
*
|
|
405
|
+
* prepends a new check tool item to the ToolBar widget.
|
|
406
|
+
* when block is given, bind the block to the event of the tool item.
|
|
407
|
+
* ===Arguments
|
|
408
|
+
* * id of the tool item: Symbol/Integer/nil
|
|
409
|
+
* * text is the Label of the tool item. String
|
|
410
|
+
* * bitmap is the icon shown for the tool item. WX::Bitmap, when nil try to get bitmap from id
|
|
411
|
+
* * disabled_bitmap is the icon shown when the tool item is disabled. WX::Bitmap, when nil make one from gray-scaled bitmap.
|
|
412
|
+
* * short_help shown in WX::StatusBar. String
|
|
413
|
+
* * long_help shown in ToolTip. String
|
|
414
|
+
* ===Return value
|
|
415
|
+
* WX::ToolBarBase::Tool
|
|
416
|
+
*
|
|
417
|
+
*/
|
|
418
|
+
DLL_LOCAL VALUE _prependCheck(int argc,VALUE *argv,VALUE self)
|
|
419
|
+
{
|
|
420
|
+
return wrap(_prepend_base(argc,argv,self,wxITEM_CHECK));
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/*
|
|
424
|
+
* call-seq:
|
|
425
|
+
* prepend_radio(id, text, [bitmap], [disabled_bitmap], [short_help], [long_help]) -> WX::ToolBarBase::Tool
|
|
426
|
+
* prepend_radio(id, text, [bitmap], [disabled_bitmap], [short_help], [long_help]) {|event| ... } -> WX::ToolBarBase::Tool
|
|
427
|
+
*
|
|
428
|
+
* adds a new radio tool item to the ToolBar widget.
|
|
429
|
+
* when block is given, bind the block to the event of the tool item.
|
|
430
|
+
* ===Arguments
|
|
431
|
+
* * id of the tool item: Symbol/Integer/nil
|
|
432
|
+
* * text is the Label of the tool item. String
|
|
433
|
+
* * bitmap is the icon shown for the tool item. WX::Bitmap, when nil try to get bitmap from id
|
|
434
|
+
* * disabled_bitmap is the icon shown when the tool item is disabled. WX::Bitmap, when nil make one from gray-scaled bitmap.
|
|
435
|
+
* * short_help shown in WX::StatusBar. String
|
|
436
|
+
* * long_help shown in ToolTip. String
|
|
437
|
+
* ===Return value
|
|
438
|
+
* WX::ToolBarBase::Tool
|
|
439
|
+
*
|
|
440
|
+
*/
|
|
441
|
+
DLL_LOCAL VALUE _prependRadio(int argc,VALUE *argv,VALUE self)
|
|
442
|
+
{
|
|
443
|
+
return wrap(_prepend_base(argc,argv,self,wxITEM_RADIO));
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/*
|
|
447
|
+
* call-seq:
|
|
448
|
+
* prepends_control(control, [text]) -> WX::ToolBarBase::Tool
|
|
449
|
+
* prepends_control(klass, [text], ...) [{|control| ... }] -> WX::ToolBarBase::Tool
|
|
450
|
+
*
|
|
451
|
+
* prepends a new control tool item to the ToolBar widget.
|
|
452
|
+
* in the second form create the control from the given class.
|
|
453
|
+
* ===Arguments
|
|
454
|
+
* * control WX::Control widget that will be added to the tool bar. the Tool bar need to be the parent of the widget.
|
|
455
|
+
* * text is the Label of the tool item. String
|
|
456
|
+
* * klass, Class from which the control will be created, it need to inherit from WX::Control
|
|
457
|
+
* ===Return value
|
|
458
|
+
* WX::ToolBarBase::Tool
|
|
459
|
+
* === Exceptions
|
|
460
|
+
* [TypeError]
|
|
461
|
+
* * control is nil or can't be converted into an WX::Control instance
|
|
462
|
+
* [ArgumentError]
|
|
463
|
+
* * control does not have this ToolBar as parent
|
|
464
|
+
*
|
|
465
|
+
*/
|
|
466
|
+
DLL_LOCAL VALUE _prependControl(int argc,VALUE *argv,VALUE self)
|
|
467
|
+
{
|
|
468
|
+
VALUE id,text,arg;
|
|
469
|
+
rb_scan_args(argc, argv, "11:",&id,&text,&arg);
|
|
470
|
+
|
|
471
|
+
wxControl *c = create_control(self,id,arg);
|
|
472
|
+
|
|
473
|
+
return wrap( _self->InsertControl(0,c,unwrap<wxString>(text)));
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/*
|
|
477
|
+
* call-seq:
|
|
478
|
+
* prepend_separator -> WX::ToolBarBase::Tool
|
|
479
|
+
*
|
|
480
|
+
* prepends a new separator tool item to the ToolBar widget.
|
|
481
|
+
* ===Return value
|
|
482
|
+
* WX::ToolBarBase::Tool
|
|
483
|
+
*/
|
|
484
|
+
DLL_LOCAL VALUE _prepend_separator(VALUE self)
|
|
485
|
+
{
|
|
486
|
+
return wrap(_self->InsertSeparator(0));
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/*
|
|
490
|
+
* call-seq:
|
|
491
|
+
* prepend_stretchable_space -> WX::ToolBarBase::Tool
|
|
492
|
+
*
|
|
493
|
+
* prepends a new stretchable space tool item to the ToolBar widget.
|
|
494
|
+
* ===Return value
|
|
495
|
+
* WX::ToolBarBase::Tool
|
|
496
|
+
*/
|
|
497
|
+
DLL_LOCAL VALUE _prepend_stretchable_space(VALUE self)
|
|
498
|
+
{
|
|
499
|
+
return wrap(_self->InsertStretchableSpace(0));
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
DLL_LOCAL VALUE _each_size(VALUE self)
|
|
504
|
+
{
|
|
505
|
+
return UINT2NUM(_self->GetToolsCount());
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
DLL_LOCAL VALUE _each(VALUE self)
|
|
509
|
+
{
|
|
510
|
+
RETURN_SIZED_ENUMERATOR(self,0,NULL,RUBY_METHOD_FUNC(_each_size));
|
|
511
|
+
std::size_t count = _self->GetToolsCount();
|
|
512
|
+
for(std::size_t i = 0; i < count; ++i)
|
|
513
|
+
{
|
|
514
|
+
rb_yield(wrap(const_cast<wxToolBarToolBase*>(_self->GetToolByPos(i))));
|
|
515
|
+
}
|
|
516
|
+
return self;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
DLL_LOCAL VALUE _set_rows(VALUE self,VALUE val)
|
|
520
|
+
{
|
|
521
|
+
_self->SetRows(NUM2INT(val));
|
|
522
|
+
return val;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
singlereturn(AddSeparator)
|
|
527
|
+
singlereturn(AddStretchableSpace)
|
|
528
|
+
|
|
529
|
+
singlereturn(Realize)
|
|
530
|
+
|
|
531
|
+
singlereturn(IsVertical)
|
|
532
|
+
|
|
533
|
+
singlereturn(GetMaxRows)
|
|
534
|
+
|
|
535
|
+
/* Document-method: add_separator
|
|
536
|
+
* call-seq:
|
|
537
|
+
* add_separator -> WX::ToolBarBase::Tool
|
|
538
|
+
*
|
|
539
|
+
* adds a new separator tool item to the ToolBar widget.
|
|
540
|
+
* ===Return value
|
|
541
|
+
* WX::ToolBarBase::Tool
|
|
542
|
+
*/
|
|
543
|
+
|
|
544
|
+
/* Document-method: add_stretchable_space
|
|
545
|
+
* call-seq:
|
|
546
|
+
* add_stretchable_space -> WX::ToolBarBase::Tool
|
|
547
|
+
*
|
|
548
|
+
* adds a new stretchable space tool item to the ToolBar widget.
|
|
549
|
+
* ===Return value
|
|
550
|
+
* WX::ToolBarBase::Tool
|
|
551
|
+
*/
|
|
552
|
+
|
|
553
|
+
/* Document-method: vertical?
|
|
554
|
+
* call-seq:
|
|
555
|
+
* vertical? -> true/false
|
|
556
|
+
*
|
|
557
|
+
* returns true if this control is vertical.
|
|
558
|
+
* ===Return value
|
|
559
|
+
* true/false
|
|
560
|
+
*/
|
|
561
|
+
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
#endif
|
|
566
|
+
|
|
567
|
+
DLL_LOCAL void Init_WXToolBarBase(VALUE rb_mWX)
|
|
568
|
+
{
|
|
569
|
+
#if 0
|
|
570
|
+
rb_mWX = rb_define_module("WX");
|
|
571
|
+
rb_cWXWindow = rb_define_class_under(rb_mWX,"Window",rb_cObject);
|
|
572
|
+
|
|
573
|
+
rb_cWXControl = rb_define_class_under(rb_mWX,"Control",rb_cWXWindow);
|
|
574
|
+
#endif
|
|
575
|
+
|
|
576
|
+
#if wxUSE_TOOLBAR
|
|
577
|
+
using namespace RubyWX::ToolBarBase;
|
|
578
|
+
rb_cWXToolBarBase = rb_define_class_under(rb_mWX,"ToolBarBase",rb_cWXControl);
|
|
579
|
+
rb_undef_alloc_func(rb_cWXToolBarBase);
|
|
580
|
+
|
|
581
|
+
// rb_define_method(rb_cWXToolBarBase,"initialize",RUBY_METHOD_FUNC(_initialize),-1);
|
|
582
|
+
|
|
583
|
+
rb_define_method(rb_cWXToolBarBase,"add_normal",RUBY_METHOD_FUNC(_addNormal),-1);
|
|
584
|
+
rb_define_method(rb_cWXToolBarBase,"add_check",RUBY_METHOD_FUNC(_addCheck),-1);
|
|
585
|
+
rb_define_method(rb_cWXToolBarBase,"add_radio",RUBY_METHOD_FUNC(_addRadio),-1);
|
|
586
|
+
rb_define_method(rb_cWXToolBarBase,"add_control",RUBY_METHOD_FUNC(_addControl),-1);
|
|
587
|
+
|
|
588
|
+
rb_define_method(rb_cWXToolBarBase,"add_separator",RUBY_METHOD_FUNC(_AddSeparator),0);
|
|
589
|
+
rb_define_method(rb_cWXToolBarBase,"add_stretchable_space",RUBY_METHOD_FUNC(_AddStretchableSpace),0);
|
|
590
|
+
|
|
591
|
+
rb_define_method(rb_cWXToolBarBase,"insert_normal",RUBY_METHOD_FUNC(_insertNormal),-1);
|
|
592
|
+
rb_define_method(rb_cWXToolBarBase,"insert_check",RUBY_METHOD_FUNC(_insertCheck),-1);
|
|
593
|
+
rb_define_method(rb_cWXToolBarBase,"insert_radio",RUBY_METHOD_FUNC(_insertRadio),-1);
|
|
594
|
+
rb_define_method(rb_cWXToolBarBase,"insert_control",RUBY_METHOD_FUNC(_insertControl),-1);
|
|
595
|
+
|
|
596
|
+
rb_define_method(rb_cWXToolBarBase,"insert_separator",RUBY_METHOD_FUNC(_insert_separator),1);
|
|
597
|
+
rb_define_method(rb_cWXToolBarBase,"insert_stretchable_space",RUBY_METHOD_FUNC(_insert_stretchable_space),1);
|
|
598
|
+
|
|
599
|
+
rb_define_method(rb_cWXToolBarBase,"prepend_normal",RUBY_METHOD_FUNC(_prependNormal),-1);
|
|
600
|
+
rb_define_method(rb_cWXToolBarBase,"prepend_check",RUBY_METHOD_FUNC(_prependCheck),-1);
|
|
601
|
+
rb_define_method(rb_cWXToolBarBase,"prepend_radio",RUBY_METHOD_FUNC(_prependRadio),-1);
|
|
602
|
+
rb_define_method(rb_cWXToolBarBase,"prepend_control",RUBY_METHOD_FUNC(_prependControl),-1);
|
|
603
|
+
|
|
604
|
+
rb_define_method(rb_cWXToolBarBase,"prepend_separator",RUBY_METHOD_FUNC(_prepend_separator),0);
|
|
605
|
+
rb_define_method(rb_cWXToolBarBase,"prepend_stretchable_space",RUBY_METHOD_FUNC(_prepend_stretchable_space),0);
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
rb_define_method(rb_cWXToolBarBase,"realize",RUBY_METHOD_FUNC(_Realize),0);
|
|
609
|
+
|
|
610
|
+
rb_define_method(rb_cWXToolBarBase,"vertical?",RUBY_METHOD_FUNC(_IsVertical),0);
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
rb_define_method(rb_cWXToolBarBase,"each_tool",RUBY_METHOD_FUNC(_each),0);
|
|
614
|
+
#endif
|
|
615
|
+
}
|