00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 INLINE ButtonEvent::
00022 ButtonEvent() :
00023 _button(ButtonHandle::none()),
00024 _keycode(0),
00025 _type(T_down),
00026 _time(0.0)
00027 {
00028 }
00029
00030
00031
00032
00033
00034
00035 INLINE ButtonEvent::
00036 ButtonEvent(ButtonHandle button, ButtonEvent::Type type, double time) :
00037 _button(button),
00038 _keycode(0),
00039 _highlight_start(0),
00040 _highlight_end(0),
00041 _type(type),
00042 _time(time)
00043 {
00044 }
00045
00046
00047
00048
00049
00050
00051 INLINE ButtonEvent::
00052 ButtonEvent(short keycode, double time) :
00053 _button(ButtonHandle::none()),
00054 _keycode(keycode),
00055 _highlight_start(0),
00056 _highlight_end(0),
00057 _type(T_keystroke),
00058 _time(time)
00059 {
00060 }
00061
00062
00063
00064
00065
00066
00067 INLINE ButtonEvent::
00068 ButtonEvent(const wstring &candidate_string, size_t highlight_start,
00069 size_t highlight_end, size_t cursor_pos) :
00070 _button(ButtonHandle::none()),
00071 _keycode(0),
00072 _candidate_string(candidate_string),
00073 _highlight_start(highlight_start),
00074 _highlight_end(highlight_end),
00075 _cursor_pos(cursor_pos),
00076 _type(T_candidate),
00077 _time(ClockObject::get_global_clock()->get_frame_time())
00078 {
00079 }
00080
00081
00082
00083
00084
00085
00086 INLINE ButtonEvent::
00087 ButtonEvent(const ButtonEvent ©) :
00088 _button(copy._button),
00089 _keycode(copy._keycode),
00090 _candidate_string(copy._candidate_string),
00091 _highlight_start(copy._highlight_start),
00092 _highlight_end(copy._highlight_end),
00093 _cursor_pos(copy._cursor_pos),
00094 _type(copy._type),
00095 _time(copy._time)
00096 {
00097 }
00098
00099
00100
00101
00102
00103
00104 INLINE void ButtonEvent::
00105 operator = (const ButtonEvent ©) {
00106 _button = copy._button;
00107 _keycode = copy._keycode;
00108 _candidate_string = copy._candidate_string;
00109 _highlight_start = copy._highlight_start;
00110 _highlight_end = copy._highlight_end;
00111 _cursor_pos = copy._cursor_pos;
00112 _type = copy._type;
00113 _time = copy._time;
00114 }
00115
00116
00117
00118
00119
00120
00121
00122 INLINE bool ButtonEvent::
00123 operator == (const ButtonEvent &other) const {
00124 return (_button == other._button &&
00125 _keycode == other._keycode &&
00126 _type == other._type);
00127 }
00128
00129
00130
00131
00132
00133
00134 INLINE bool ButtonEvent::
00135 operator != (const ButtonEvent &other) const {
00136 return !operator == (other);
00137 }
00138
00139
00140
00141
00142
00143
00144 INLINE bool ButtonEvent::
00145 operator < (const ButtonEvent &other) const {
00146 if (_button != other._button) {
00147 return _button < other._button;
00148 }
00149 if (_keycode != other._keycode) {
00150 return _keycode < other._keycode;
00151 }
00152
00153 return _type < other._type;
00154 }
00155
00156
00157
00158
00159
00160
00161
00162 INLINE bool ButtonEvent::
00163 update_mods(ModifierButtons &mods) const {
00164 switch (_type) {
00165 case T_down:
00166 return mods.button_down(_button);
00167
00168 case T_up:
00169 return mods.button_up(_button);
00170
00171 default:
00172 return false;
00173 }
00174 }