content/xul/document/src/nsXULControllers.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/xul/document/src/nsXULControllers.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,71 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +/*
    1.10 +
    1.11 +  The XUL "controllers" object.
    1.12 +
    1.13 +*/
    1.14 +
    1.15 +#ifndef nsXULControllers_h__
    1.16 +#define nsXULControllers_h__
    1.17 +
    1.18 +#include "nsCOMPtr.h"
    1.19 +#include "nsTArray.h"
    1.20 +#include "nsWeakPtr.h"
    1.21 +#include "nsIControllers.h"
    1.22 +#include "nsCycleCollectionParticipant.h"
    1.23 +
    1.24 +/* non-XPCOM class for holding controllers and their IDs */
    1.25 +class nsXULControllerData
    1.26 +{
    1.27 +public:
    1.28 +                            nsXULControllerData(uint32_t inControllerID, nsIController* inController)
    1.29 +                            : mControllerID(inControllerID)
    1.30 +                            , mController(inController)
    1.31 +                            {                            
    1.32 +                            }
    1.33 +
    1.34 +                            ~nsXULControllerData() {}
    1.35 +
    1.36 +    uint32_t                GetControllerID()   { return mControllerID; }
    1.37 +
    1.38 +    nsresult                GetController(nsIController **outController)
    1.39 +                            {
    1.40 +                              NS_IF_ADDREF(*outController = mController);
    1.41 +                              return NS_OK;
    1.42 +                            }
    1.43 +    
    1.44 +    uint32_t                mControllerID;
    1.45 +    nsCOMPtr<nsIController> mController;
    1.46 +};
    1.47 +
    1.48 +
    1.49 +nsresult NS_NewXULControllers(nsISupports* aOuter, REFNSIID aIID, void** aResult);
    1.50 +
    1.51 +class nsXULControllers : public nsIControllers
    1.52 +{
    1.53 +public:
    1.54 +    friend nsresult
    1.55 +    NS_NewXULControllers(nsISupports* aOuter, REFNSIID aIID, void** aResult);
    1.56 +
    1.57 +    NS_DECL_CYCLE_COLLECTING_ISUPPORTS
    1.58 +    NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXULControllers, nsIControllers)
    1.59 +    NS_DECL_NSICONTROLLERS
    1.60 +  
    1.61 +protected:
    1.62 +    nsXULControllers();
    1.63 +    virtual ~nsXULControllers(void);
    1.64 +
    1.65 +    void        DeleteControllers();
    1.66 +
    1.67 +    nsTArray<nsXULControllerData*>   mControllers;
    1.68 +    uint32_t                         mCurControllerID;
    1.69 +};
    1.70 +
    1.71 +
    1.72 +
    1.73 +
    1.74 +#endif // nsXULControllers_h__

mercurial