1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 //
8 // nsSplitterFrame
9 //
10 
11 #ifndef nsSplitterFrame_h__
12 #define nsSplitterFrame_h__
13 
14 #include "mozilla/Attributes.h"
15 #include "nsBoxFrame.h"
16 
17 class nsSplitterFrameInner;
18 
19 namespace mozilla {
20 class PresShell;
21 }  // namespace mozilla
22 
23 nsIFrame* NS_NewSplitterFrame(mozilla::PresShell* aPresShell,
24                               mozilla::ComputedStyle* aStyle);
25 
26 class nsSplitterFrame final : public nsBoxFrame {
27  public:
28   NS_DECL_FRAMEARENA_HELPERS(nsSplitterFrame)
29 
30   explicit nsSplitterFrame(ComputedStyle* aStyle, nsPresContext* aPresContext);
31   virtual void DestroyFrom(nsIFrame* aDestructRoot,
32                            PostDestroyData& aPostDestroyData) override;
33 
34 #ifdef DEBUG_FRAME_DUMP
GetFrameName(nsAString & aResult)35   virtual nsresult GetFrameName(nsAString& aResult) const override {
36     return MakeFrameName(NS_LITERAL_STRING("SplitterFrame"), aResult);
37   }
38 #endif
39 
40   // nsIFrame overrides
41   virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
42                                     int32_t aModType) override;
43 
44   virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
45                     nsIFrame* aPrevInFlow) override;
46 
47   NS_IMETHOD DoXULLayout(nsBoxLayoutState& aBoxLayoutState) override;
48 
49   NS_IMETHOD HandlePress(nsPresContext* aPresContext,
50                          mozilla::WidgetGUIEvent* aEvent,
51                          nsEventStatus* aEventStatus) override;
52 
53   NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext,
54                                  mozilla::WidgetGUIEvent* aEvent,
55                                  nsEventStatus* aEventStatus,
56                                  bool aControlHeld) override;
57 
58   MOZ_CAN_RUN_SCRIPT
59   NS_IMETHOD HandleDrag(nsPresContext* aPresContext,
60                         mozilla::WidgetGUIEvent* aEvent,
61                         nsEventStatus* aEventStatus) override;
62 
63   NS_IMETHOD HandleRelease(nsPresContext* aPresContext,
64                            mozilla::WidgetGUIEvent* aEvent,
65                            nsEventStatus* aEventStatus) override;
66 
67   virtual nsresult HandleEvent(nsPresContext* aPresContext,
68                                mozilla::WidgetGUIEvent* aEvent,
69                                nsEventStatus* aEventStatus) override;
70 
71   virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
72                                 const nsDisplayListSet& aLists) override;
73 
74   virtual void GetInitialOrientation(bool& aIsHorizontal) override;
75 
76  private:
77   friend class nsSplitterFrameInner;
78   nsSplitterFrameInner* mInner;
79 
80 };  // class nsSplitterFrame
81 
82 #endif
83