28 JSEventMapper *JSEventMapper::m_inst = 0;
33 EventType( KJS::Identifier _id, QEvent::Type _type ) :
34 id(_id), type(_type) {;}
36 const KJS::Identifier
id;
37 const QEvent::Type type;
146 EventType( KJS::Identifier(
"onTimerEvent"), QEvent::Timer ),
147 EventType( KJS::Identifier(
"onMouseButtonPressEvent"), QEvent::MouseButtonPress ),
148 EventType( KJS::Identifier(
"onMouseButtonReleaseEvent"), QEvent::MouseButtonRelease ),
149 EventType( KJS::Identifier(
"onMouseButtonDblClickEvent"), QEvent::MouseButtonDblClick ),
150 EventType( KJS::Identifier(
"onMouseMoveEvent"), QEvent::MouseMove ),
151 EventType( KJS::Identifier(
"onKeyPressEvent"), QEvent::KeyPress ),
152 EventType( KJS::Identifier(
"onKeyReleaseEvent"), QEvent::KeyRelease ),
153 EventType( KJS::Identifier(
"onFocusInEvent"), QEvent::FocusIn ),
154 EventType( KJS::Identifier(
"onFocusOutEvent"), QEvent::FocusOut ),
155 EventType( KJS::Identifier(
"onEnterEvent"), QEvent::Enter ),
156 EventType( KJS::Identifier(
"onLeaveEvent"), QEvent::Leave ),
157 EventType( KJS::Identifier(
"onPaintEvent"), QEvent::Paint ),
158 EventType( KJS::Identifier(
"onMoveEvent"), QEvent::Move ),
159 EventType( KJS::Identifier(
"onResizeEvent"), QEvent::Resize ),
160 EventType( KJS::Identifier(
"onCreateEvent"), QEvent::Create ),
161 EventType( KJS::Identifier(
"onDestroyEvent"), QEvent::Destroy ),
162 EventType( KJS::Identifier(
"onShowEvent"), QEvent::Show ),
163 EventType( KJS::Identifier(
"onHideEvent"), QEvent::Hide ),
164 EventType( KJS::Identifier(
"onCloseEvent"), QEvent::Close ),
165 EventType( KJS::Identifier(
"onQuitEvent"), QEvent::Quit ),
166 EventType( KJS::Identifier(
"onParentChangeEvent"), QEvent::ParentChange ),
167 EventType( KJS::Identifier(
"onParentAboutToChangeEvent"), QEvent::ParentAboutToChange ),
168 EventType( KJS::Identifier(
"onThreadChangeEvent"), QEvent::ThreadChange ),
169 EventType( KJS::Identifier(
"onWindowActivateEvent"), QEvent::WindowActivate ),
170 EventType( KJS::Identifier(
"onWindowDeactivateEvent"), QEvent::WindowDeactivate ),
171 EventType( KJS::Identifier(
"onShowToParentEvent"), QEvent::ShowToParent ),
172 EventType( KJS::Identifier(
"onHideToParentEvent"), QEvent::HideToParent ),
173 EventType( KJS::Identifier(
"onWheelEvent"), QEvent::Wheel ),
174 EventType( KJS::Identifier(
"onWindowTitleChangeEvent"), QEvent::WindowTitleChange ),
175 EventType( KJS::Identifier(
"onWindowIconChangeEvent"), QEvent::WindowIconChange ),
176 EventType( KJS::Identifier(
"onApplicationWindowIconChangeEvent"), QEvent::ApplicationWindowIconChange ),
177 EventType( KJS::Identifier(
"onApplicationFontChangeEvent"), QEvent::ApplicationFontChange ),
178 EventType( KJS::Identifier(
"onApplicationLayoutDirectionChangeEvent"), QEvent::ApplicationLayoutDirectionChange ),
179 EventType( KJS::Identifier(
"onApplicationPaletteChangeEvent"), QEvent::ApplicationPaletteChange ),
180 EventType( KJS::Identifier(
"onPaletteChangeEvent"), QEvent::PaletteChange ),
181 EventType( KJS::Identifier(
"onClipboardEvent"), QEvent::Clipboard ),
182 EventType( KJS::Identifier(
"onSpeechEvent"), QEvent::Speech ),
183 EventType( KJS::Identifier(
"onMetaCallEvent"), QEvent::MetaCall ),
184 EventType( KJS::Identifier(
"onSockActEvent"), QEvent::SockAct ),
185 EventType( KJS::Identifier(
"onWinEventActEvent"), QEvent::WinEventAct ),
186 EventType( KJS::Identifier(
"onDeferredDeleteEvent"), QEvent::DeferredDelete ),
187 EventType( KJS::Identifier(
"onDragEnterEvent"), QEvent::DragEnter ),
188 EventType( KJS::Identifier(
"onDragMoveEvent"), QEvent::DragMove ),
189 EventType( KJS::Identifier(
"onDragLeaveEvent"), QEvent::DragLeave ),
190 EventType( KJS::Identifier(
"onDropEvent"), QEvent::Drop ),
191 EventType( KJS::Identifier(
"onDragResponseEvent"), QEvent::DragResponse ),
192 EventType( KJS::Identifier(
"onChildAddedEvent"), QEvent::ChildAdded ),
193 EventType( KJS::Identifier(
"onChildPolishedEvent"), QEvent::ChildRemoved ),
194 EventType( KJS::Identifier(
"onShowWindowRequestEvent"), QEvent::ShowWindowRequest ),
195 EventType( KJS::Identifier(
"onPolishRequestEvent"), QEvent::PolishRequest ),
196 EventType( KJS::Identifier(
"onPolishEvent"), QEvent::Polish ),
197 EventType( KJS::Identifier(
"onLayoutRequestEvent"), QEvent::LayoutRequest ),
198 EventType( KJS::Identifier(
"onUpdateRequestEvent"), QEvent::UpdateRequest ),
199 EventType( KJS::Identifier(
"onEmbeddingControlEvent"), QEvent::EmbeddingControl ),
200 EventType( KJS::Identifier(
"onActivateControlEvent"), QEvent::ActivateControl ),
201 EventType( KJS::Identifier(
"onDeactivateControlEvent"), QEvent::DeactivateControl ),
202 EventType( KJS::Identifier(
"onContextMenuEvent"), QEvent::ContextMenu ),
203 EventType( KJS::Identifier(
"onInputMethodEvent"), QEvent::InputMethod ),
204 EventType( KJS::Identifier(
"onAccessibilityPrepareEvent"), QEvent::AccessibilityPrepare ),
205 EventType( KJS::Identifier(
"onTabletMoveEvent"), QEvent::TabletMove ),
206 EventType( KJS::Identifier(
"onLocaleChangeEvent"), QEvent::LocaleChange ),
207 EventType( KJS::Identifier(
"onLanguageChangeEvent"), QEvent::LanguageChange ),
208 EventType( KJS::Identifier(
"onLayoutDirectionChangeEvent"), QEvent::LayoutDirectionChange ),
209 EventType( KJS::Identifier(
"onStyleEvent"), QEvent::Style ),
210 EventType( KJS::Identifier(
"onTabletPressEvent"), QEvent::TabletPress ),
211 EventType( KJS::Identifier(
"onTabletReleaseEvent"), QEvent::TabletRelease ),
212 EventType( KJS::Identifier(
"onOkRequestEvent"), QEvent::OkRequest ),
213 EventType( KJS::Identifier(
"onHelpRequestEvent"), QEvent::HelpRequest ),
214 EventType( KJS::Identifier(
"onIconDragEvent"), QEvent::IconDrag ),
215 EventType( KJS::Identifier(
"onFontChangeEvent"), QEvent::FontChange ),
216 EventType( KJS::Identifier(
"onEnabledChangeEvent"), QEvent::EnabledChange ),
217 EventType( KJS::Identifier(
"onActivationChangeEvent"), QEvent::ActivationChange ),
218 EventType( KJS::Identifier(
"onStyleChangeEvent"), QEvent::StyleChange ),
219 EventType( KJS::Identifier(
"onIconTextChangeEvent"), QEvent::IconTextChange ),
220 EventType( KJS::Identifier(
"onModifiedChangeEvent"), QEvent::ModifiedChange ),
221 EventType( KJS::Identifier(
"onMouseTrackingChangeEvent"), QEvent::MouseTrackingChange ),
222 EventType( KJS::Identifier(
"onWindowBlockedEvent"), QEvent::WindowBlocked ),
223 EventType( KJS::Identifier(
"onWindowUnblockedEvent"), QEvent::WindowUnblocked ),
224 EventType( KJS::Identifier(
"onWindowStateChangeEvent"), QEvent::WindowStateChange ),
225 EventType( KJS::Identifier(
"onToolTipEvent"), QEvent::ToolTip ),
226 EventType( KJS::Identifier(
"onWhatsThisEvent"), QEvent::WhatsThis ),
227 EventType( KJS::Identifier(
"onStatusTipEvent"), QEvent::StatusTip ),
228 EventType( KJS::Identifier(
"onActionChangedEvent"), QEvent::ActionChanged ),
229 EventType( KJS::Identifier(
"onActionAddedEvent"), QEvent::ActionAdded ),
230 EventType( KJS::Identifier(
"onActionRemovedEvent"), QEvent::ActionRemoved ),
231 EventType( KJS::Identifier(
"onFileOpenEvent"), QEvent::FileOpen ),
232 EventType( KJS::Identifier(
"onShortcutEvent"), QEvent::Shortcut ),
233 EventType( KJS::Identifier(
"onShortcutOverrideEvent"), QEvent::ShortcutOverride ),
234 EventType( KJS::Identifier(
"onWhatsThisClickedEvent"), QEvent::WhatsThisClicked ),
235 EventType( KJS::Identifier(
"onToolBarChangeEvent"), QEvent::ToolBarChange ),
236 EventType( KJS::Identifier(
"onApplicationActivatedEvent"), QEvent::ApplicationActivated ),
237 EventType( KJS::Identifier(
"onApplicationDeactivatedEvent"), QEvent::ApplicationDeactivated ),
238 EventType( KJS::Identifier(
"onQueryWhatsThisEvent"), QEvent::QueryWhatsThis ),
239 EventType( KJS::Identifier(
"onEnterWhatsThisModeEvent"), QEvent::EnterWhatsThisMode ),
240 EventType( KJS::Identifier(
"onLeaveWhatsThisModeEvent"), QEvent::LeaveWhatsThisMode ),
241 EventType( KJS::Identifier(
"onZOrderChangeEvent"), QEvent::ZOrderChange ),
242 EventType( KJS::Identifier(
"onHoverEnterEvent"), QEvent::HoverEnter ),
243 EventType( KJS::Identifier(
"onHoverLeaveEvent"), QEvent::HoverLeave ),
244 EventType( KJS::Identifier(
"onHoverMoveEvent"), QEvent::HoverMove ),
245 EventType( KJS::Identifier(
"onAccessibilityHelpEvent"), QEvent::AccessibilityHelp ),
246 EventType( KJS::Identifier(
"onAccessibilityDescriptionEvent"), QEvent::AccessibilityDescription ),
250 JSEventMapper::JSEventMapper()
266 m_eventToHandler[ t ] =
name;
271 return m_handlerToEvent[
toQString(name) ];
281 return m_eventToHandler[t];
void addEvent(const KJS::Identifier &name, QEvent::Type t)
Adds an event to the map.
KJS::Identifier findEventHandler(QEvent::Type t) const
Returns the name of the handler method for the specified event type.
END_VALUE_METHOD QString name
bool isEventHandler(const KJS::Identifier &name) const
Returns true iff the specified name is the identifier for an event handler.
END_VALUE_METHOD QString id
static EventType events[]
static JSEventMapper * mapper()
Return the global event mapper.
Maintains a map between the types of QEvent and the names of their event handlers.
QEvent::Type findEventType(const KJS::Identifier &name) const
Returns the type of the events handled by the specified handler.
bool contains(const Key &key) const
QString toQString(const KJS::UString &u)