Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; 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 : #ifndef nsMathMLmactionFrame_h___
7 : #define nsMathMLmactionFrame_h___
8 :
9 : #include "nsCOMPtr.h"
10 : #include "nsMathMLSelectedFrame.h"
11 : #include "nsIDOMEventListener.h"
12 : #include "mozilla/Attributes.h"
13 :
14 : //
15 : // <maction> -- bind actions to a subexpression
16 : //
17 :
18 : class nsMathMLmactionFrame : public nsMathMLSelectedFrame {
19 : public:
20 0 : NS_DECL_FRAMEARENA_HELPERS(nsMathMLmactionFrame)
21 :
22 : friend nsIFrame* NS_NewMathMLmactionFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
23 :
24 : virtual void
25 : Init(nsIContent* aContent,
26 : nsContainerFrame* aParent,
27 : nsIFrame* aPrevInFlow) override;
28 :
29 : virtual void
30 : SetInitialChildList(ChildListID aListID,
31 : nsFrameList& aChildList) override;
32 :
33 : virtual nsresult
34 : ChildListChanged(int32_t aModType) override;
35 :
36 : virtual nsresult
37 : AttributeChanged(int32_t aNameSpaceID,
38 : nsIAtom* aAttribute,
39 : int32_t aModType) override;
40 :
41 : private:
42 : void MouseClick();
43 : void MouseOver();
44 : void MouseOut();
45 :
46 : class MouseListener final : public nsIDOMEventListener
47 : {
48 : private:
49 0 : ~MouseListener() {}
50 :
51 : public:
52 : NS_DECL_ISUPPORTS
53 : NS_DECL_NSIDOMEVENTLISTENER
54 :
55 0 : explicit MouseListener(nsMathMLmactionFrame* aOwner) : mOwner(aOwner) { }
56 :
57 : nsMathMLmactionFrame* mOwner;
58 : };
59 :
60 : protected:
61 0 : explicit nsMathMLmactionFrame(nsStyleContext* aContext) :
62 0 : nsMathMLSelectedFrame(aContext, kClassID) {}
63 : virtual ~nsMathMLmactionFrame();
64 :
65 : private:
66 : int32_t mActionType;
67 : int32_t mChildCount;
68 : int32_t mSelection;
69 : RefPtr<MouseListener> mListener;
70 :
71 : // helper to return the frame for the attribute selection="number"
72 : nsIFrame*
73 : GetSelectedFrame() override;
74 : };
75 :
76 : #endif /* nsMathMLmactionFrame_h___ */
|