LCOV - app.info - content/xul/content/src/nsXULPopupListener.h

LCOV - code coverage report
| Current view: | directory - content/xul/content/src - nsXULPopupListener.h (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 2 | 1 | 50.0 %
| Date: | 2012-04-21 | Functions: | 5 | 1 | 20.0 %

           1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
           2                 : /* ***** BEGIN LICENSE BLOCK *****
           3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
           4                 :  *
           5                 :  * The contents of this file are subject to the Mozilla Public License Version
           6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
           7                 :  * the License. You may obtain a copy of the License at
           8                 :  * http://www.mozilla.org/MPL/
           9                 :  *
          10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
          11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
          12                 :  * for the specific language governing rights and limitations under the
          13                 :  * License.
          14                 :  *
          15                 :  * The Original Code is mozilla.org code.
          16                 :  *
          17                 :  * The Initial Developer of the Original Code is
          18                 :  * Netscape Communications Corporation.
          19                 :  * Portions created by the Initial Developer are Copyright (C) 1998
          20                 :  * the Initial Developer. All Rights Reserved.
          21                 :  *
          22                 :  * Contributor(s):
          23                 :  *   Original Author: David W. Hyatt (hyatt@netscape.com)
          24                 :  *   Dean Tessman <dean_tessman@hotmail.com>
          25                 :  *   Pierre Phaneuf <pp@ludusdesign.com>
          26                 :  *   Robert O'Callahan <roc+moz@cs.cmu.edu>
          27                 :  *
          28                 :  * Alternatively, the contents of this file may be used under the terms of
          29                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
          30                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
          31                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
          32                 :  * of those above. If you wish to allow use of your version of this file only
          33                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
          34                 :  * use your version of this file under the terms of the MPL, indicate your
          35                 :  * decision by deleting the provisions above and replace them with the notice
          36                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
          37                 :  * the provisions above, a recipient may use your version of this file under
          38                 :  * the terms of any one of the MPL, the GPL or the LGPL.
          39                 :  *
          40                 :  * ***** END LICENSE BLOCK ***** */
          41                 :
          42                 : /**
          43                 :  * This is the popup listener implementation for popup menus and context menus.
          44                 :  */
          45                 :
          46                 : #ifndef nsXULPopupListener_h___
          47                 : #define nsXULPopupListener_h___
          48                 :
          49                 : #include "nsCOMPtr.h"
          50                 :
          51                 : #include "nsIContent.h"
          52                 : #include "nsIDOMElement.h"
          53                 : #include "nsIDOMMouseEvent.h"
          54                 : #include "nsIFrame.h"
          55                 : #include "nsIDOMEventListener.h"
          56                 : #include "nsCycleCollectionParticipant.h"
          57                 :
          58                 : class nsXULPopupListener : public nsIDOMEventListener
          59                 : {
          60                 : public:
          61                 :     // aElement is the element that the popup is attached to. If aIsContext is
          62                 :     // false, the popup opens on left click on aElement or a descendant. If
          63                 :     // aIsContext is true, the popup is a context menu which opens on a
          64                 :     // context menu event.
          65                 :     nsXULPopupListener(nsIDOMElement *aElement, bool aIsContext);
          66                 :     virtual ~nsXULPopupListener(void);
          67                 :
          68                 :     // nsISupports
          69               0 :     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
          70            1396 :     NS_DECL_CYCLE_COLLECTION_CLASS(nsXULPopupListener)
          71                 :     NS_DECL_NSIDOMEVENTLISTENER
          72                 :
          73                 : protected:
          74                 :     // open the popup. aEvent is the event that triggered the popup such as
          75                 :     // a mouse click and aTargetContent is the target of this event.
          76                 :     virtual nsresult LaunchPopup(nsIDOMEvent* aEvent, nsIContent* aTargetContent);
          77                 :
          78                 :     // close the popup when the listener goes away
          79                 :     virtual void ClosePopup();
          80                 :
          81                 : private:
          82                 : #ifndef NS_CONTEXT_MENU_IS_MOUSEUP
          83                 :     // When a context menu is opened, focus the target of the contextmenu event.
          84                 :     nsresult FireFocusOnTargetContent(nsIDOMNode* aTargetNode);
          85                 : #endif
          86                 :
          87                 :     // |mElement| is the node to which this listener is attached.
          88                 :     nsCOMPtr<nsIDOMElement> mElement;
          89                 :
          90                 :     // The popup that is getting shown on top of mElement.
          91                 :     nsCOMPtr<nsIContent> mPopupContent;
          92                 :
          93                 :     // true if a context popup
          94                 :     bool mIsContext;
          95                 : };
          96                 :
          97                 : #endif // nsXULPopupListener_h___

Generated by: LCOV version 1.7