nsMathMLmactionFrame.h 1.9 KB

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