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 : #ifndef nsButtonBoxFrame_h___
6 : #define nsButtonBoxFrame_h___
7 :
8 : #include "mozilla/Attributes.h"
9 : #include "nsIDOMEventListener.h"
10 : #include "nsBoxFrame.h"
11 :
12 15 : class nsButtonBoxFrame : public nsBoxFrame
13 : {
14 : public:
15 576 : NS_DECL_FRAMEARENA_HELPERS(nsButtonBoxFrame)
16 :
17 : friend nsIFrame* NS_NewButtonBoxFrame(nsIPresShell* aPresShell);
18 :
19 : explicit nsButtonBoxFrame(nsStyleContext* aContext, ClassID = kClassID);
20 :
21 : virtual void Init(nsIContent* aContent,
22 : nsContainerFrame* aParent,
23 : nsIFrame* aPrevInFlow) override;
24 :
25 : virtual void BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
26 : const nsRect& aDirtyRect,
27 : const nsDisplayListSet& aLists) override;
28 :
29 : virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
30 :
31 : virtual nsresult HandleEvent(nsPresContext* aPresContext,
32 : mozilla::WidgetGUIEvent* aEvent,
33 : nsEventStatus* aEventStatus) override;
34 :
35 0 : virtual void MouseClicked(mozilla::WidgetGUIEvent* aEvent)
36 0 : { DoMouseClick(aEvent, false); }
37 :
38 : void Blurred();
39 :
40 : #ifdef DEBUG_FRAME_DUMP
41 0 : virtual nsresult GetFrameName(nsAString& aResult) const override {
42 0 : return MakeFrameName(NS_LITERAL_STRING("ButtonBoxFrame"), aResult);
43 : }
44 : #endif
45 :
46 : /**
47 : * Our implementation of MouseClicked.
48 : * @param aTrustEvent if true and aEvent as null, then assume the event was trusted
49 : */
50 : void DoMouseClick(mozilla::WidgetGUIEvent* aEvent, bool aTrustEvent);
51 64 : void UpdateMouseThrough() override { AddStateBits(NS_FRAME_MOUSE_THROUGH_NEVER); }
52 :
53 : private:
54 : class nsButtonBoxListener final : public nsIDOMEventListener
55 : {
56 : public:
57 32 : explicit nsButtonBoxListener(nsButtonBoxFrame* aButtonBoxFrame) :
58 32 : mButtonBoxFrame(aButtonBoxFrame)
59 32 : { }
60 :
61 : NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) override;
62 :
63 : NS_DECL_ISUPPORTS
64 :
65 : private:
66 : friend class nsButtonBoxFrame;
67 45 : virtual ~nsButtonBoxListener() { }
68 : nsButtonBoxFrame* mButtonBoxFrame;
69 : };
70 :
71 : RefPtr<nsButtonBoxListener> mButtonBoxListener;
72 : bool mIsHandlingKeyEvent;
73 : }; // class nsButtonBoxFrame
74 :
75 : #endif /* nsButtonBoxFrame_h___ */
|