26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
-
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
|
#import "helpers.h"
using ObjQt::toOF;
using ObjQt::toQt;
@implementation QtPushButton
- initWithQAbstractButton: (QAbstractButton*)qAbstractButton
- initWithQAbstractButton: (QAbstractButton *)qAbstractButton
{
OF_INVALID_INIT_METHOD
}
- initWithQPushButton: (QPushButton*)qPushButton
- initWithQPushButton: (QPushButton *)qPushButton
{
return [super initWithQAbstractButton: qPushButton];
}
- initWithText: (OFString*)text
- initWithText: (OFString *)text
{
try {
self = [self initWithQPushButton:
new QPushButton(toQt(text))];
[self takeOwnership];
return self;
} catch (const std::bad_alloc &e) {
self = [super initWithQAbstractButton: NULL];
[self release];
throw;
}
}
- initWithIcon: (QIcon)icon
text: (OFString*)text
text: (OFString *)text
{
try {
self = [self initWithQPushButton:
new QPushButton(icon, toQt(text))];
[self takeOwnership];
return self;
} catch (const std::bad_alloc &e) {
self = [super initWithQAbstractButton: NULL];
[self release];
throw;
}
}
- (QPushButton*)qPushButton
- (QPushButton *)qPushButton
{
return qobject_cast<QPushButton*>(_qObject);
return qobject_cast<QPushButton *>(_qObject);
}
- (QMenu*)menu
- (QMenu *)menu
{
return toQt(self)->menu();
}
- (void)setMenu: (QMenu*)menu
- (void)setMenu: (QMenu *)menu
{
toQt(self)->setMenu(menu);
}
- (bool)autoDefault
{
return toQt(self)->autoDefault();
|