rwx 0.0.1.dev → 0.0.1.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 +4 -4
- data/.gitignore +3 -0
- data/.rspec +2 -0
- data/Rakefile +8 -0
- data/VERSION +1 -1
- data/ext/extconf.rb +5 -1
- data/ext/main.cpp +3 -3
- data/ext/main.hpp +34 -1
- data/ext/rwx.cpp +17 -0
- data/ext/wxAnyButton.cpp +7 -6
- data/ext/wxApp.cpp +1 -1
- data/ext/wxApp.hpp +1 -1
- data/ext/wxAuiBook.cpp +5 -1
- data/ext/wxAuiPane.cpp +7 -6
- data/ext/wxBitmap.cpp +42 -6
- data/ext/wxBitmapButton.cpp +3 -2
- data/ext/wxBitmapComboBox.cpp +25 -11
- data/ext/wxBitmapToggleButton.cpp +4 -2
- data/ext/wxBookCtrl.cpp +13 -13
- data/ext/wxBrush.cpp +69 -12
- data/ext/wxBrush.hpp +6 -0
- data/ext/wxButton.cpp +3 -2
- data/ext/wxCalendarCtrl.cpp +7 -6
- data/ext/wxCalendarCtrlBase.cpp +4 -2
- data/ext/wxCalendarCtrlGeneric.cpp +10 -9
- data/ext/wxCheckBox.cpp +10 -5
- data/ext/wxCheckListBox.cpp +10 -9
- data/ext/wxChoice.cpp +10 -9
- data/ext/wxChoiceBook.cpp +5 -1
- data/ext/wxCollapsiblePane.cpp +8 -5
- data/ext/wxColor.cpp +69 -25
- data/ext/wxColor.hpp +3 -0
- data/ext/wxColorPicker.cpp +11 -5
- data/ext/wxColorPickerWidget.cpp +10 -8
- data/ext/wxComboBox.cpp +3 -3
- data/ext/wxComboCtrl.cpp +220 -0
- data/ext/wxComboCtrl.hpp +22 -0
- data/ext/wxControl.cpp +2 -2
- data/ext/wxDC.cpp +5 -4
- data/ext/wxDatePicker.cpp +10 -7
- data/ext/wxDirCtrl.cpp +161 -0
- data/ext/wxDirCtrl.hpp +21 -0
- data/ext/wxDirPicker.cpp +5 -5
- data/ext/wxDirPickerWidget.cpp +10 -8
- data/ext/wxFileCtrl.cpp +5 -2
- data/ext/wxFileCtrlBase.cpp +31 -7
- data/ext/wxFileCtrlGeneric.cpp +5 -2
- data/ext/wxFileDialog.cpp +20 -25
- data/ext/wxFileDirPicker.cpp +6 -6
- data/ext/wxFilePicker.cpp +6 -6
- data/ext/wxFilePickerWidget.cpp +10 -9
- data/ext/wxFont.cpp +6 -5
- data/ext/wxFontDialog.cpp +11 -22
- data/ext/wxFontPicker.cpp +17 -5
- data/ext/wxFontPickerWidget.cpp +10 -9
- data/ext/wxFrame.cpp +6 -4
- data/ext/wxGauge.cpp +9 -5
- data/ext/wxGrid.cpp +7 -5
- data/ext/wxGridCellAttr.cpp +6 -6
- data/ext/wxHyperLink.cpp +12 -11
- data/ext/wxImage.cpp +15 -10
- data/ext/wxInfoBar.cpp +2 -1
- data/ext/wxInfoBarGeneric.cpp +2 -1
- data/ext/wxItemContainer.cpp +5 -0
- data/ext/wxListBook.cpp +5 -2
- data/ext/wxListBox.cpp +10 -8
- data/ext/wxMenu.cpp +5 -4
- data/ext/wxMenuItem.cpp +9 -7
- data/ext/wxMultiChoiceDialog.cpp +5 -3
- data/ext/wxNoteBook.cpp +4 -2
- data/ext/wxOwnerDrawnComboBox.cpp +223 -0
- data/ext/wxOwnerDrawnComboBox.hpp +22 -0
- data/ext/wxPalette.cpp +1 -1
- data/ext/wxPanel.cpp +4 -3
- data/ext/wxPasswordEntryDialog.cpp +1 -1
- data/ext/wxPen.cpp +49 -10
- data/ext/wxPoint.cpp +6 -6
- data/ext/wxPreferences.cpp +21 -6
- data/ext/wxProperty.cpp +5 -7
- data/ext/wxPropertyCell.cpp +5 -4
- data/ext/wxPropertyGrid.cpp +26 -27
- data/ext/wxPropertyGridManager.cpp +13 -5
- data/ext/wxRadioBox.cpp +14 -11
- data/ext/wxRadioButton.cpp +9 -3
- data/ext/wxRearrangeCtrl.cpp +5 -1
- data/ext/wxRearrangeList.cpp +5 -2
- data/ext/wxRect.cpp +8 -7
- data/ext/wxRichTextCtrl.cpp +12 -6
- data/ext/wxRichTextStyle.cpp +5 -5
- data/ext/wxRichTextStyleSheet.cpp +7 -5
- data/ext/wxSTC.cpp +5 -1
- data/ext/wxSearchCtrl.cpp +12 -10
- data/ext/wxSimpleBook.cpp +5 -1
- data/ext/wxSingleChoiceDialog.cpp +4 -2
- data/ext/wxSize.cpp +8 -7
- data/ext/wxSlider.cpp +12 -7
- data/ext/wxSpinButton.cpp +14 -11
- data/ext/wxSpinButton.hpp +1 -1
- data/ext/wxSpinCtrl.cpp +18 -11
- data/ext/wxSpinCtrlDouble.cpp +161 -0
- data/ext/wxSpinCtrlDouble.hpp +21 -0
- data/ext/wxStaticBitmap.cpp +3 -1
- data/ext/wxStaticBitmapBase.cpp +4 -2
- data/ext/wxStaticBitmapGeneric.cpp +3 -1
- data/ext/wxStaticBox.cpp +7 -6
- data/ext/wxStaticLine.cpp +5 -1
- data/ext/wxStaticText.cpp +5 -1
- data/ext/wxStatusBar.cpp +12 -10
- data/ext/wxTaskBar.cpp +6 -4
- data/ext/wxTextCtrl.cpp +9 -3
- data/ext/wxTextEntry.cpp +8 -3
- data/ext/wxTimePicker.cpp +11 -8
- data/ext/wxTimer.cpp +4 -2
- data/ext/wxToggleButton.cpp +3 -1
- data/ext/wxToolBar.cpp +5 -1
- data/ext/wxToolBarTool.cpp +9 -8
- data/ext/wxToolBook.cpp +5 -2
- data/ext/wxTreeBook.cpp +5 -1
- data/ext/wxTreeCtrl.cpp +8 -7
- data/ext/wxWindow.cpp +3 -1
- data/ext/wxWizard.cpp +10 -10
- data/ext/wxWizardPage.cpp +11 -9
- data/rwx.gemspec +4 -2
- data/samples/controls/controls.rb +0 -5
- data/samples/dialog/dialog_sample.rb +0 -3
- data/spec/color_spec.rb +55 -0
- data/spec/spec_helper.rb +12 -0
- metadata +28 -3
data/ext/wxHyperLink.cpp
CHANGED
@@ -66,11 +66,11 @@ DLL_LOCAL VALUE _initialize(int argc,VALUE *argv,VALUE self)
|
|
66
66
|
set_hash_option(hash,"url",url);
|
67
67
|
set_hash_option(hash,"style",style);
|
68
68
|
}
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
69
|
+
if(nil_check(parent))
|
70
|
+
_self->Create(
|
71
|
+
unwrap<wxWindow*>(parent),id,label,url,
|
72
|
+
wxDefaultPosition,wxDefaultSize,style
|
73
|
+
);
|
74
74
|
|
75
75
|
}
|
76
76
|
|
@@ -116,21 +116,22 @@ DLL_LOCAL void Init_WXHyperLink(VALUE rb_mWX)
|
|
116
116
|
rb_cWXWindow = rb_define_class_under(rb_mWX,"Window",rb_cObject);
|
117
117
|
|
118
118
|
rb_cWXControl = rb_define_class_under(rb_mWX,"Control",rb_cWXWindow);
|
119
|
+
#endif
|
120
|
+
|
121
|
+
#if wxUSE_HYPERLINKCTRL
|
122
|
+
using namespace RubyWX::HyperLink;
|
123
|
+
rb_cWXHyperLink = rb_define_class_under(rb_mWX,"HyperLink",rb_cWXControl);
|
124
|
+
rb_define_alloc_func(rb_cWXHyperLink,_alloc);
|
119
125
|
|
126
|
+
#if 0
|
120
127
|
rb_define_attr(rb_cWXHyperLink,"hover_color",1,1);
|
121
128
|
rb_define_attr(rb_cWXHyperLink,"normal_color",1,1);
|
122
129
|
rb_define_attr(rb_cWXHyperLink,"visited_color",1,1);
|
123
130
|
|
124
131
|
rb_define_attr(rb_cWXHyperLink,"url",1,1);
|
125
132
|
rb_define_attr(rb_cWXHyperLink,"visited",1,1);
|
126
|
-
|
127
133
|
#endif
|
128
134
|
|
129
|
-
#if wxUSE_HYPERLINKCTRL
|
130
|
-
using namespace RubyWX::HyperLink;
|
131
|
-
rb_cWXHyperLink = rb_define_class_under(rb_mWX,"HyperLink",rb_cWXControl);
|
132
|
-
rb_define_alloc_func(rb_cWXHyperLink,_alloc);
|
133
|
-
|
134
135
|
rb_define_method(rb_cWXHyperLink,"initialize",RUBY_METHOD_FUNC(_initialize),-1);
|
135
136
|
|
136
137
|
rb_define_attr_method(rb_cWXHyperLink,"hover_color",_getHoverColour,_setHoverColour);
|
data/ext/wxImage.cpp
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
* Author: hanmac
|
6
6
|
*/
|
7
7
|
|
8
|
+
#include "wxApp.hpp"
|
8
9
|
#include "wxSize.hpp"
|
9
10
|
#include "wxRect.hpp"
|
10
11
|
#include "wxPoint.hpp"
|
@@ -684,6 +685,9 @@ DLL_LOCAL VALUE _save(int argc,VALUE *argv,VALUE self)
|
|
684
685
|
|
685
686
|
DLL_LOCAL VALUE _draw(VALUE self)
|
686
687
|
{
|
688
|
+
app_protected();
|
689
|
+
rb_check_frozen(self);
|
690
|
+
|
687
691
|
wxDC *dc;
|
688
692
|
|
689
693
|
#if wxUSE_GRAPHICS_CONTEXT
|
@@ -816,6 +820,14 @@ DLL_LOCAL VALUE _marshal_load(VALUE self,VALUE data)
|
|
816
820
|
|
817
821
|
DLL_LOCAL void Init_WXImage(VALUE rb_mWX)
|
818
822
|
{
|
823
|
+
#if wxUSE_IMAGE
|
824
|
+
|
825
|
+
wxInitAllImageHandlers();
|
826
|
+
|
827
|
+
using namespace RubyWX::Image;
|
828
|
+
rb_cWXImage = rb_define_class_under(rb_mWX,"Image",rb_cObject);
|
829
|
+
rb_define_alloc_func(rb_cWXImage,_alloc);
|
830
|
+
|
819
831
|
#if 0
|
820
832
|
rb_define_attr(rb_cWXImage,"width",1,0);
|
821
833
|
rb_define_attr(rb_cWXImage,"height",1,0);
|
@@ -827,15 +839,6 @@ DLL_LOCAL void Init_WXImage(VALUE rb_mWX)
|
|
827
839
|
rb_define_attr(rb_cWXImage,"palette",1,1);
|
828
840
|
#endif
|
829
841
|
|
830
|
-
#if wxUSE_IMAGE
|
831
|
-
|
832
|
-
wxInitAllImageHandlers();
|
833
|
-
|
834
|
-
using namespace RubyWX::Image;
|
835
|
-
rb_cWXImage = rb_define_class_under(rb_mWX,"Image",rb_cObject);
|
836
|
-
rb_define_alloc_func(rb_cWXImage,_alloc);
|
837
|
-
|
838
|
-
|
839
842
|
rb_define_method(rb_cWXImage,"initialize",RUBY_METHOD_FUNC(_initialize),-1);
|
840
843
|
rb_define_private_method(rb_cWXImage,"initialize_copy",RUBY_METHOD_FUNC(_initialize_copy),1);
|
841
844
|
|
@@ -845,11 +848,13 @@ DLL_LOCAL void Init_WXImage(VALUE rb_mWX)
|
|
845
848
|
rb_define_attr_method(rb_cWXImage,"data",_getData,NULL);
|
846
849
|
rb_define_attr_method(rb_cWXImage,"alpha",_getAlpha,NULL);
|
847
850
|
|
851
|
+
rb_define_method(rb_cWXImage,"draw",RUBY_METHOD_FUNC(_draw),0);
|
852
|
+
|
848
853
|
rb_define_method(rb_cWXImage,"to_image",RUBY_METHOD_FUNC(_to_image),0);
|
849
854
|
rb_define_method(rb_cWXImage,"to_bitmap",RUBY_METHOD_FUNC(_to_bitmap),0);
|
850
855
|
|
851
856
|
rb_define_method(rb_cWXImage,"marshal_dump",RUBY_METHOD_FUNC(_marshal_dump),0);
|
852
|
-
rb_define_method(rb_cWXImage,"marshal_load",RUBY_METHOD_FUNC(_marshal_load)
|
857
|
+
rb_define_method(rb_cWXImage,"marshal_load",RUBY_METHOD_FUNC(_marshal_load),-2);
|
853
858
|
|
854
859
|
rb_define_attr_method(rb_cWXImage,"mask",_getMask,_setMask);
|
855
860
|
#if wxUSE_PALETTE
|
data/ext/wxInfoBar.cpp
CHANGED
data/ext/wxInfoBarGeneric.cpp
CHANGED
data/ext/wxItemContainer.cpp
CHANGED
@@ -12,6 +12,7 @@
|
|
12
12
|
#include "wxChoice.hpp"
|
13
13
|
#include "wxBitmapComboBox.hpp"
|
14
14
|
#include "wxComboBox.hpp"
|
15
|
+
#include "wxOwnerDrawnComboBox.hpp"
|
15
16
|
|
16
17
|
VALUE rb_mWXItemContainer;
|
17
18
|
#if wxUSE_CONTROLS
|
@@ -35,6 +36,10 @@ wxItemContainer* unwrap< wxItemContainer* >(const VALUE &obj)
|
|
35
36
|
#if wxUSE_COMBOBOX
|
36
37
|
if(rb_obj_is_kind_of(obj,rb_cWXComboBox))
|
37
38
|
return unwrap<wxComboBox*>(obj);
|
39
|
+
#endif
|
40
|
+
#if wxUSE_ODCOMBOBOX
|
41
|
+
if(rb_obj_is_kind_of(obj,rb_cWXOwnerDrawnComboBox))
|
42
|
+
return unwrap<wxOwnerDrawnComboBox*>(obj);
|
38
43
|
#endif
|
39
44
|
return unwrapTypedPtr<wxItemContainer>(obj,rb_mWXItemContainer);
|
40
45
|
return NULL;
|
data/ext/wxListBook.cpp
CHANGED
@@ -45,9 +45,12 @@ DLL_LOCAL VALUE _initialize(int argc,VALUE *argv,VALUE self)
|
|
45
45
|
set_hash_option(hash,"id",id,unwrapID);
|
46
46
|
set_hash_option(hash,"style",style);
|
47
47
|
}
|
48
|
-
|
49
|
-
_self->Create(unwrap<wxWindow*>(parent),id,wxDefaultPosition,wxDefaultSize,style);
|
50
48
|
|
49
|
+
if(nil_check(parent))
|
50
|
+
_self->Create(unwrap<wxWindow*>(parent),id,
|
51
|
+
wxDefaultPosition,wxDefaultSize,style
|
52
|
+
);
|
53
|
+
|
51
54
|
}
|
52
55
|
|
53
56
|
rb_call_super(argc,argv);
|
data/ext/wxListBox.cpp
CHANGED
@@ -60,14 +60,16 @@ DLL_LOCAL VALUE _initialize(int argc,VALUE *argv,VALUE self)
|
|
60
60
|
|
61
61
|
set_style_flags(hash,style);
|
62
62
|
}
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
63
|
+
if(nil_check(parent)) {
|
64
|
+
_self->Create(
|
65
|
+
unwrap<wxWindow*>(parent),id,
|
66
|
+
wxDefaultPosition,wxDefaultSize,
|
67
|
+
choices,style
|
68
|
+
);
|
69
|
+
|
70
|
+
if(selflag && check_index(selection,_self->GetCount()))
|
71
|
+
_self->SetSelection(selection);
|
72
|
+
}
|
71
73
|
|
72
74
|
}
|
73
75
|
rb_call_super(argc,argv);
|
data/ext/wxMenu.cpp
CHANGED
@@ -544,10 +544,6 @@ DLL_LOCAL void Init_WXMenu(VALUE rb_mWX)
|
|
544
544
|
{
|
545
545
|
#if 0
|
546
546
|
rb_mWXEvtHandler = rb_define_module_under(rb_mWX,"EvtHandler");
|
547
|
-
|
548
|
-
rb_define_attr(rb_cWXMenu,"title",1,1);
|
549
|
-
rb_define_attr(rb_cWXMenu,"parent",1,1);
|
550
|
-
|
551
547
|
#endif
|
552
548
|
|
553
549
|
#if wxUSE_MENUS
|
@@ -555,6 +551,11 @@ DLL_LOCAL void Init_WXMenu(VALUE rb_mWX)
|
|
555
551
|
rb_cWXMenu = rb_define_class_under(rb_mWX,"Menu",rb_cObject);
|
556
552
|
rb_define_alloc_func(rb_cWXMenu,_alloc);
|
557
553
|
|
554
|
+
#if 0
|
555
|
+
rb_define_attr(rb_cWXMenu,"title",1,1);
|
556
|
+
rb_define_attr(rb_cWXMenu,"parent",1,1);
|
557
|
+
#endif
|
558
|
+
|
558
559
|
rb_define_method(rb_cWXMenu,"initialize",RUBY_METHOD_FUNC(_initialize),1);
|
559
560
|
|
560
561
|
rb_include_module(rb_cWXMenu,rb_mWXEvtHandler);
|
data/ext/wxMenuItem.cpp
CHANGED
@@ -133,7 +133,15 @@ DLL_LOCAL void Init_WXMenuItem(VALUE rb_mWX)
|
|
133
133
|
{
|
134
134
|
#if 0
|
135
135
|
rb_cWXMenu = rb_define_class_under(rb_mWX,"Menu",rb_cObject);
|
136
|
+
#endif
|
137
|
+
|
138
|
+
#if wxUSE_MENUS
|
139
|
+
using namespace RubyWX::MenuItem;
|
140
|
+
//
|
141
|
+
rb_cWXMenuItem = rb_define_class_under(rb_cWXMenu,"Item",rb_cObject);
|
142
|
+
rb_define_alloc_func(rb_cWXMenuItem,_alloc);
|
136
143
|
|
144
|
+
#if 0
|
137
145
|
rb_define_attr(rb_cWXMenuItem,"menu",1,1);
|
138
146
|
rb_define_attr(rb_cWXMenuItem,"label",1,1);
|
139
147
|
rb_define_attr(rb_cWXMenuItem,"id",1,1);
|
@@ -146,12 +154,6 @@ DLL_LOCAL void Init_WXMenuItem(VALUE rb_mWX)
|
|
146
154
|
|
147
155
|
#endif
|
148
156
|
|
149
|
-
#if wxUSE_MENUS
|
150
|
-
using namespace RubyWX::MenuItem;
|
151
|
-
//
|
152
|
-
rb_cWXMenuItem = rb_define_class_under(rb_cWXMenu,"Item",rb_cObject);
|
153
|
-
rb_define_alloc_func(rb_cWXMenuItem,_alloc);
|
154
|
-
|
155
157
|
rb_define_private_method(rb_cWXMenuItem,"initialize_copy",RUBY_METHOD_FUNC(_initialize_copy),0);
|
156
158
|
|
157
159
|
rb_define_attr_method(rb_cWXMenuItem,"menu",_getMenu,_setMenu);
|
@@ -165,7 +167,7 @@ DLL_LOCAL void Init_WXMenuItem(VALUE rb_mWX)
|
|
165
167
|
rb_define_attr_method(rb_cWXMenuItem,"bitmap",_GetBitmap,_SetBitmap);
|
166
168
|
|
167
169
|
rb_define_method(rb_cWXMenuItem,"marshal_dump",RUBY_METHOD_FUNC(_marshal_dump),0);
|
168
|
-
rb_define_method(rb_cWXMenuItem,"marshal_load",RUBY_METHOD_FUNC(_marshal_load)
|
170
|
+
rb_define_method(rb_cWXMenuItem,"marshal_load",RUBY_METHOD_FUNC(_marshal_load),-2);
|
169
171
|
|
170
172
|
|
171
173
|
registerInfo<wxMenuItem>(rb_cWXMenuItem);
|
data/ext/wxMultiChoiceDialog.cpp
CHANGED
@@ -62,7 +62,7 @@ DLL_LOCAL VALUE _initialize(int argc,VALUE *argv,VALUE self)
|
|
62
62
|
set_hash_option(hash,"caption",caption);
|
63
63
|
}
|
64
64
|
_self->Create(unwrap<wxWindow*>(parent),message,caption,choices,style);
|
65
|
-
|
65
|
+
|
66
66
|
_self->SetSelections(selections);
|
67
67
|
|
68
68
|
}
|
@@ -119,8 +119,6 @@ DLL_LOCAL void Init_WXMultiChoiceDialog(VALUE rb_mWX)
|
|
119
119
|
{
|
120
120
|
#if 0
|
121
121
|
rb_cWXAnyChoiceDialog = rb_define_class_under(rb_mWX,"AnyChoiceDialog",rb_cWXDialog);
|
122
|
-
|
123
|
-
rb_define_attr(rb_cWXMultiChoiceDialog,"selections",1,1);
|
124
122
|
#endif
|
125
123
|
|
126
124
|
#if wxUSE_CHOICEDLG
|
@@ -128,6 +126,10 @@ DLL_LOCAL void Init_WXMultiChoiceDialog(VALUE rb_mWX)
|
|
128
126
|
rb_cWXMultiChoiceDialog = rb_define_class_under(rb_mWX,"MultiChoiceDialog",rb_cWXAnyChoiceDialog);
|
129
127
|
rb_define_alloc_func(rb_cWXMultiChoiceDialog,_alloc);
|
130
128
|
|
129
|
+
#if 0
|
130
|
+
rb_define_attr(rb_cWXMultiChoiceDialog,"selections",1,1);
|
131
|
+
#endif
|
132
|
+
|
131
133
|
rb_define_method(rb_cWXMultiChoiceDialog,"initialize",RUBY_METHOD_FUNC(_initialize),-1);
|
132
134
|
|
133
135
|
rb_define_attr_method(rb_cWXMultiChoiceDialog,"selections",_getSelections,_setSelections);
|
data/ext/wxNoteBook.cpp
CHANGED
@@ -44,8 +44,10 @@ DLL_LOCAL VALUE _initialize(int argc,VALUE *argv,VALUE self)
|
|
44
44
|
set_hash_option(hash,"id",id,unwrapID);
|
45
45
|
set_hash_option(hash,"style",style);
|
46
46
|
}
|
47
|
-
|
48
|
-
|
47
|
+
if(nil_check(parent))
|
48
|
+
_self->Create(unwrap<wxWindow*>(parent),id,
|
49
|
+
wxDefaultPosition,wxDefaultSize,style
|
50
|
+
);
|
49
51
|
|
50
52
|
}
|
51
53
|
|
@@ -0,0 +1,223 @@
|
|
1
|
+
/*
|
2
|
+
* wxComboBox.cpp
|
3
|
+
*
|
4
|
+
* Created on: 03.05.2012
|
5
|
+
* Author: hanmac
|
6
|
+
*/
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
#include "wxEvtHandler.hpp"
|
11
|
+
#include "wxOwnerDrawnComboBox.hpp"
|
12
|
+
#include "wxItemContainer.hpp"
|
13
|
+
#include "wxTextEntry.hpp"
|
14
|
+
#include "wxChoice.hpp"
|
15
|
+
#include "wxComboCtrl.hpp"
|
16
|
+
#include "wxTextCtrl.hpp"
|
17
|
+
|
18
|
+
VALUE rb_cWXOwnerDrawnComboBox;
|
19
|
+
|
20
|
+
#if wxUSE_ODCOMBOBOX
|
21
|
+
#define _self unwrap<wxOwnerDrawnComboBox*>(self)
|
22
|
+
|
23
|
+
namespace RubyWX {
|
24
|
+
namespace OwnerDrawnComboBox {
|
25
|
+
|
26
|
+
APP_PROTECT(wxOwnerDrawnComboBox)
|
27
|
+
|
28
|
+
//need to define it again to prevent Shadowing
|
29
|
+
singlefunc(Clear)
|
30
|
+
|
31
|
+
#ifdef HAVE_WXOWNERDRAWNCOMBOBOX_ISLISTEMPTY
|
32
|
+
singlereturn(IsListEmpty)
|
33
|
+
singlereturn(IsTextEmpty)
|
34
|
+
#else
|
35
|
+
DLL_LOCAL VALUE _IsListEmpty(VALUE self)
|
36
|
+
{
|
37
|
+
return wrap(dynamic_cast<wxItemContainer*>(_self)->IsEmpty());
|
38
|
+
}
|
39
|
+
DLL_LOCAL VALUE _IsTextEmpty(VALUE self)
|
40
|
+
{
|
41
|
+
return wrap(dynamic_cast<wxTextEntry*>(_self)->IsEmpty());
|
42
|
+
}
|
43
|
+
#endif
|
44
|
+
/*
|
45
|
+
* call-seq:
|
46
|
+
* OwnerDrawnComboBox.new(parent, name, [options])
|
47
|
+
* OwnerDrawnComboBox.new(parent, [options])
|
48
|
+
*
|
49
|
+
* creates a new OwnerDrawnComboBox widget.
|
50
|
+
* ===Arguments
|
51
|
+
* * parent of this window or nil
|
52
|
+
* * name is a String describing a resource in a loaded xrc
|
53
|
+
*
|
54
|
+
* *options: Hash with possible options to set:
|
55
|
+
* * items [String]
|
56
|
+
* * select Integer
|
57
|
+
* * value String
|
58
|
+
*/
|
59
|
+
DLL_LOCAL VALUE _initialize(int argc,VALUE *argv,VALUE self)
|
60
|
+
{
|
61
|
+
VALUE parent,name,hash;
|
62
|
+
rb_scan_args(argc, argv, "11:",&parent,&name,&hash);
|
63
|
+
|
64
|
+
if(!_created && !rb_obj_is_kind_of(name,rb_cString)) {
|
65
|
+
wxWindowID id(wxID_ANY);
|
66
|
+
wxString value;
|
67
|
+
wxArrayString choices;
|
68
|
+
int style(0);
|
69
|
+
int selection(-1);
|
70
|
+
|
71
|
+
bool selflag(false);
|
72
|
+
|
73
|
+
if(rb_obj_is_kind_of(hash,rb_cHash)) {
|
74
|
+
set_hash_option(hash,"id",id,unwrapID);
|
75
|
+
set_hash_option(hash,"value",value);
|
76
|
+
set_hash_option(hash,"items",choices);
|
77
|
+
set_hash_option(hash,"style",style);
|
78
|
+
selflag = set_hash_option(hash,"selection",selection);
|
79
|
+
|
80
|
+
Choice::set_style_flags(hash,style);
|
81
|
+
TextCtrl::set_style_flags(hash,style);
|
82
|
+
}
|
83
|
+
|
84
|
+
if(nil_check(parent)) {
|
85
|
+
_self->Create(
|
86
|
+
unwrap<wxWindow*>(parent),id,value,
|
87
|
+
wxDefaultPosition,wxDefaultSize,
|
88
|
+
choices,style
|
89
|
+
);
|
90
|
+
|
91
|
+
if(selflag && check_index(selection,_self->GetCount()))
|
92
|
+
_self->SetSelection(selection);
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
rb_call_super(argc,argv);
|
97
|
+
|
98
|
+
if(rb_obj_is_kind_of(hash,rb_cHash)) {
|
99
|
+
VALUE temp;
|
100
|
+
set_option(items,,wxArrayString)
|
101
|
+
set_option(select,Selection,int)
|
102
|
+
set_option(value,Value,wxString)
|
103
|
+
|
104
|
+
}
|
105
|
+
|
106
|
+
return self;
|
107
|
+
}
|
108
|
+
|
109
|
+
}
|
110
|
+
}
|
111
|
+
#endif
|
112
|
+
|
113
|
+
/* Document-method: clear
|
114
|
+
* call-seq:
|
115
|
+
* clear -> self
|
116
|
+
*
|
117
|
+
* Removes all items from the control.
|
118
|
+
* ===Return value
|
119
|
+
* self
|
120
|
+
*/
|
121
|
+
/* Document-method: popup
|
122
|
+
* call-seq:
|
123
|
+
* popup -> self
|
124
|
+
*
|
125
|
+
* Shows the list box portion of the combo box.
|
126
|
+
* ===Return value
|
127
|
+
* self
|
128
|
+
*/
|
129
|
+
/* Document-method: dismiss
|
130
|
+
* call-seq:
|
131
|
+
* dismiss -> self
|
132
|
+
*
|
133
|
+
* Hides the list box portion of the combo box.
|
134
|
+
* ===Return value
|
135
|
+
* self
|
136
|
+
*/
|
137
|
+
/* Document-method: list_empty?
|
138
|
+
* call-seq:
|
139
|
+
* list_empty? -> true/false
|
140
|
+
*
|
141
|
+
* Returns true if the list of combobox choices is empty.
|
142
|
+
* ===Return value
|
143
|
+
* true/false
|
144
|
+
*/
|
145
|
+
/* Document-method: text_empty?
|
146
|
+
* call-seq:
|
147
|
+
* text_empty? -> true/false
|
148
|
+
*
|
149
|
+
* Returns true if the text of the combobox is empty.
|
150
|
+
* ===Return value
|
151
|
+
* true/false
|
152
|
+
*/
|
153
|
+
|
154
|
+
/* Document-const: SORT
|
155
|
+
* Sorts the entries alphabetically.
|
156
|
+
*/
|
157
|
+
/* Document-const: READONLY
|
158
|
+
* The text will not be user-editable.
|
159
|
+
*/
|
160
|
+
/* Document-const: DROPDOWN
|
161
|
+
* Creates a combobox with a drop-down list.
|
162
|
+
*/
|
163
|
+
|
164
|
+
/* Document-const: MULTILINE
|
165
|
+
* The text control allows multiple lines. If this style is not specified, line break characters should not be used in the controls value.
|
166
|
+
*/
|
167
|
+
/* Document-const: PROCESS_TAB
|
168
|
+
* The control will receive :char events for TAB pressed - normally, TAB is used for passing to the next control in a dialog instead. For the control created with this style, you can still use Ctrl-Enter to pass to the next control from the keyboard.
|
169
|
+
*/
|
170
|
+
/* Document-const: PROCESS_ENTER
|
171
|
+
* The control will generate the event :text_enter (otherwise pressing Enter key is either processed internally by the control or used for navigation between dialog controls).
|
172
|
+
*/
|
173
|
+
/* Document-const: PASSWORD
|
174
|
+
* The text will be echoed as asterisks.
|
175
|
+
*/
|
176
|
+
DLL_LOCAL void Init_WXOwnerDrawnComboBox(VALUE rb_mWX)
|
177
|
+
{
|
178
|
+
#if 0
|
179
|
+
rb_mWX = rb_define_module("WX");
|
180
|
+
rb_cWXWindow = rb_define_class_under(rb_mWX,"Window",rb_cObject);
|
181
|
+
rb_cWXControl = rb_define_class_under(rb_mWX,"Control",rb_cWXWindow);
|
182
|
+
rb_cWXComboCtrl = rb_define_class_under(rb_mWX,"ComboCtrl",rb_cWXControl);
|
183
|
+
|
184
|
+
rb_mWXItemContainer = rb_define_module_under(rb_mWX,"ItemContainer");
|
185
|
+
#endif
|
186
|
+
#if wxUSE_COMBOBOX
|
187
|
+
using namespace RubyWX::OwnerDrawnComboBox;
|
188
|
+
rb_cWXOwnerDrawnComboBox = rb_define_class_under(rb_mWX,"OwnerDrawnComboBox",rb_cWXComboCtrl);
|
189
|
+
rb_define_alloc_func(rb_cWXOwnerDrawnComboBox,_alloc);
|
190
|
+
|
191
|
+
rb_define_method(rb_cWXOwnerDrawnComboBox,"initialize",RUBY_METHOD_FUNC(_initialize),-1);
|
192
|
+
|
193
|
+
|
194
|
+
rb_include_module(rb_cWXOwnerDrawnComboBox,rb_mWXItemContainer);
|
195
|
+
|
196
|
+
rb_define_method(rb_cWXOwnerDrawnComboBox,"clear",RUBY_METHOD_FUNC(_Clear),0);
|
197
|
+
|
198
|
+
rb_define_method(rb_cWXOwnerDrawnComboBox,"list_empty?",RUBY_METHOD_FUNC(_IsListEmpty),0);
|
199
|
+
rb_define_method(rb_cWXOwnerDrawnComboBox,"text_empty?",RUBY_METHOD_FUNC(_IsTextEmpty),0);
|
200
|
+
|
201
|
+
rb_undef_method(rb_cWXOwnerDrawnComboBox,"empty?");
|
202
|
+
|
203
|
+
//define Choice constants
|
204
|
+
rb_define_const(rb_cWXOwnerDrawnComboBox,"SORT",INT2NUM(wxCB_SORT));
|
205
|
+
rb_define_const(rb_cWXOwnerDrawnComboBox,"READONLY",INT2NUM(wxCB_READONLY));
|
206
|
+
rb_define_const(rb_cWXOwnerDrawnComboBox,"DROPDOWN",INT2NUM(wxCB_DROPDOWN));
|
207
|
+
|
208
|
+
//define TextCtrl constants
|
209
|
+
rb_define_const(rb_cWXOwnerDrawnComboBox,"MULTILINE",INT2NUM(wxTE_MULTILINE));
|
210
|
+
rb_define_const(rb_cWXOwnerDrawnComboBox,"PROCESS_TAB",INT2NUM(wxTE_PROCESS_TAB));
|
211
|
+
rb_define_const(rb_cWXOwnerDrawnComboBox,"PROCESS_ENTER",INT2NUM(wxTE_PROCESS_ENTER));
|
212
|
+
rb_define_const(rb_cWXOwnerDrawnComboBox,"PASSWORD",INT2NUM(wxTE_PASSWORD));
|
213
|
+
|
214
|
+
registerInfo<wxOwnerDrawnComboBox>(rb_cWXOwnerDrawnComboBox);
|
215
|
+
|
216
|
+
registerEventType("combobox",wxEVT_COMBOBOX);
|
217
|
+
registerEventType("combobox_dropdown",wxEVT_COMBOBOX_DROPDOWN);
|
218
|
+
registerEventType("combobox_closeup",wxEVT_COMBOBOX_CLOSEUP);
|
219
|
+
|
220
|
+
#endif
|
221
|
+
|
222
|
+
}
|
223
|
+
|