accessible/src/base/SelectionManager.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef mozilla_a11y_SelectionManager_h__
michael@0 7 #define mozilla_a11y_SelectionManager_h__
michael@0 8
michael@0 9 #include "nsIFrame.h"
michael@0 10 #include "nsISelectionListener.h"
michael@0 11
michael@0 12 class nsIPresShell;
michael@0 13
michael@0 14 namespace mozilla {
michael@0 15
michael@0 16 namespace dom {
michael@0 17 class Element;
michael@0 18 }
michael@0 19
michael@0 20 namespace a11y {
michael@0 21
michael@0 22 class AccEvent;
michael@0 23
michael@0 24 /**
michael@0 25 * This special accessibility class is for the caret and selection management.
michael@0 26 * There is only 1 visible caret per top level window. However, there may be
michael@0 27 * several visible selections.
michael@0 28 *
michael@0 29 * The important selections are the one owned by each document, and the one in
michael@0 30 * the currently focused control.
michael@0 31 *
michael@0 32 * On Windows this class is used to move an invisible system caret that
michael@0 33 * shadows the Mozilla caret. Windows will also automatically map this to
michael@0 34 * the MSAA caret accessible object (via OBJID_CARET) (as opposed to the root
michael@0 35 * accessible tree for a window which is retrieved with OBJID_CLIENT).
michael@0 36 *
michael@0 37 * For ATK and IAccessible2, this class is used to fire caret move and
michael@0 38 * selection change events.
michael@0 39 */
michael@0 40
michael@0 41 struct SelData;
michael@0 42
michael@0 43 class SelectionManager : public nsISelectionListener
michael@0 44 {
michael@0 45 public:
michael@0 46 // nsISupports
michael@0 47 // implemented by derived nsAccessibilityService
michael@0 48
michael@0 49 // nsISelectionListener
michael@0 50 NS_DECL_NSISELECTIONLISTENER
michael@0 51
michael@0 52 // SelectionManager
michael@0 53 void Shutdown() { ClearControlSelectionListener(); }
michael@0 54
michael@0 55 /**
michael@0 56 * Listen to selection events on the focused control.
michael@0 57 *
michael@0 58 * Note: only one control's selection events are listened to at a time. This
michael@0 59 * will remove the previous control's selection listener.
michael@0 60 */
michael@0 61 void SetControlSelectionListener(dom::Element* aFocusedElm);
michael@0 62
michael@0 63 /**
michael@0 64 * Stop listening to selection events on the control.
michael@0 65 */
michael@0 66 void ClearControlSelectionListener();
michael@0 67
michael@0 68 /**
michael@0 69 * Listen to selection events on the document.
michael@0 70 */
michael@0 71 void AddDocSelectionListener(nsIPresShell* aPresShell);
michael@0 72
michael@0 73 /**
michael@0 74 * Stop listening to selection events for a given document
michael@0 75 */
michael@0 76 void RemoveDocSelectionListener(nsIPresShell* aShell);
michael@0 77
michael@0 78 /**
michael@0 79 * Process delayed event, results in caret move and text selection change
michael@0 80 * events.
michael@0 81 */
michael@0 82 void ProcessTextSelChangeEvent(AccEvent* aEvent);
michael@0 83
michael@0 84 protected:
michael@0 85 /**
michael@0 86 * Process DOM selection change. Fire selection and caret move events.
michael@0 87 */
michael@0 88 void ProcessSelectionChanged(SelData* aSelData);
michael@0 89
michael@0 90 private:
michael@0 91 // Currently focused control.
michael@0 92 nsWeakFrame mCurrCtrlFrame;
michael@0 93 };
michael@0 94
michael@0 95 } // namespace a11y
michael@0 96 } // namespace mozilla
michael@0 97
michael@0 98 #endif

mercurial