1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 /* 7 8 The XUL "controllers" object. 9 10 */ 11 12 #ifndef nsXULControllers_h__ 13 #define nsXULControllers_h__ 14 15 #include "nsCOMPtr.h" 16 #include "nsTArray.h" 17 #include "nsIControllers.h" 18 #include "nsCycleCollectionParticipant.h" 19 20 /* non-XPCOM class for holding controllers and their IDs */ 21 class nsXULControllerData final { 22 public: 23 nsXULControllerData(uint32_t inControllerID, nsIController* inController); 24 ~nsXULControllerData() = default; 25 GetControllerID()26 uint32_t GetControllerID() { return mControllerID; } 27 28 nsresult GetController(nsIController** outController); 29 30 uint32_t mControllerID; 31 nsCOMPtr<nsIController> mController; 32 }; 33 34 class nsXULControllers final : public nsIControllers { 35 public: 36 nsXULControllers(); 37 38 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 39 NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXULControllers, nsIControllers) 40 NS_DECL_NSICONTROLLERS 41 42 protected: 43 virtual ~nsXULControllers(void); 44 45 void DeleteControllers(); 46 47 nsTArray<nsXULControllerData*> mControllers; 48 uint32_t mCurControllerID; 49 }; 50 51 #endif // nsXULControllers_h__ 52