Source code

Revision control

Other Tools

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
: mControllerID(inControllerID), mController(inController) {}
25
26
~nsXULControllerData() {}
27
28
uint32_t GetControllerID() { return mControllerID; }
29
30
nsresult GetController(nsIController** outController) {
31
NS_IF_ADDREF(*outController = mController);
32
return NS_OK;
33
}
34
35
uint32_t mControllerID;
36
nsCOMPtr<nsIController> mController;
37
};
38
39
class nsXULControllers final : public nsIControllers {
40
public:
41
nsXULControllers();
42
43
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
44
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXULControllers, nsIControllers)
45
NS_DECL_NSICONTROLLERS
46
47
protected:
48
virtual ~nsXULControllers(void);
49
50
void DeleteControllers();
51
52
nsTArray<nsXULControllerData*> mControllers;
53
uint32_t mCurControllerID;
54
};
55
56
#endif // nsXULControllers_h__