/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef nsIMEStateManager_h__ #define nsIMEStateManager_h__ #include "mozilla/EventForwards.h" #include "nsIWidget.h" class nsDispatchingCallback; class nsIContent; class nsIDOMMouseEvent; class nsINode; class nsPIDOMWindow; class nsPresContext; class nsTextStateManager; class nsISelection; namespace mozilla { class TextCompositionArray; class TextComposition; } // namespace mozilla /* * IME state manager */ class nsIMEStateManager { friend class nsTextStateManager; protected: typedef mozilla::widget::IMEMessage IMEMessage; typedef mozilla::widget::IMEState IMEState; typedef mozilla::widget::InputContext InputContext; typedef mozilla::widget::InputContextAction InputContextAction; public: static void Shutdown(); static nsresult OnDestroyPresContext(nsPresContext* aPresContext); static nsresult OnRemoveContent(nsPresContext* aPresContext, nsIContent* aContent); /** * OnChangeFocus() should be called when focused content is changed or * IME enabled state is changed. If nobody has focus, set both aPresContext * and aContent nullptr. E.g., all windows are deactivated. */ static nsresult OnChangeFocus(nsPresContext* aPresContext, nsIContent* aContent, InputContextAction::Cause aCause); static void OnInstalledMenuKeyboardListener(bool aInstalling); // These two methods manage focus and selection/text observers. // They are separate from OnChangeFocus above because this offers finer // control compared to having the two methods incorporated into OnChangeFocus // Get the focused editor's selection and root static nsresult GetFocusSelectionAndRoot(nsISelection** aSel, nsIContent** aRoot); // This method updates the current IME state. However, if the enabled state // isn't changed by the new state, this method does nothing. // Note that this method changes the IME state of the active element in the // widget. So, the caller must have focus. static void UpdateIMEState(const IMEState &aNewIMEState, nsIContent* aContent); // This method is called when user clicked in an editor. // aContent must be: // If the editor is for or