|
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 "nsBoxFrame.h" |
|
10 |
|
11 class nsButtonBoxFrame : public nsBoxFrame |
|
12 { |
|
13 public: |
|
14 NS_DECL_FRAMEARENA_HELPERS |
|
15 |
|
16 friend nsIFrame* NS_NewButtonBoxFrame(nsIPresShell* aPresShell); |
|
17 |
|
18 nsButtonBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) |
|
19 :nsBoxFrame(aPresShell, aContext, false) { |
|
20 UpdateMouseThrough(); |
|
21 } |
|
22 |
|
23 virtual void BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder, |
|
24 const nsRect& aDirtyRect, |
|
25 const nsDisplayListSet& aLists) MOZ_OVERRIDE; |
|
26 |
|
27 virtual nsresult HandleEvent(nsPresContext* aPresContext, |
|
28 mozilla::WidgetGUIEvent* aEvent, |
|
29 nsEventStatus* aEventStatus) MOZ_OVERRIDE; |
|
30 |
|
31 virtual void MouseClicked(nsPresContext* aPresContext, |
|
32 mozilla::WidgetGUIEvent* aEvent) |
|
33 { DoMouseClick(aEvent, false); } |
|
34 |
|
35 #ifdef DEBUG_FRAME_DUMP |
|
36 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { |
|
37 return MakeFrameName(NS_LITERAL_STRING("ButtonBoxFrame"), aResult); |
|
38 } |
|
39 #endif |
|
40 |
|
41 /** |
|
42 * Our implementation of MouseClicked. |
|
43 * @param aTrustEvent if true and aEvent as null, then assume the event was trusted |
|
44 */ |
|
45 void DoMouseClick(mozilla::WidgetGUIEvent* aEvent, bool aTrustEvent); |
|
46 void UpdateMouseThrough() MOZ_OVERRIDE { AddStateBits(NS_FRAME_MOUSE_THROUGH_NEVER); } |
|
47 }; // class nsButtonBoxFrame |
|
48 |
|
49 #endif /* nsButtonBoxFrame_h___ */ |