1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_NATIVE_THEME_GTK2_H_
6 #define CHROME_BROWSER_UI_LIBGTK2UI_NATIVE_THEME_GTK2_H_
10 #include "chrome/browser/ui/libgtk2ui/owned_widget_gtk2.h"
11 #include "ui/native_theme/native_theme_base.h"
13 typedef struct _GdkColor GdkColor
;
17 // A version of NativeTheme that uses GTK2 supplied colours instead of the
18 // default aura colours. Analogue to NativeThemeWin, except that can't be
19 // compiled into the main chrome binary like the Windows code can.
20 class NativeThemeGtk2
: public ui::NativeThemeBase
{
22 static NativeThemeGtk2
* instance();
24 // Overridden from ui::NativeThemeBase:
25 gfx::Size
GetPartSize(Part part
,
27 const ExtraParams
& extra
) const override
;
28 void Paint(SkCanvas
* canvas
,
31 const gfx::Rect
& rect
,
32 const ExtraParams
& extra
) const override
;
33 SkColor
GetSystemColor(ColorId color_id
) const override
;
34 void PaintMenuPopupBackground(
36 const gfx::Size
& size
,
37 const MenuBackgroundExtraParams
& menu_background
) const override
;
38 void PaintMenuItemBackground(
41 const gfx::Rect
& rect
,
42 const MenuListExtraParams
& menu_list
) const override
;
46 ~NativeThemeGtk2() override
;
48 // Implementation of GetSystemColor.
49 GdkColor
GetSystemGdkColor(ColorId color_id
) const;
51 // Returns styles associated with various widget types.
52 GtkWidget
* GetRealizedWindow() const;
53 GtkStyle
* GetWindowStyle() const;
54 GtkStyle
* GetEntryStyle() const;
55 GtkStyle
* GetLabelStyle() const;
56 GtkStyle
* GetButtonStyle() const;
57 GtkStyle
* GetTreeStyle() const;
58 GtkStyle
* GetTooltipStyle() const;
59 GtkStyle
* GetMenuStyle() const;
60 GtkStyle
* GetMenuItemStyle() const;
62 void PaintComboboxArrow(SkCanvas
* canvas
,
64 const gfx::Rect
& rect
) const;
66 mutable GtkWidget
* fake_window_
;
67 mutable GtkWidget
* fake_tooltip_
;
68 mutable OwnedWidgetGtk fake_entry_
;
69 mutable OwnedWidgetGtk fake_label_
;
70 mutable OwnedWidgetGtk fake_button_
;
71 mutable OwnedWidgetGtk fake_tree_
;
73 mutable OwnedWidgetGtk fake_menu_
;
74 mutable GtkWidget
* fake_menu_item_
;
76 DISALLOW_COPY_AND_ASSIGN(NativeThemeGtk2
);
79 } // namespace libgtk2ui
81 #endif // CHROME_BROWSER_UI_LIBGTK2UI_NATIVE_THEME_GTK2_H_