layout/forms/nsButtonFrameRenderer.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef nsButtonFrameRenderer_h___
michael@0 7 #define nsButtonFrameRenderer_h___
michael@0 8
michael@0 9 #include "nsAutoPtr.h"
michael@0 10 #include "nsMargin.h"
michael@0 11
michael@0 12 class nsIFrame;
michael@0 13 class nsFrame;
michael@0 14 class nsDisplayList;
michael@0 15 class nsDisplayListBuilder;
michael@0 16 class nsPresContext;
michael@0 17 class nsRenderingContext;
michael@0 18 class nsRect;
michael@0 19 class nsStyleContext;
michael@0 20
michael@0 21
michael@0 22 #define NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX 0
michael@0 23 #define NS_BUTTON_RENDERER_FOCUS_OUTER_CONTEXT_INDEX 1
michael@0 24 #define NS_BUTTON_RENDERER_LAST_CONTEXT_INDEX NS_BUTTON_RENDERER_FOCUS_OUTER_CONTEXT_INDEX
michael@0 25
michael@0 26 class nsButtonFrameRenderer {
michael@0 27 public:
michael@0 28
michael@0 29 nsButtonFrameRenderer();
michael@0 30 ~nsButtonFrameRenderer();
michael@0 31
michael@0 32 /**
michael@0 33 * Create display list items for the button
michael@0 34 */
michael@0 35 nsresult DisplayButton(nsDisplayListBuilder* aBuilder,
michael@0 36 nsDisplayList* aBackground, nsDisplayList* aForeground);
michael@0 37
michael@0 38
michael@0 39 void PaintOutlineAndFocusBorders(nsPresContext* aPresContext,
michael@0 40 nsRenderingContext& aRenderingContext,
michael@0 41 const nsRect& aDirtyRect,
michael@0 42 const nsRect& aRect);
michael@0 43
michael@0 44 void PaintBorderAndBackground(nsPresContext* aPresContext,
michael@0 45 nsRenderingContext& aRenderingContext,
michael@0 46 const nsRect& aDirtyRect,
michael@0 47 const nsRect& aRect,
michael@0 48 uint32_t aBGFlags);
michael@0 49
michael@0 50 void SetFrame(nsFrame* aFrame, nsPresContext* aPresContext);
michael@0 51
michael@0 52 void SetDisabled(bool aDisabled, bool notify);
michael@0 53
michael@0 54 bool isActive();
michael@0 55 bool isDisabled();
michael@0 56
michael@0 57 void GetButtonOuterFocusRect(const nsRect& aRect, nsRect& aResult);
michael@0 58 void GetButtonRect(const nsRect& aRect, nsRect& aResult);
michael@0 59 void GetButtonInnerFocusRect(const nsRect& aRect, nsRect& aResult);
michael@0 60 nsMargin GetButtonOuterFocusBorderAndPadding();
michael@0 61 nsMargin GetButtonBorderAndPadding();
michael@0 62 nsMargin GetButtonInnerFocusMargin();
michael@0 63 nsMargin GetButtonInnerFocusBorderAndPadding();
michael@0 64 nsMargin GetAddedButtonBorderAndPadding();
michael@0 65
michael@0 66 nsStyleContext* GetStyleContext(int32_t aIndex) const;
michael@0 67 void SetStyleContext(int32_t aIndex, nsStyleContext* aStyleContext);
michael@0 68 void ReResolveStyles(nsPresContext* aPresContext);
michael@0 69
michael@0 70 nsIFrame* GetFrame();
michael@0 71
michael@0 72 protected:
michael@0 73
michael@0 74 private:
michael@0 75
michael@0 76 // cached styles for focus and outline.
michael@0 77 nsRefPtr<nsStyleContext> mBorderStyle;
michael@0 78 nsRefPtr<nsStyleContext> mInnerFocusStyle;
michael@0 79 nsRefPtr<nsStyleContext> mOuterFocusStyle;
michael@0 80
michael@0 81 nsFrame* mFrame;
michael@0 82 };
michael@0 83
michael@0 84
michael@0 85 #endif
michael@0 86

mercurial