| 1 |
/* File : fl_ask.i */ |
| 2 |
//%module fl_ask |
| 3 |
|
| 4 |
%{ |
| 5 |
#include "FL/fl_ask.H" |
| 6 |
%} |
| 7 |
|
| 8 |
//%ignore fl_alert; |
| 9 |
//%ignore fl_ask; |
| 10 |
//%ignore fl_choice; |
| 11 |
%ignore fl_input; |
| 12 |
//%ignore fl_message; |
| 13 |
%ignore fl_password; |
| 14 |
%ignore fl_input_str; |
| 15 |
%ignore fl_password_str; |
| 16 |
|
| 17 |
%wrapper %{ |
| 18 |
#ifdef __GNUC__ |
| 19 |
#pragma GCC diagnostic push |
| 20 |
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
| 21 |
#endif |
| 22 |
%} |
| 23 |
%include "FL/fl_ask.H" |
| 24 |
%wrapper %{ |
| 25 |
#ifdef __GNUC__ |
| 26 |
#pragma GCC diagnostic pop |
| 27 |
#endif |
| 28 |
%} |
| 29 |
|
| 30 |
|
| 31 |
// avoiding varargs problem |
| 32 |
%rename (fl_password) fl_vararg_password; |
| 33 |
%rename (fl_input) fl_vararg_input; |
| 34 |
|
| 35 |
|
| 36 |
%ignore fl_input_str(int maxchar, const char *label, const char *deflt = 0, ...); |
| 37 |
%ignore fl_input_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...); |
| 38 |
%ignore fl_password_str(int maxchar, const char *label, const char *deflt = 0, ...); |
| 39 |
%ignore fl_password_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...); |
| 40 |
|
| 41 |
|
| 42 |
%inline %{ |
| 43 |
const char *fl_vararg_input(const char *label, const char *deflt = 0) { |
| 44 |
const char* result = 0; |
| 45 |
result = fl_input("%s", deflt, label); |
| 46 |
return result; |
| 47 |
}; |
| 48 |
|
| 49 |
const char *fl_vararg_password(const char *label, const char *deflt = 0) { |
| 50 |
const char* result = 0; |
| 51 |
result = fl_password("%s", deflt, label); |
| 52 |
return result; |
| 53 |
}; |
| 54 |
|
| 55 |
const char* fl_no_get() { |
| 56 |
return fl_yes; |
| 57 |
}; |
| 58 |
const char* fl_yes_get() { |
| 59 |
return fl_yes; |
| 60 |
}; |
| 61 |
const char* fl_ok_get() { |
| 62 |
return fl_yes; |
| 63 |
}; |
| 64 |
const char* fl_cancel_get() { |
| 65 |
return fl_yes; |
| 66 |
}; |
| 67 |
const char* fl_close_get() { |
| 68 |
return fl_yes; |
| 69 |
}; |
| 70 |
void fl_no_set(const char* value) { |
| 71 |
fl_no = value; |
| 72 |
}; |
| 73 |
void fl_yes_set(const char* value) { |
| 74 |
fl_yes = value; |
| 75 |
}; |
| 76 |
void fl_ok_set(const char* value) { |
| 77 |
fl_ok = value; |
| 78 |
}; |
| 79 |
void fl_cancel_set(const char* value) { |
| 80 |
fl_cancel = value; |
| 81 |
}; |
| 82 |
void fl_close_set(const char* value) { |
| 83 |
fl_close = value; |
| 84 |
}; |
| 85 |
%} |
| 86 |
|
| 87 |
// multi-threading extensions |
| 88 |
//%rename (fl_message) fl_mt_message; |
| 89 |
//%rename (fl_alert) fl_mt_alert; |
| 90 |
//%rename (fl_ask) fl_mt_ask; |
| 91 |
//%rename (fl_choice) fl_mt_choice; |
| 92 |
//%rename (fl_input) fl_mt_input; |
| 93 |
//%rename (fl_password) fl_mt_password; |
| 94 |
%inline %{ |
| 95 |
void fl_mt_message(const char* text) { |
| 96 |
Py_BEGIN_ALLOW_THREADS; |
| 97 |
fl_message("%s", text); |
| 98 |
Py_END_ALLOW_THREADS; |
| 99 |
}; |
| 100 |
|
| 101 |
void fl_mt_alert(const char* text) { |
| 102 |
Py_BEGIN_ALLOW_THREADS; |
| 103 |
fl_alert("%s", text); |
| 104 |
Py_END_ALLOW_THREADS; |
| 105 |
}; |
| 106 |
|
| 107 |
|
| 108 |
int fl_mt_ask(const char* text) { |
| 109 |
int status = 0; |
| 110 |
#ifdef __GNUC__ |
| 111 |
#pragma GCC diagnostic push |
| 112 |
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
| 113 |
#endif |
| 114 |
Py_BEGIN_ALLOW_THREADS; |
| 115 |
status = fl_ask("%s", text); |
| 116 |
Py_END_ALLOW_THREADS; |
| 117 |
#ifdef __GNUC__ |
| 118 |
#pragma GCC diagnostic pop |
| 119 |
#endif |
| 120 |
return status; |
| 121 |
}; |
| 122 |
|
| 123 |
int fl_mt_choice(const char *q,const char *b0,const char *b1,const char *b2) { |
| 124 |
int status = 0; |
| 125 |
Py_BEGIN_ALLOW_THREADS; |
| 126 |
status = fl_choice("%s", b0, b1, b2, q); |
| 127 |
Py_END_ALLOW_THREADS; |
| 128 |
return status; |
| 129 |
}; |
| 130 |
|
| 131 |
const char *fl_mt_input(const char *label, const char *deflt = 0) { |
| 132 |
const char* result = 0; |
| 133 |
Py_BEGIN_ALLOW_THREADS; |
| 134 |
result = fl_input("%s", deflt, label); |
| 135 |
Py_END_ALLOW_THREADS; |
| 136 |
return result; |
| 137 |
}; |
| 138 |
|
| 139 |
const char *fl_mt_password(const char *label, const char *deflt = 0) { |
| 140 |
const char* result = 0; |
| 141 |
Py_BEGIN_ALLOW_THREADS; |
| 142 |
result = fl_password("%s", deflt, label); |
| 143 |
Py_END_ALLOW_THREADS; |
| 144 |
return result; |
| 145 |
}; |
| 146 |
|
| 147 |
%} |