Bug 1700051: part 34) Reduce accessibility of `mSoftText.mValue` to `private`. r...
[gecko.git] / widget / ScrollbarDrawingMac.h
blob0a6c0e9301884cde3dcc86bc167da523e374c918
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/. */
7 #ifndef mozilla_widget_ScrollbarDrawing_h
8 #define mozilla_widget_ScrollbarDrawing_h
10 #include "nsColor.h"
11 #include "nsITheme.h"
12 #include "Units.h"
13 #include "mozilla/Array.h"
15 namespace mozilla {
16 namespace gfx {
17 class DrawTarget;
20 namespace widget {
22 struct ScrollbarParams {
23 bool overlay = false;
24 bool rolledOver = false;
25 bool small = false;
26 bool horizontal = false;
27 bool rtl = false;
28 bool onDarkBackground = false;
29 bool custom = false;
30 // Two colors only used when custom is true.
31 nscolor trackColor = NS_RGBA(0, 0, 0, 0);
32 nscolor faceColor = NS_RGBA(0, 0, 0, 0);
35 class ScrollbarDrawingMac final {
36 public:
37 struct FillRect {
38 gfx::Rect mRect;
39 nscolor mColor;
42 static CSSIntCoord GetScrollbarSize(StyleScrollbarWidth, bool aOverlay);
44 static LayoutDeviceIntCoord GetScrollbarSize(StyleScrollbarWidth,
45 bool aOverlay, float aDpiRatio);
46 static LayoutDeviceIntSize GetMinimumWidgetSize(StyleAppearance aAppearance,
47 nsIFrame* aFrame,
48 float aDpiRatio);
49 static ScrollbarParams ComputeScrollbarParams(nsIFrame* aFrame,
50 const ComputedStyle& aStyle,
51 bool aIsHorizontal);
53 // The caller can draw this rectangle with rounded corners as appropriate.
54 struct ThumbRect {
55 gfx::Rect mRect;
56 nscolor mFillColor;
57 nscolor mStrokeColor;
58 float mStrokeWidth;
59 float mStrokeOutset;
62 static ThumbRect GetThumbRect(const gfx::Rect& aRect,
63 const ScrollbarParams& aParams, float aScale);
65 using ScrollbarTrackRects = Array<FillRect, 4>;
66 static bool GetScrollbarTrackRects(const gfx::Rect& aRect,
67 const ScrollbarParams& aParams,
68 float aScale, ScrollbarTrackRects&);
70 using ScrollCornerRects = Array<FillRect, 7>;
71 static bool GetScrollCornerRects(const gfx::Rect& aRect,
72 const ScrollbarParams& aParams, float aScale,
73 ScrollCornerRects&);
76 } // namespace widget
77 } // namespace mozilla
79 #endif