ruby-qt6-rice 1.0.0
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/.rspec +2 -0
- data/.rubocop.yml +15 -0
- data/LICENSE +185 -0
- data/README.md +3 -0
- data/Rakefile +12 -0
- data/include/bando/common.hpp +232 -0
- data/include/bando/qobject/qdbusabstractadaptor.hpp +102 -0
- data/include/bando/qobject/qdbusabstractinterface.hpp +89 -0
- data/include/bando/qobject/qitemdelegate.hpp +138 -0
- data/include/bando/qobject/qlayout.hpp +175 -0
- data/include/bando/qobject.hpp +89 -0
- data/include/bando/qwidget/qspinbox.hpp +207 -0
- data/include/bando/qwidget.hpp +187 -0
- data/include/rice/qt6/qdbusreply.hpp +53 -0
- data/include/rice/qt6/qenum.hpp +51 -0
- data/include/rice/qt6/qflags.hpp +58 -0
- data/include/rice/qt6/qlist.hpp +238 -0
- data/include/rice/rice.hpp +15154 -0
- data/include/rice/stl.hpp +4803 -0
- data/lib/mkmf-rice.rb +101 -0
- data/lib/mkmf-rubyqt6.rb +28 -0
- data/lib/qt6/rice/version.rb +7 -0
- data/lib/qt6/rice.rb +3 -0
- data/lib/qt6/rspec/bando_file_parser.rb +102 -0
- data/lib/qt6/rspec/qlass_file_parser.rb +255 -0
- data/lib/qt6/rspec.rb +275 -0
- metadata +68 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// This file is part of [RubyQt6](https://github.com/souk4711/ruby-qt6).
|
|
2
|
+
//
|
|
3
|
+
// It is licensed under the LGPLv3, included below.
|
|
4
|
+
//
|
|
5
|
+
// As a special exception to the GNU Lesser General Public License version 3
|
|
6
|
+
// ("LGPL3"), the copyright holders of this Library give you permission to
|
|
7
|
+
// convey to a third party a Combined Work that links statically or dynamically
|
|
8
|
+
// to this Library without providing any Minimal Corresponding Source or
|
|
9
|
+
// Minimal Application Code as set out in 4d or providing the installation
|
|
10
|
+
// information set out in section 4e, provided that you comply with the other
|
|
11
|
+
// provisions of LGPL3 and provided that you meet, for the Application the
|
|
12
|
+
// terms and conditions of the license(s) which apply to the Application.
|
|
13
|
+
//
|
|
14
|
+
// Except as stated in this special exception, the provisions of LGPL3 will
|
|
15
|
+
// continue to comply in full to this Library. If you modify this Library, you
|
|
16
|
+
// may apply this exception to your version of this Library, but you are not
|
|
17
|
+
// obliged to do so. If you do not wish to do so, delete this exception
|
|
18
|
+
// statement from your version. This exception does not (and cannot) modify any
|
|
19
|
+
// license terms which apply to the Application, with which you must still
|
|
20
|
+
// comply.
|
|
21
|
+
|
|
22
|
+
#ifndef BANDO_QITEMDELEGATE_HPP
|
|
23
|
+
#define BANDO_QITEMDELEGATE_HPP
|
|
24
|
+
|
|
25
|
+
#include <bando/common.hpp>
|
|
26
|
+
#include <QChildEvent>
|
|
27
|
+
#include <QEvent>
|
|
28
|
+
#include <QPainter>
|
|
29
|
+
#include <QStyleOptionViewItem>
|
|
30
|
+
#include <QTimerEvent>
|
|
31
|
+
|
|
32
|
+
template <typename Class_T, typename... Arg_Ts> class BandoQItemDelegate : public Class_T
|
|
33
|
+
{
|
|
34
|
+
public:
|
|
35
|
+
BandoQItemDelegate(Arg_Ts... args) : Class_T(args...), value_(Qnil), value_address_(nullptr), mo_(nullptr) {};
|
|
36
|
+
BandoQItemDelegate(const BandoQItemDelegate &) = delete;
|
|
37
|
+
BandoQItemDelegate &operator=(const BandoQItemDelegate &) = delete;
|
|
38
|
+
BandoQItemDelegate(BandoQItemDelegate &&) = delete;
|
|
39
|
+
BandoQItemDelegate &operator=(BandoQItemDelegate &&) = delete;
|
|
40
|
+
~BandoQItemDelegate() override { bando_finalizer<BandoQItemDelegate>(this); };
|
|
41
|
+
|
|
42
|
+
void initializeValue(Rice::Object value, QMetaObject *mo) { bando_initializeValue<BandoQItemDelegate>(this, value, mo); };
|
|
43
|
+
Rice::Object value() { return this->value_; };
|
|
44
|
+
|
|
45
|
+
const QMetaObject *metaObject() const override { return bando_metaObject<BandoQItemDelegate, Class_T>(this); };
|
|
46
|
+
int qt_metacall(QMetaObject::Call call, int id, void **args) override { return bando_qt_metacall<BandoQItemDelegate>(this, call, id, args); };
|
|
47
|
+
|
|
48
|
+
bool event(QEvent *event) override { return bando_handleQObjectEvent<BandoQItemDelegate>(this, event); };
|
|
49
|
+
bool eventFilter(QObject *watched, QEvent *event) override { return bando_handleQObjectEventFilter<BandoQItemDelegate>(this, watched, event); };
|
|
50
|
+
|
|
51
|
+
void childEvent(QChildEvent *event) override { bando_handleEvent<BandoQItemDelegate>(this, event, bando_FunctionName::childEvent); };
|
|
52
|
+
void timerEvent(QTimerEvent *event) override { bando_handleEvent<BandoQItemDelegate>(this, event, bando_FunctionName::timerEvent); };
|
|
53
|
+
QObject *sender() const { return this->Class_T::sender(); }
|
|
54
|
+
|
|
55
|
+
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override {
|
|
56
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
57
|
+
auto rb_name = Rice::Identifier("create_editor");
|
|
58
|
+
auto rb_return = this->value_.call(rb_name, Rice::Object(Rice::detail::to_ruby(parent)), Rice::Object(Rice::detail::to_ruby(option)), Rice::Object(Rice::detail::to_ruby(index)));
|
|
59
|
+
return Rice::detail::From_Ruby<QWidget *>().convert(rb_return);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override {
|
|
63
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
64
|
+
auto rb_name = Rice::Identifier("paint");
|
|
65
|
+
this->value_.call(rb_name, Rice::Object(Rice::detail::to_ruby(painter)), Rice::Object(Rice::detail::to_ruby(option)), Rice::Object(Rice::detail::to_ruby(index)));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
void setEditorData(QWidget *editor, const QModelIndex &index) const override {
|
|
69
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
70
|
+
auto rb_name = Rice::Identifier("set_editor_data");
|
|
71
|
+
this->value_.call(rb_name, Rice::Object(Rice::detail::to_ruby(editor)), Rice::Object(Rice::detail::to_ruby(index)));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override {
|
|
75
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
76
|
+
auto rb_name = Rice::Identifier("set_model_data");
|
|
77
|
+
this->value_.call(rb_name, Rice::Object(Rice::detail::to_ruby(editor)), Rice::Object(Rice::detail::to_ruby(model)), Rice::Object(Rice::detail::to_ruby(index)));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override {
|
|
81
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
82
|
+
auto rb_name = Rice::Identifier("size_hint");
|
|
83
|
+
auto rb_return = this->value_.call(rb_name, Rice::Object(Rice::detail::to_ruby(option)), Rice::Object(Rice::detail::to_ruby(index)));
|
|
84
|
+
return Rice::detail::From_Ruby<QSize>().convert(rb_return);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override {
|
|
88
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
89
|
+
auto rb_name = Rice::Identifier("update_editor_geometry");
|
|
90
|
+
this->value_.call(rb_name, Rice::Object(Rice::detail::to_ruby(editor)), Rice::Object(Rice::detail::to_ruby(option)), Rice::Object(Rice::detail::to_ruby(index)));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public:
|
|
94
|
+
bool Class_T_handleQObjectEvent(QEvent *event) { return this->Class_T::event(event); };
|
|
95
|
+
bool Class_T_handleQObjectEventFilter(QObject *watched, QEvent *event) { return this->Class_T::eventFilter(watched, event); };
|
|
96
|
+
|
|
97
|
+
void Class_T_handleEvent(bando_FunctionName name, QEvent *event) {
|
|
98
|
+
switch (name)
|
|
99
|
+
{
|
|
100
|
+
case bando_FunctionName::childEvent: return this->Class_T::childEvent(static_cast<QChildEvent *>(event));
|
|
101
|
+
case bando_FunctionName::timerEvent: return this->Class_T::timerEvent(static_cast<QTimerEvent *>(event));
|
|
102
|
+
default: Q_UNREACHABLE(); break;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
public:
|
|
107
|
+
template <typename BC_T, typename C_T> friend const QMetaObject *bando_metaObject(const BC_T *self);
|
|
108
|
+
|
|
109
|
+
Rice::Object value_;
|
|
110
|
+
VALUE *value_address_;
|
|
111
|
+
|
|
112
|
+
QMetaObject *mo_;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
template <typename BC_T, typename C_T>
|
|
116
|
+
Rice::Data_Type<BC_T> define_bando_qitemdelegate_under(Rice::Module module, char const *name)
|
|
117
|
+
{
|
|
118
|
+
Rice::Data_Type<BC_T> bando_qlass =
|
|
119
|
+
Rice::define_class_under<BC_T, C_T>(module, name)
|
|
120
|
+
.define_method("_initialize_ruby_value", &BC_T::initializeValue, Rice::Arg("value"), Rice::Arg("mo"))
|
|
121
|
+
.define_method("_ruby_value", &BC_T::value)
|
|
122
|
+
.define_method("_ruby_value_handle_event", &BC_T::Class_T_handleEvent, Rice::Arg("name"), Rice::Arg("event"))
|
|
123
|
+
.define_method("_event", &BC_T::Class_T_handleQObjectEvent, Rice::Arg("event"))
|
|
124
|
+
.define_method("_event_filter", &BC_T::Class_T_handleQObjectEventFilter, Rice::Arg("watched"), Rice::Arg("event"))
|
|
125
|
+
.define_method("sender", &BC_T::sender);
|
|
126
|
+
|
|
127
|
+
bando_qlass
|
|
128
|
+
.define_method("create_editor", [](BC_T *self, QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) -> QWidget * { return self->C_T::createEditor(parent, option, index); })
|
|
129
|
+
.define_method("paint", [](BC_T *self, QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) -> void { return self->C_T::paint(painter, option, index); })
|
|
130
|
+
.define_method("set_editor_data", [](BC_T *self, QWidget *editor, const QModelIndex &index) -> void { return self->C_T::setEditorData(editor, index); })
|
|
131
|
+
.define_method("set_model_data", [](BC_T *self, QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) -> void { return self->C_T::setModelData(editor, model, index); })
|
|
132
|
+
.define_method("size_hint", [](BC_T *self, const QStyleOptionViewItem &option, const QModelIndex &index) -> QSize { return self->C_T::sizeHint(option, index); })
|
|
133
|
+
.define_method("update_editor_geometry", [](BC_T *self, QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) -> void { return self->C_T::updateEditorGeometry(editor, option, index); });
|
|
134
|
+
|
|
135
|
+
return bando_qlass;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
#endif
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// This file is part of [RubyQt6](https://github.com/souk4711/ruby-qt6).
|
|
2
|
+
//
|
|
3
|
+
// It is licensed under the LGPLv3, included below.
|
|
4
|
+
//
|
|
5
|
+
// As a special exception to the GNU Lesser General Public License version 3
|
|
6
|
+
// ("LGPL3"), the copyright holders of this Library give you permission to
|
|
7
|
+
// convey to a third party a Combined Work that links statically or dynamically
|
|
8
|
+
// to this Library without providing any Minimal Corresponding Source or
|
|
9
|
+
// Minimal Application Code as set out in 4d or providing the installation
|
|
10
|
+
// information set out in section 4e, provided that you comply with the other
|
|
11
|
+
// provisions of LGPL3 and provided that you meet, for the Application the
|
|
12
|
+
// terms and conditions of the license(s) which apply to the Application.
|
|
13
|
+
//
|
|
14
|
+
// Except as stated in this special exception, the provisions of LGPL3 will
|
|
15
|
+
// continue to comply in full to this Library. If you modify this Library, you
|
|
16
|
+
// may apply this exception to your version of this Library, but you are not
|
|
17
|
+
// obliged to do so. If you do not wish to do so, delete this exception
|
|
18
|
+
// statement from your version. This exception does not (and cannot) modify any
|
|
19
|
+
// license terms which apply to the Application, with which you must still
|
|
20
|
+
// comply.
|
|
21
|
+
|
|
22
|
+
#ifndef BANDO_QLAYOUT_HPP
|
|
23
|
+
#define BANDO_QLAYOUT_HPP
|
|
24
|
+
|
|
25
|
+
#include <bando/common.hpp>
|
|
26
|
+
#include <QChildEvent>
|
|
27
|
+
#include <QEvent>
|
|
28
|
+
#include <QLayoutItem>
|
|
29
|
+
#include <QTimerEvent>
|
|
30
|
+
#include <QWidget>
|
|
31
|
+
|
|
32
|
+
template <typename Class_T, typename... Arg_Ts> class BandoQLayout : public Class_T
|
|
33
|
+
{
|
|
34
|
+
public:
|
|
35
|
+
BandoQLayout(Arg_Ts... args) : Class_T(args...), value_(Qnil), value_address_(nullptr), mo_(nullptr) {};
|
|
36
|
+
BandoQLayout(const BandoQLayout &) = delete;
|
|
37
|
+
BandoQLayout &operator=(const BandoQLayout &) = delete;
|
|
38
|
+
BandoQLayout(BandoQLayout &&) = delete;
|
|
39
|
+
BandoQLayout &operator=(BandoQLayout &&) = delete;
|
|
40
|
+
~BandoQLayout() override { bando_finalizer<BandoQLayout>(this); };
|
|
41
|
+
|
|
42
|
+
void initializeValue(Rice::Object value, QMetaObject *mo) { bando_initializeValue<BandoQLayout>(this, value, mo); };
|
|
43
|
+
Rice::Object value() { return this->value_; };
|
|
44
|
+
|
|
45
|
+
const QMetaObject *metaObject() const override { return bando_metaObject<BandoQLayout, Class_T>(this); };
|
|
46
|
+
int qt_metacall(QMetaObject::Call call, int id, void **args) override { return bando_qt_metacall<BandoQLayout>(this, call, id, args); };
|
|
47
|
+
|
|
48
|
+
bool event(QEvent *event) override { return bando_handleQObjectEvent<BandoQLayout>(this, event); };
|
|
49
|
+
bool eventFilter(QObject *watched, QEvent *event) override { return bando_handleQObjectEventFilter<BandoQLayout>(this, watched, event); };
|
|
50
|
+
|
|
51
|
+
void childEvent(QChildEvent *event) override { bando_handleEvent<BandoQLayout>(this, event, bando_FunctionName::childEvent); };
|
|
52
|
+
void timerEvent(QTimerEvent *event) override { bando_handleEvent<BandoQLayout>(this, event, bando_FunctionName::timerEvent); };
|
|
53
|
+
QObject *sender() const { return this->Class_T::sender(); }
|
|
54
|
+
|
|
55
|
+
void addItem(QLayoutItem *item) override {
|
|
56
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
57
|
+
auto rb_name = Rice::Identifier("add_item");
|
|
58
|
+
this->value_.call(rb_name, Rice::Object(Rice::detail::to_ruby(item)));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
int count() const override {
|
|
62
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
63
|
+
auto rb_name = Rice::Identifier("count");
|
|
64
|
+
auto rb_return = this->value_.call(rb_name);
|
|
65
|
+
return Rice::detail::From_Ruby<int>().convert(rb_return);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
QLayoutItem *itemAt(int index) const override {
|
|
69
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
70
|
+
auto rb_name = Rice::Identifier("item_at");
|
|
71
|
+
auto rb_return = this->value_.call(rb_name, Rice::Object(Rice::detail::to_ruby(index)));
|
|
72
|
+
return Rice::detail::From_Ruby<QLayoutItem *>().convert(rb_return);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
QLayoutItem *takeAt(int index) override {
|
|
76
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
77
|
+
auto rb_name = Rice::Identifier("take_at");
|
|
78
|
+
auto rb_return = this->value_.call(rb_name, Rice::Object(Rice::detail::to_ruby(index)));
|
|
79
|
+
return Rice::detail::From_Ruby<QLayoutItem *>().convert(rb_return);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
QSize sizeHint() const override {
|
|
83
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
84
|
+
auto rb_name = Rice::Identifier("size_hint");
|
|
85
|
+
auto rb_return = this->value_.call(rb_name);
|
|
86
|
+
return Rice::detail::From_Ruby<QSize>().convert(rb_return);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
Qt::Orientations expandingDirections() const override {
|
|
90
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
91
|
+
auto rb_name = Rice::Identifier("expanding_directions");
|
|
92
|
+
auto rb_return = this->value_.call(rb_name);
|
|
93
|
+
return Rice::detail::From_Ruby<Qt::Orientations>().convert(rb_return);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
bool hasHeightForWidth() const override {
|
|
97
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
98
|
+
auto rb_name = Rice::Identifier("has_height_for_width");
|
|
99
|
+
auto rb_return = this->value_.call(rb_name);
|
|
100
|
+
return Rice::detail::From_Ruby<bool>().convert(rb_return);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
int heightForWidth(int width) const override {
|
|
104
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
105
|
+
auto rb_name = Rice::Identifier("height_for_width");
|
|
106
|
+
auto rb_return = this->value_.call(rb_name, Rice::Object(Rice::detail::to_ruby(width)));
|
|
107
|
+
return Rice::detail::From_Ruby<int>().convert(rb_return);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
QSize maximumSize() const override {
|
|
111
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
112
|
+
auto rb_name = Rice::Identifier("maximum_size");
|
|
113
|
+
auto rb_return = this->value_.call(rb_name);
|
|
114
|
+
return Rice::detail::From_Ruby<QSize>().convert(rb_return);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
QSize minimumSize() const override {
|
|
118
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
119
|
+
auto rb_name = Rice::Identifier("minimum_size");
|
|
120
|
+
auto rb_return = this->value_.call(rb_name);
|
|
121
|
+
return Rice::detail::From_Ruby<QSize>().convert(rb_return);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
void setGeometry(const QRect &r) override {
|
|
125
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
126
|
+
auto rb_name = Rice::Identifier("set_geometry");
|
|
127
|
+
this->value_.call(rb_name, Rice::Object(Rice::detail::to_ruby(r)));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
public:
|
|
131
|
+
bool Class_T_handleQObjectEvent(QEvent *event) { return this->Class_T::event(event); };
|
|
132
|
+
bool Class_T_handleQObjectEventFilter(QObject *watched, QEvent *event) { return this->Class_T::eventFilter(watched, event); };
|
|
133
|
+
|
|
134
|
+
void Class_T_handleEvent(bando_FunctionName name, QEvent *event) {
|
|
135
|
+
switch (name)
|
|
136
|
+
{
|
|
137
|
+
case bando_FunctionName::childEvent: return this->Class_T::childEvent(static_cast<QChildEvent *>(event));
|
|
138
|
+
case bando_FunctionName::timerEvent: return this->Class_T::timerEvent(static_cast<QTimerEvent *>(event));
|
|
139
|
+
default: Q_UNREACHABLE(); break;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
public:
|
|
144
|
+
template <typename BC_T, typename C_T> friend const QMetaObject *bando_metaObject(const BC_T *self);
|
|
145
|
+
|
|
146
|
+
Rice::Object value_;
|
|
147
|
+
VALUE *value_address_;
|
|
148
|
+
|
|
149
|
+
QMetaObject *mo_;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
template <typename BC_T, typename C_T>
|
|
153
|
+
Rice::Data_Type<BC_T> define_bando_qlayout_under(Rice::Module module, char const *name)
|
|
154
|
+
{
|
|
155
|
+
Rice::Data_Type<BC_T> bando_qlass =
|
|
156
|
+
Rice::define_class_under<BC_T, C_T>(module, name)
|
|
157
|
+
.define_method("_initialize_ruby_value", &BC_T::initializeValue, Rice::Arg("value"), Rice::Arg("mo"))
|
|
158
|
+
.define_method("_ruby_value", &BC_T::value)
|
|
159
|
+
.define_method("_ruby_value_handle_event", &BC_T::Class_T_handleEvent, Rice::Arg("name"), Rice::Arg("event"))
|
|
160
|
+
.define_method("_event", &BC_T::Class_T_handleQObjectEvent, Rice::Arg("event"))
|
|
161
|
+
.define_method("_event_filter", &BC_T::Class_T_handleQObjectEventFilter, Rice::Arg("watched"), Rice::Arg("event"))
|
|
162
|
+
.define_method("sender", &BC_T::sender);
|
|
163
|
+
|
|
164
|
+
bando_qlass
|
|
165
|
+
.define_method("expanding_directions", [](BC_T *self) -> Qt::Orientations { return self->C_T::expandingDirections(); })
|
|
166
|
+
.define_method("has_height_for_width", [](BC_T *self) -> bool { return self->C_T::hasHeightForWidth(); })
|
|
167
|
+
.define_method("height_for_width", [](BC_T *self, int width) -> int { return self->C_T::heightForWidth(width); })
|
|
168
|
+
.define_method("maximum_size", [](BC_T *self) -> QSize { return self->C_T::maximumSize(); })
|
|
169
|
+
.define_method("minimum_size", [](BC_T *self) -> QSize { return self->C_T::minimumSize(); })
|
|
170
|
+
.define_method("set_geometry", [](BC_T *self, const QRect &r) -> void { return self->C_T::setGeometry(r); });
|
|
171
|
+
|
|
172
|
+
return bando_qlass;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
#endif
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// This file is part of [RubyQt6](https://github.com/souk4711/ruby-qt6).
|
|
2
|
+
//
|
|
3
|
+
// It is licensed under the LGPLv3, included below.
|
|
4
|
+
//
|
|
5
|
+
// As a special exception to the GNU Lesser General Public License version 3
|
|
6
|
+
// ("LGPL3"), the copyright holders of this Library give you permission to
|
|
7
|
+
// convey to a third party a Combined Work that links statically or dynamically
|
|
8
|
+
// to this Library without providing any Minimal Corresponding Source or
|
|
9
|
+
// Minimal Application Code as set out in 4d or providing the installation
|
|
10
|
+
// information set out in section 4e, provided that you comply with the other
|
|
11
|
+
// provisions of LGPL3 and provided that you meet, for the Application the
|
|
12
|
+
// terms and conditions of the license(s) which apply to the Application.
|
|
13
|
+
//
|
|
14
|
+
// Except as stated in this special exception, the provisions of LGPL3 will
|
|
15
|
+
// continue to comply in full to this Library. If you modify this Library, you
|
|
16
|
+
// may apply this exception to your version of this Library, but you are not
|
|
17
|
+
// obliged to do so. If you do not wish to do so, delete this exception
|
|
18
|
+
// statement from your version. This exception does not (and cannot) modify any
|
|
19
|
+
// license terms which apply to the Application, with which you must still
|
|
20
|
+
// comply.
|
|
21
|
+
|
|
22
|
+
#ifndef BANDO_QOBJECT_HPP
|
|
23
|
+
#define BANDO_QOBJECT_HPP
|
|
24
|
+
|
|
25
|
+
#include <bando/common.hpp>
|
|
26
|
+
#include <QChildEvent>
|
|
27
|
+
#include <QEvent>
|
|
28
|
+
#include <QTimerEvent>
|
|
29
|
+
|
|
30
|
+
template <typename Class_T, typename... Arg_Ts> class BandoQObject : public Class_T
|
|
31
|
+
{
|
|
32
|
+
public:
|
|
33
|
+
BandoQObject(Arg_Ts... args) : Class_T(args...), value_(Qnil), value_address_(nullptr), mo_(nullptr) {};
|
|
34
|
+
BandoQObject(const BandoQObject &) = delete;
|
|
35
|
+
BandoQObject &operator=(const BandoQObject &) = delete;
|
|
36
|
+
BandoQObject(BandoQObject &&) = delete;
|
|
37
|
+
BandoQObject &operator=(BandoQObject &&) = delete;
|
|
38
|
+
~BandoQObject() override { bando_finalizer<BandoQObject>(this); };
|
|
39
|
+
|
|
40
|
+
void initializeValue(Rice::Object value, QMetaObject *mo) { bando_initializeValue<BandoQObject>(this, value, mo); };
|
|
41
|
+
Rice::Object value() { return this->value_; };
|
|
42
|
+
|
|
43
|
+
const QMetaObject *metaObject() const override { return bando_metaObject<BandoQObject, Class_T>(this); };
|
|
44
|
+
int qt_metacall(QMetaObject::Call call, int id, void **args) override { return bando_qt_metacall<BandoQObject>(this, call, id, args); };
|
|
45
|
+
|
|
46
|
+
bool event(QEvent *event) override { return bando_handleQObjectEvent<BandoQObject>(this, event); };
|
|
47
|
+
bool eventFilter(QObject *watched, QEvent *event) override { return bando_handleQObjectEventFilter<BandoQObject>(this, watched, event); };
|
|
48
|
+
|
|
49
|
+
void childEvent(QChildEvent *event) override { bando_handleEvent<BandoQObject>(this, event, bando_FunctionName::childEvent); };
|
|
50
|
+
void timerEvent(QTimerEvent *event) override { bando_handleEvent<BandoQObject>(this, event, bando_FunctionName::timerEvent); };
|
|
51
|
+
QObject *sender() const { return this->Class_T::sender(); }
|
|
52
|
+
|
|
53
|
+
public:
|
|
54
|
+
bool Class_T_handleQObjectEvent(QEvent *event) { return this->Class_T::event(event); };
|
|
55
|
+
bool Class_T_handleQObjectEventFilter(QObject *watched, QEvent *event) { return this->Class_T::eventFilter(watched, event); };
|
|
56
|
+
|
|
57
|
+
void Class_T_handleEvent(bando_FunctionName name, QEvent *event) {
|
|
58
|
+
switch (name)
|
|
59
|
+
{
|
|
60
|
+
case bando_FunctionName::childEvent: return this->Class_T::childEvent(static_cast<QChildEvent *>(event));
|
|
61
|
+
case bando_FunctionName::timerEvent: return this->Class_T::timerEvent(static_cast<QTimerEvent *>(event));
|
|
62
|
+
default: Q_UNREACHABLE(); break;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
public:
|
|
67
|
+
template <typename BC_T, typename C_T> friend const QMetaObject *bando_metaObject(const BC_T *self);
|
|
68
|
+
|
|
69
|
+
Rice::Object value_;
|
|
70
|
+
VALUE *value_address_;
|
|
71
|
+
|
|
72
|
+
QMetaObject *mo_;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
template <typename BC_T, typename C_T>
|
|
76
|
+
Rice::Data_Type<BC_T> define_bando_qobject_under(Rice::Module module, char const *name)
|
|
77
|
+
{
|
|
78
|
+
Rice::Data_Type<BC_T> bando_qlass =
|
|
79
|
+
Rice::define_class_under<BC_T, C_T>(module, name)
|
|
80
|
+
.define_method("_initialize_ruby_value", &BC_T::initializeValue, Rice::Arg("value"), Rice::Arg("mo"))
|
|
81
|
+
.define_method("_ruby_value", &BC_T::value)
|
|
82
|
+
.define_method("_ruby_value_handle_event", &BC_T::Class_T_handleEvent, Rice::Arg("name"), Rice::Arg("event"))
|
|
83
|
+
.define_method("_event", &BC_T::Class_T_handleQObjectEvent, Rice::Arg("event"))
|
|
84
|
+
.define_method("_event_filter", &BC_T::Class_T_handleQObjectEventFilter, Rice::Arg("watched"), Rice::Arg("event"))
|
|
85
|
+
.define_method("sender", &BC_T::sender);
|
|
86
|
+
return bando_qlass;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
#endif
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
// This file is part of [RubyQt6](https://github.com/souk4711/ruby-qt6).
|
|
2
|
+
//
|
|
3
|
+
// It is licensed under the LGPLv3, included below.
|
|
4
|
+
//
|
|
5
|
+
// As a special exception to the GNU Lesser General Public License version 3
|
|
6
|
+
// ("LGPL3"), the copyright holders of this Library give you permission to
|
|
7
|
+
// convey to a third party a Combined Work that links statically or dynamically
|
|
8
|
+
// to this Library without providing any Minimal Corresponding Source or
|
|
9
|
+
// Minimal Application Code as set out in 4d or providing the installation
|
|
10
|
+
// information set out in section 4e, provided that you comply with the other
|
|
11
|
+
// provisions of LGPL3 and provided that you meet, for the Application the
|
|
12
|
+
// terms and conditions of the license(s) which apply to the Application.
|
|
13
|
+
//
|
|
14
|
+
// Except as stated in this special exception, the provisions of LGPL3 will
|
|
15
|
+
// continue to comply in full to this Library. If you modify this Library, you
|
|
16
|
+
// may apply this exception to your version of this Library, but you are not
|
|
17
|
+
// obliged to do so. If you do not wish to do so, delete this exception
|
|
18
|
+
// statement from your version. This exception does not (and cannot) modify any
|
|
19
|
+
// license terms which apply to the Application, with which you must still
|
|
20
|
+
// comply.
|
|
21
|
+
|
|
22
|
+
#ifndef BANDO_QSPINBOX_HPP
|
|
23
|
+
#define BANDO_QSPINBOX_HPP
|
|
24
|
+
|
|
25
|
+
#include <bando/common.hpp>
|
|
26
|
+
#include <QActionEvent>
|
|
27
|
+
#include <QEvent>
|
|
28
|
+
#include <QChildEvent>
|
|
29
|
+
#include <QCloseEvent>
|
|
30
|
+
#include <QContextMenuEvent>
|
|
31
|
+
#include <QDragEnterEvent>
|
|
32
|
+
#include <QDragLeaveEvent>
|
|
33
|
+
#include <QDragMoveEvent>
|
|
34
|
+
#include <QDropEvent>
|
|
35
|
+
#include <QEnterEvent>
|
|
36
|
+
#include <QFocusEvent>
|
|
37
|
+
#include <QFocusEvent>
|
|
38
|
+
#include <QHideEvent>
|
|
39
|
+
#include <QInputMethodEvent>
|
|
40
|
+
#include <QKeyEvent>
|
|
41
|
+
#include <QKeyEvent>
|
|
42
|
+
#include <QEvent>
|
|
43
|
+
#include <QMouseEvent>
|
|
44
|
+
#include <QMouseEvent>
|
|
45
|
+
#include <QMouseEvent>
|
|
46
|
+
#include <QMouseEvent>
|
|
47
|
+
#include <QMoveEvent>
|
|
48
|
+
#include <QPaintEvent>
|
|
49
|
+
#include <QResizeEvent>
|
|
50
|
+
#include <QShowEvent>
|
|
51
|
+
#include <QTabletEvent>
|
|
52
|
+
#include <QTimerEvent>
|
|
53
|
+
#include <QWheelEvent>
|
|
54
|
+
|
|
55
|
+
template <typename Class_T, typename... Arg_Ts> class BandoQSpinBox : public Class_T
|
|
56
|
+
{
|
|
57
|
+
public:
|
|
58
|
+
BandoQSpinBox(Arg_Ts... args) : Class_T(args...), value_(Qnil), value_address_(nullptr), mo_(nullptr) {};
|
|
59
|
+
BandoQSpinBox(const BandoQSpinBox &) = delete;
|
|
60
|
+
BandoQSpinBox &operator=(const BandoQSpinBox &) = delete;
|
|
61
|
+
BandoQSpinBox(BandoQSpinBox &&) = delete;
|
|
62
|
+
BandoQSpinBox &operator=(BandoQSpinBox &&) = delete;
|
|
63
|
+
~BandoQSpinBox() override { bando_finalizer<BandoQSpinBox>(this); };
|
|
64
|
+
|
|
65
|
+
void initializeValue(Rice::Object value, QMetaObject *mo) { bando_initializeValue<BandoQSpinBox>(this, value, mo); };
|
|
66
|
+
Rice::Object value() { return this->value_; };
|
|
67
|
+
|
|
68
|
+
const QMetaObject *metaObject() const override { return bando_metaObject<BandoQSpinBox, Class_T>(this); };
|
|
69
|
+
int qt_metacall(QMetaObject::Call call, int id, void **args) override { return bando_qt_metacall<BandoQSpinBox>(this, call, id, args); };
|
|
70
|
+
|
|
71
|
+
bool event(QEvent *event) override { return bando_handleQObjectEvent<BandoQSpinBox>(this, event); };
|
|
72
|
+
bool eventFilter(QObject *watched, QEvent *event) override { return bando_handleQObjectEventFilter<BandoQSpinBox>(this, watched, event); };
|
|
73
|
+
|
|
74
|
+
void childEvent(QChildEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::childEvent); };
|
|
75
|
+
void timerEvent(QTimerEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::timerEvent); };
|
|
76
|
+
QObject *sender() const { return this->Class_T::sender(); }
|
|
77
|
+
|
|
78
|
+
void actionEvent(QActionEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::actionEvent); };
|
|
79
|
+
void changeEvent(QEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::changeEvent); };
|
|
80
|
+
void closeEvent(QCloseEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::closeEvent); };
|
|
81
|
+
void contextMenuEvent(QContextMenuEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::contextMenuEvent); };
|
|
82
|
+
void dragEnterEvent(QDragEnterEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::dragEnterEvent); };
|
|
83
|
+
void dragLeaveEvent(QDragLeaveEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::dragLeaveEvent); };
|
|
84
|
+
void dragMoveEvent(QDragMoveEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::dragMoveEvent); };
|
|
85
|
+
void dropEvent(QDropEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::dropEvent); };
|
|
86
|
+
void enterEvent(QEnterEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::enterEvent); };
|
|
87
|
+
void focusInEvent(QFocusEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::focusInEvent); };
|
|
88
|
+
void focusOutEvent(QFocusEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::focusOutEvent); };
|
|
89
|
+
void hideEvent(QHideEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::hideEvent); };
|
|
90
|
+
void inputMethodEvent(QInputMethodEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::inputMethodEvent); };
|
|
91
|
+
void keyPressEvent(QKeyEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::keyPressEvent); };
|
|
92
|
+
void keyReleaseEvent(QKeyEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::keyReleaseEvent); };
|
|
93
|
+
void leaveEvent(QEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::leaveEvent); };
|
|
94
|
+
void mouseDoubleClickEvent(QMouseEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::mouseDoubleClickEvent); };
|
|
95
|
+
void mouseMoveEvent(QMouseEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::mouseMoveEvent); };
|
|
96
|
+
void mousePressEvent(QMouseEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::mousePressEvent); };
|
|
97
|
+
void mouseReleaseEvent(QMouseEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::mouseReleaseEvent); };
|
|
98
|
+
void moveEvent(QMoveEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::moveEvent); };
|
|
99
|
+
void paintEvent(QPaintEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::paintEvent); };
|
|
100
|
+
void resizeEvent(QResizeEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::resizeEvent); };
|
|
101
|
+
void showEvent(QShowEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::showEvent); };
|
|
102
|
+
void tabletEvent(QTabletEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::tabletEvent); };
|
|
103
|
+
void wheelEvent(QWheelEvent *event) override { bando_handleEvent<BandoQSpinBox>(this, event, bando_FunctionName::wheelEvent); };
|
|
104
|
+
|
|
105
|
+
QSize minimumSizeHint() const override {
|
|
106
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
107
|
+
auto rb_name = Rice::Identifier("minimum_size_hint");
|
|
108
|
+
auto rb_return = this->value_.call(rb_name);
|
|
109
|
+
return Rice::detail::From_Ruby<QSize>().convert(rb_return);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
QSize sizeHint() const override {
|
|
113
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
114
|
+
auto rb_name = Rice::Identifier("size_hint");
|
|
115
|
+
auto rb_return = this->value_.call(rb_name);
|
|
116
|
+
return Rice::detail::From_Ruby<QSize>().convert(rb_return);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
QString textFromValue(int value) const override {
|
|
120
|
+
auto rb_name = Rice::Identifier("text_from_value");
|
|
121
|
+
if (!this->value_.respond_to(rb_name))
|
|
122
|
+
return this->Class_T::textFromValue(value);
|
|
123
|
+
|
|
124
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
125
|
+
auto rb_return = this->value_.call(rb_name, Rice::Object(Rice::detail::to_ruby(value)));
|
|
126
|
+
return Rice::detail::From_Ruby<QString>().convert(rb_return);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
int valueFromText(const QString &text) const override {
|
|
130
|
+
auto rb_name = Rice::Identifier("value_from_text");
|
|
131
|
+
if (!this->value_.respond_to(rb_name))
|
|
132
|
+
return this->Class_T::valueFromText(text);
|
|
133
|
+
|
|
134
|
+
Q_ASSERT(this->value_.rb_type() != RUBY_T_NONE);
|
|
135
|
+
auto rb_return = this->value_.call(rb_name, Rice::Object(Rice::detail::to_ruby(text)));
|
|
136
|
+
return Rice::detail::From_Ruby<int>().convert(rb_return);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
public:
|
|
140
|
+
bool Class_T_handleQObjectEvent(QEvent *event) { return this->Class_T::event(event); };
|
|
141
|
+
bool Class_T_handleQObjectEventFilter(QObject *watched, QEvent *event) { return this->Class_T::eventFilter(watched, event); };
|
|
142
|
+
|
|
143
|
+
void Class_T_handleEvent(bando_FunctionName name, QEvent *event) {
|
|
144
|
+
switch (name)
|
|
145
|
+
{
|
|
146
|
+
case bando_FunctionName::childEvent: return this->Class_T::childEvent(static_cast<QChildEvent *>(event));
|
|
147
|
+
case bando_FunctionName::timerEvent: return this->Class_T::timerEvent(static_cast<QTimerEvent *>(event));
|
|
148
|
+
|
|
149
|
+
case bando_FunctionName::actionEvent: return this->Class_T::actionEvent(static_cast<QActionEvent *>(event));
|
|
150
|
+
case bando_FunctionName::changeEvent: return this->Class_T::changeEvent(event);
|
|
151
|
+
case bando_FunctionName::closeEvent: return this->Class_T::closeEvent(static_cast<QCloseEvent *>(event));
|
|
152
|
+
case bando_FunctionName::contextMenuEvent: return this->Class_T::contextMenuEvent(static_cast<QContextMenuEvent *>(event));
|
|
153
|
+
case bando_FunctionName::dragEnterEvent: return this->Class_T::dragEnterEvent(static_cast<QDragEnterEvent *>(event));
|
|
154
|
+
case bando_FunctionName::dragLeaveEvent: return this->Class_T::dragLeaveEvent(static_cast<QDragLeaveEvent *>(event));
|
|
155
|
+
case bando_FunctionName::dragMoveEvent: return this->Class_T::dragMoveEvent(static_cast<QDragMoveEvent *>(event));
|
|
156
|
+
case bando_FunctionName::dropEvent: return this->Class_T::dropEvent(static_cast<QDropEvent *>(event));
|
|
157
|
+
case bando_FunctionName::enterEvent: return this->Class_T::enterEvent(static_cast<QEnterEvent *>(event));
|
|
158
|
+
case bando_FunctionName::focusInEvent: return this->Class_T::focusInEvent(static_cast<QFocusEvent *>(event));
|
|
159
|
+
case bando_FunctionName::focusOutEvent: return this->Class_T::focusOutEvent(static_cast<QFocusEvent *>(event));
|
|
160
|
+
case bando_FunctionName::hideEvent: return this->Class_T::hideEvent(static_cast<QHideEvent *>(event));
|
|
161
|
+
case bando_FunctionName::inputMethodEvent: return this->Class_T::inputMethodEvent(static_cast<QInputMethodEvent *>(event));
|
|
162
|
+
case bando_FunctionName::keyPressEvent: return this->Class_T::keyPressEvent(static_cast<QKeyEvent *>(event));
|
|
163
|
+
case bando_FunctionName::keyReleaseEvent: return this->Class_T::keyReleaseEvent(static_cast<QKeyEvent *>(event));
|
|
164
|
+
case bando_FunctionName::leaveEvent: return this->Class_T::leaveEvent(event);
|
|
165
|
+
case bando_FunctionName::mouseDoubleClickEvent: return this->Class_T::mouseDoubleClickEvent(static_cast<QMouseEvent *>(event));
|
|
166
|
+
case bando_FunctionName::mouseMoveEvent: return this->Class_T::mouseMoveEvent(static_cast<QMouseEvent *>(event));
|
|
167
|
+
case bando_FunctionName::mousePressEvent: return this->Class_T::mousePressEvent(static_cast<QMouseEvent *>(event));
|
|
168
|
+
case bando_FunctionName::mouseReleaseEvent: return this->Class_T::mouseReleaseEvent(static_cast<QMouseEvent *>(event));
|
|
169
|
+
case bando_FunctionName::moveEvent: return this->Class_T::moveEvent(static_cast<QMoveEvent *>(event));
|
|
170
|
+
case bando_FunctionName::paintEvent: return this->Class_T::paintEvent(static_cast<QPaintEvent *>(event));
|
|
171
|
+
case bando_FunctionName::resizeEvent: return this->Class_T::resizeEvent(static_cast<QResizeEvent *>(event));
|
|
172
|
+
case bando_FunctionName::showEvent: return this->Class_T::showEvent(static_cast<QShowEvent *>(event));
|
|
173
|
+
case bando_FunctionName::tabletEvent: return this->Class_T::tabletEvent(static_cast<QTabletEvent *>(event));
|
|
174
|
+
case bando_FunctionName::wheelEvent: return this->Class_T::wheelEvent(static_cast<QWheelEvent *>(event));
|
|
175
|
+
default: Q_UNREACHABLE(); break;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
public:
|
|
180
|
+
template <typename BC_T, typename C_T> friend const QMetaObject *bando_metaObject(const BC_T *self);
|
|
181
|
+
|
|
182
|
+
Rice::Object value_;
|
|
183
|
+
VALUE *value_address_;
|
|
184
|
+
|
|
185
|
+
QMetaObject *mo_;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
template <typename BC_T, typename C_T>
|
|
189
|
+
Rice::Data_Type<BC_T> define_bando_qspinbox_under(Rice::Module module, char const *name)
|
|
190
|
+
{
|
|
191
|
+
Rice::Data_Type<BC_T> bando_qlass =
|
|
192
|
+
Rice::define_class_under<BC_T, C_T>(module, name)
|
|
193
|
+
.define_method("_initialize_ruby_value", &BC_T::initializeValue, Rice::Arg("value"), Rice::Arg("mo"))
|
|
194
|
+
.define_method("_ruby_value", &BC_T::value)
|
|
195
|
+
.define_method("_ruby_value_handle_event", &BC_T::Class_T_handleEvent, Rice::Arg("name"), Rice::Arg("event"))
|
|
196
|
+
.define_method("_event", &BC_T::Class_T_handleQObjectEvent, Rice::Arg("event"))
|
|
197
|
+
.define_method("_event_filter", &BC_T::Class_T_handleQObjectEventFilter, Rice::Arg("watched"), Rice::Arg("event"))
|
|
198
|
+
.define_method("sender", &BC_T::sender);
|
|
199
|
+
|
|
200
|
+
bando_qlass
|
|
201
|
+
.define_method("minimum_size_hint", [](BC_T *self) -> QSize { return self->C_T::minimumSizeHint(); })
|
|
202
|
+
.define_method("size_hint", [](BC_T *self) -> QSize { return self->C_T::sizeHint(); });
|
|
203
|
+
|
|
204
|
+
return bando_qlass;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
#endif
|