widget/gtk/nsNativeThemeGTK.h

branch
TOR_BUG_9701
changeset 10
ac0c01689b40
equal deleted inserted replaced
-1:000000000000 0:4a600827a378
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
6 #include "nsITheme.h"
7 #include "nsCOMPtr.h"
8 #include "nsIAtom.h"
9 #include "nsIObserver.h"
10 #include "nsNativeTheme.h"
11
12 #include <gtk/gtk.h>
13 #include "gtkdrawing.h"
14
15 class nsNativeThemeGTK: private nsNativeTheme,
16 public nsITheme,
17 public nsIObserver {
18 public:
19 NS_DECL_ISUPPORTS_INHERITED
20
21 NS_DECL_NSIOBSERVER
22
23 // The nsITheme interface.
24 NS_IMETHOD DrawWidgetBackground(nsRenderingContext* aContext,
25 nsIFrame* aFrame, uint8_t aWidgetType,
26 const nsRect& aRect,
27 const nsRect& aDirtyRect);
28
29 NS_IMETHOD GetWidgetBorder(nsDeviceContext* aContext, nsIFrame* aFrame,
30 uint8_t aWidgetType, nsIntMargin* aResult);
31
32 virtual NS_HIDDEN_(bool) GetWidgetPadding(nsDeviceContext* aContext,
33 nsIFrame* aFrame,
34 uint8_t aWidgetType,
35 nsIntMargin* aResult);
36
37 virtual NS_HIDDEN_(bool) GetWidgetOverflow(nsDeviceContext* aContext,
38 nsIFrame* aFrame,
39 uint8_t aWidgetType,
40 nsRect* aOverflowRect);
41
42 NS_IMETHOD GetMinimumWidgetSize(nsRenderingContext* aContext,
43 nsIFrame* aFrame, uint8_t aWidgetType,
44 nsIntSize* aResult, bool* aIsOverridable);
45
46 NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType,
47 nsIAtom* aAttribute, bool* aShouldRepaint);
48
49 NS_IMETHOD ThemeChanged();
50
51 NS_IMETHOD_(bool) ThemeSupportsWidget(nsPresContext* aPresContext,
52 nsIFrame* aFrame,
53 uint8_t aWidgetType);
54
55 NS_IMETHOD_(bool) WidgetIsContainer(uint8_t aWidgetType);
56
57 NS_IMETHOD_(bool) ThemeDrawsFocusForWidget(uint8_t aWidgetType) MOZ_OVERRIDE;
58
59 bool ThemeNeedsComboboxDropmarker();
60
61 virtual Transparency GetWidgetTransparency(nsIFrame* aFrame,
62 uint8_t aWidgetType);
63
64 nsNativeThemeGTK();
65 virtual ~nsNativeThemeGTK();
66
67 private:
68 gint GetTabMarginPixels(nsIFrame* aFrame);
69 bool GetGtkWidgetAndState(uint8_t aWidgetType, nsIFrame* aFrame,
70 GtkThemeWidgetType& aGtkWidgetType,
71 GtkWidgetState* aState, gint* aWidgetFlags);
72 bool GetExtraSizeForWidget(nsIFrame* aFrame, uint8_t aWidgetType,
73 nsIntMargin* aExtra);
74
75 void RefreshWidgetWindow(nsIFrame* aFrame);
76
77 uint8_t mDisabledWidgetTypes[32];
78 uint8_t mSafeWidgetStates[1024]; // 256 widgets * 32 bits per widget
79 static const char* sDisabledEngines[];
80 };

mercurial