michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: michael@0: The XUL "controllers" object. michael@0: michael@0: */ michael@0: michael@0: #ifndef nsXULControllers_h__ michael@0: #define nsXULControllers_h__ michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsTArray.h" michael@0: #include "nsWeakPtr.h" michael@0: #include "nsIControllers.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: michael@0: /* non-XPCOM class for holding controllers and their IDs */ michael@0: class nsXULControllerData michael@0: { michael@0: public: michael@0: nsXULControllerData(uint32_t inControllerID, nsIController* inController) michael@0: : mControllerID(inControllerID) michael@0: , mController(inController) michael@0: { michael@0: } michael@0: michael@0: ~nsXULControllerData() {} michael@0: michael@0: uint32_t GetControllerID() { return mControllerID; } michael@0: michael@0: nsresult GetController(nsIController **outController) michael@0: { michael@0: NS_IF_ADDREF(*outController = mController); michael@0: return NS_OK; michael@0: } michael@0: michael@0: uint32_t mControllerID; michael@0: nsCOMPtr mController; michael@0: }; michael@0: michael@0: michael@0: nsresult NS_NewXULControllers(nsISupports* aOuter, REFNSIID aIID, void** aResult); michael@0: michael@0: class nsXULControllers : public nsIControllers michael@0: { michael@0: public: michael@0: friend nsresult michael@0: NS_NewXULControllers(nsISupports* aOuter, REFNSIID aIID, void** aResult); michael@0: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXULControllers, nsIControllers) michael@0: NS_DECL_NSICONTROLLERS michael@0: michael@0: protected: michael@0: nsXULControllers(); michael@0: virtual ~nsXULControllers(void); michael@0: michael@0: void DeleteControllers(); michael@0: michael@0: nsTArray mControllers; michael@0: uint32_t mCurControllerID; michael@0: }; michael@0: michael@0: michael@0: michael@0: michael@0: #endif // nsXULControllers_h__