Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
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/. */
6 #ifndef nsButtonFrameRenderer_h___
7 #define nsButtonFrameRenderer_h___
9 #include "nsAutoPtr.h"
10 #include "nsMargin.h"
12 class nsIFrame;
13 class nsFrame;
14 class nsDisplayList;
15 class nsDisplayListBuilder;
16 class nsPresContext;
17 class nsRenderingContext;
18 class nsRect;
19 class nsStyleContext;
22 #define NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX 0
23 #define NS_BUTTON_RENDERER_FOCUS_OUTER_CONTEXT_INDEX 1
24 #define NS_BUTTON_RENDERER_LAST_CONTEXT_INDEX NS_BUTTON_RENDERER_FOCUS_OUTER_CONTEXT_INDEX
26 class nsButtonFrameRenderer {
27 public:
29 nsButtonFrameRenderer();
30 ~nsButtonFrameRenderer();
32 /**
33 * Create display list items for the button
34 */
35 nsresult DisplayButton(nsDisplayListBuilder* aBuilder,
36 nsDisplayList* aBackground, nsDisplayList* aForeground);
39 void PaintOutlineAndFocusBorders(nsPresContext* aPresContext,
40 nsRenderingContext& aRenderingContext,
41 const nsRect& aDirtyRect,
42 const nsRect& aRect);
44 void PaintBorderAndBackground(nsPresContext* aPresContext,
45 nsRenderingContext& aRenderingContext,
46 const nsRect& aDirtyRect,
47 const nsRect& aRect,
48 uint32_t aBGFlags);
50 void SetFrame(nsFrame* aFrame, nsPresContext* aPresContext);
52 void SetDisabled(bool aDisabled, bool notify);
54 bool isActive();
55 bool isDisabled();
57 void GetButtonOuterFocusRect(const nsRect& aRect, nsRect& aResult);
58 void GetButtonRect(const nsRect& aRect, nsRect& aResult);
59 void GetButtonInnerFocusRect(const nsRect& aRect, nsRect& aResult);
60 nsMargin GetButtonOuterFocusBorderAndPadding();
61 nsMargin GetButtonBorderAndPadding();
62 nsMargin GetButtonInnerFocusMargin();
63 nsMargin GetButtonInnerFocusBorderAndPadding();
64 nsMargin GetAddedButtonBorderAndPadding();
66 nsStyleContext* GetStyleContext(int32_t aIndex) const;
67 void SetStyleContext(int32_t aIndex, nsStyleContext* aStyleContext);
68 void ReResolveStyles(nsPresContext* aPresContext);
70 nsIFrame* GetFrame();
72 protected:
74 private:
76 // cached styles for focus and outline.
77 nsRefPtr<nsStyleContext> mBorderStyle;
78 nsRefPtr<nsStyleContext> mInnerFocusStyle;
79 nsRefPtr<nsStyleContext> mOuterFocusStyle;
81 nsFrame* mFrame;
82 };
85 #endif