00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 INLINE MouseWatcherParameter::
00022 MouseWatcherParameter() {
00023 _keycode = 0;
00024 _flags = 0;
00025 }
00026
00027
00028
00029
00030
00031
00032 INLINE MouseWatcherParameter::
00033 MouseWatcherParameter(const MouseWatcherParameter ©) :
00034 _button(copy._button),
00035 _keycode(copy._keycode),
00036 _mods(copy._mods),
00037 _mouse(copy._mouse),
00038 _flags(copy._flags)
00039 {
00040 }
00041
00042
00043
00044
00045
00046
00047 INLINE void MouseWatcherParameter::
00048 operator = (const MouseWatcherParameter ©) {
00049 _button = copy._button;
00050 _keycode = copy._keycode;
00051 _mods = copy._mods;
00052 _mouse = copy._mouse;
00053 _flags = copy._flags;
00054 }
00055
00056
00057
00058
00059
00060
00061 INLINE MouseWatcherParameter::
00062 ~MouseWatcherParameter() {
00063 }
00064
00065
00066
00067
00068
00069
00070
00071 INLINE void MouseWatcherParameter::
00072 set_button(const ButtonHandle &button) {
00073 _button = button;
00074 _flags |= F_has_button;
00075 }
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 INLINE void MouseWatcherParameter::
00086 set_keyrepeat(bool flag) {
00087 if (flag) {
00088 _flags |= F_is_keyrepeat;
00089 } else {
00090 _flags &= ~F_is_keyrepeat;
00091 }
00092 }
00093
00094
00095
00096
00097
00098
00099 INLINE void MouseWatcherParameter::
00100 set_keycode(int keycode) {
00101 _keycode = keycode;
00102 _flags |= F_has_keycode;
00103 }
00104
00105
00106
00107
00108
00109
00110
00111 INLINE void MouseWatcherParameter::
00112 set_candidate(const wstring &candidate_string,
00113 size_t highlight_start, size_t highlight_end,
00114 size_t cursor_pos) {
00115 _candidate_string = candidate_string;
00116 _highlight_start = highlight_start;
00117 _highlight_end = highlight_end;
00118 _cursor_pos = cursor_pos;
00119 _flags |= F_has_candidate;
00120 }
00121
00122
00123
00124
00125
00126
00127
00128 INLINE void MouseWatcherParameter::
00129 set_modifier_buttons(const ModifierButtons &mods) {
00130 _mods = mods;
00131 }
00132
00133
00134
00135
00136
00137
00138
00139 INLINE void MouseWatcherParameter::
00140 set_mouse(const LPoint2 &mouse) {
00141 _mouse = mouse;
00142 _flags |= F_has_mouse;
00143 }
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153 INLINE void MouseWatcherParameter::
00154 set_outside(bool flag) {
00155 if (flag) {
00156 _flags |= F_is_outside;
00157 } else {
00158 _flags &= ~F_is_outside;
00159 }
00160 }
00161
00162
00163
00164
00165
00166
00167
00168 INLINE bool MouseWatcherParameter::
00169 has_button() const {
00170 return (_flags & F_has_button) != 0;
00171 }
00172
00173
00174
00175
00176
00177
00178
00179
00180 INLINE ButtonHandle MouseWatcherParameter::
00181 get_button() const {
00182 return _button;
00183 }
00184
00185
00186
00187
00188
00189
00190
00191
00192 INLINE bool MouseWatcherParameter::
00193 is_keyrepeat() const {
00194 return (_flags & F_is_keyrepeat) != 0;
00195 }
00196
00197
00198
00199
00200
00201
00202
00203 INLINE bool MouseWatcherParameter::
00204 has_keycode() const {
00205 return (_flags & F_has_keycode) != 0;
00206 }
00207
00208
00209
00210
00211
00212
00213
00214 INLINE int MouseWatcherParameter::
00215 get_keycode() const {
00216 return _keycode;
00217 }
00218
00219
00220
00221
00222
00223
00224
00225 INLINE bool MouseWatcherParameter::
00226 has_candidate() const {
00227 return (_flags & F_has_candidate) != 0;
00228 }
00229
00230
00231
00232
00233
00234
00235
00236
00237 INLINE const wstring &MouseWatcherParameter::
00238 get_candidate_string() const {
00239 return _candidate_string;
00240 }
00241
00242
00243
00244
00245
00246
00247
00248
00249 INLINE string MouseWatcherParameter::
00250 get_candidate_string_encoded() const {
00251 return get_candidate_string_encoded(TextEncoder::get_default_encoding());
00252 }
00253
00254
00255
00256
00257
00258
00259
00260
00261 INLINE string MouseWatcherParameter::
00262 get_candidate_string_encoded(TextEncoder::Encoding encoding) const {
00263 return TextEncoder::encode_wtext(_candidate_string, encoding);
00264 }
00265
00266
00267
00268
00269
00270
00271
00272 INLINE size_t MouseWatcherParameter::
00273 get_highlight_start() const {
00274 return _highlight_start;
00275 }
00276
00277
00278
00279
00280
00281
00282
00283 INLINE size_t MouseWatcherParameter::
00284 get_highlight_end() const {
00285 return _highlight_end;
00286 }
00287
00288
00289
00290
00291
00292
00293
00294 INLINE size_t MouseWatcherParameter::
00295 get_cursor_pos() const {
00296 return _cursor_pos;
00297 }
00298
00299
00300
00301
00302
00303
00304
00305 INLINE const ModifierButtons &MouseWatcherParameter::
00306 get_modifier_buttons() const {
00307 return _mods;
00308 }
00309
00310
00311
00312
00313
00314
00315
00316 INLINE bool MouseWatcherParameter::
00317 has_mouse() const {
00318 return (_flags & F_has_mouse) != 0;
00319 }
00320
00321
00322
00323
00324
00325
00326
00327
00328 INLINE const LPoint2 &MouseWatcherParameter::
00329 get_mouse() const {
00330 nassertr(has_mouse(), _mouse);
00331 return _mouse;
00332 }
00333
00334
00335
00336
00337
00338
00339
00340
00341 INLINE bool MouseWatcherParameter::
00342 is_outside() const {
00343 return (_flags & F_is_outside) != 0;
00344 }
00345
00346 INLINE ostream &
00347 operator << (ostream &out, const MouseWatcherParameter &parm) {
00348 parm.output(out);
00349 return out;
00350 }