summaryrefslogtreecommitdiffstats
path: root/ui/gfx/native_theme_linux.h
diff options
context:
space:
mode:
Diffstat (limited to 'ui/gfx/native_theme_linux.h')
-rw-r--r--ui/gfx/native_theme_linux.h132
1 files changed, 19 insertions, 113 deletions
diff --git a/ui/gfx/native_theme_linux.h b/ui/gfx/native_theme_linux.h
index 5bd9a28..2b117c1 100644
--- a/ui/gfx/native_theme_linux.h
+++ b/ui/gfx/native_theme_linux.h
@@ -7,6 +7,7 @@
#include "base/basictypes.h"
#include "skia/ext/platform_canvas.h"
+#include "ui/gfx/native_theme.h"
namespace skia {
class PlatformCanvas;
@@ -17,110 +18,18 @@ class Rect;
class Size;
// Linux theming API.
-class NativeThemeLinux {
+class NativeThemeLinux : public NativeTheme {
public:
- // The part to be painted / sized.
- enum Part {
- kScrollbarDownArrow,
- kScrollbarLeftArrow,
- kScrollbarRightArrow,
- kScrollbarUpArrow,
- kScrollbarHorizontalThumb,
- kScrollbarVerticalThumb,
- kScrollbarHorizontalTrack,
- kScrollbarVerticalTrack,
- kCheckbox,
- kRadio,
- kPushButton,
- kTextField,
- kMenuList,
- kSliderTrack,
- kSliderThumb,
- kInnerSpinButton,
- kProgressBar,
- };
-
- // The state of the part.
- enum State {
- kDisabled,
- kHovered,
- kNormal,
- kPressed,
- };
-
- // Extra data needed to draw scrollbar track correctly.
- struct ScrollbarTrackExtraParams {
- int track_x;
- int track_y;
- int track_width;
- int track_height;
- };
-
- struct ButtonExtraParams {
- bool checked;
- bool indeterminate; // Whether the button state is indeterminate.
- bool is_default; // Whether the button is default button.
- bool has_border;
- SkColor background_color;
- };
-
- struct TextFieldExtraParams {
- bool is_text_area;
- bool is_listbox;
- SkColor background_color;
- };
-
- struct MenuListExtraParams {
- bool has_border;
- bool has_border_radius;
- int arrow_x;
- int arrow_y;
- SkColor background_color;
- };
-
- struct SliderExtraParams {
- bool vertical;
- bool in_drag;
- };
-
- struct InnerSpinButtonExtraParams {
- bool spin_up;
- bool read_only;
- };
-
- struct ProgressBarExtraParams {
- bool determinate;
- int value_rect_x;
- int value_rect_y;
- int value_rect_width;
- int value_rect_height;
- };
-
- union ExtraParams {
- ScrollbarTrackExtraParams scrollbar_track;
- ButtonExtraParams button;
- MenuListExtraParams menu_list;
- SliderExtraParams slider;
- TextFieldExtraParams text_field;
- InnerSpinButtonExtraParams inner_spin;
- ProgressBarExtraParams progress_bar;
- };
-
// Gets our singleton instance.
- static NativeThemeLinux* instance();
+ static const NativeThemeLinux* instance();
- // Return the size of the part.
+ // NativeTheme implementation:
virtual gfx::Size GetPartSize(Part part) const;
- // Paint the part to the canvas.
virtual void Paint(skia::PlatformCanvas* canvas,
Part part,
State state,
const gfx::Rect& rect,
- const ExtraParams& extra);
- // Supports theme specific colors.
- void SetScrollbarColors(unsigned inactive_color,
- unsigned active_color,
- unsigned track_color) const;
+ const ExtraParams& extra) const;
protected:
NativeThemeLinux();
@@ -131,72 +40,72 @@ class NativeThemeLinux {
skia::PlatformCanvas* gc,
const gfx::Rect& rect,
Part direction,
- State state);
+ State state) const;
// Paint the scrollbar track. Done before the thumb so that it can contain
// alpha.
virtual void PaintScrollbarTrack(skia::PlatformCanvas* canvas,
Part part,
State state,
const ScrollbarTrackExtraParams& extra_params,
- const gfx::Rect& rect);
+ const gfx::Rect& rect) const;
// Draw the scrollbar thumb over the track.
virtual void PaintScrollbarThumb(skia::PlatformCanvas* canvas,
Part part,
State state,
- const gfx::Rect& rect);
+ const gfx::Rect& rect) const;
// Draw the checkbox.
virtual void PaintCheckbox(skia::PlatformCanvas* canvas,
State state,
const gfx::Rect& rect,
- const ButtonExtraParams& button);
+ const ButtonExtraParams& button) const;
// Draw the radio.
virtual void PaintRadio(skia::PlatformCanvas* canvas,
State state,
const gfx::Rect& rect,
- const ButtonExtraParams& button);
+ const ButtonExtraParams& button) const;
// Draw the push button.
virtual void PaintButton(skia::PlatformCanvas* canvas,
State state,
const gfx::Rect& rect,
- const ButtonExtraParams& button);
+ const ButtonExtraParams& button) const;
// Draw the text field.
virtual void PaintTextField(skia::PlatformCanvas* canvas,
State state,
const gfx::Rect& rect,
- const TextFieldExtraParams& text);
+ const TextFieldExtraParams& text) const;
// Draw the menu list.
virtual void PaintMenuList(skia::PlatformCanvas* canvas,
State state,
const gfx::Rect& rect,
- const MenuListExtraParams& menu_list);
+ const MenuListExtraParams& menu_list) const;
// Draw the slider track.
virtual void PaintSliderTrack(skia::PlatformCanvas* canvas,
State state,
const gfx::Rect& rect,
- const SliderExtraParams& slider);
+ const SliderExtraParams& slider) const;
// Draw the slider thumb.
virtual void PaintSliderThumb(skia::PlatformCanvas* canvas,
State state,
const gfx::Rect& rect,
- const SliderExtraParams& slider);
+ const SliderExtraParams& slider) const;
// Draw the inner spin button.
virtual void PaintInnerSpinButton(skia::PlatformCanvas* canvas,
State state,
const gfx::Rect& rect,
- const InnerSpinButtonExtraParams& spin_button);
+ const InnerSpinButtonExtraParams& spin_button) const;
// Draw the progress bar.
virtual void PaintProgressBar(skia::PlatformCanvas* canvas,
State state,
const gfx::Rect& rect,
- const ProgressBarExtraParams& progress_bar);
+ const ProgressBarExtraParams& progress_bar) const;
protected:
bool IntersectsClipRectInt(skia::PlatformCanvas* canvas,
- int x, int y, int w, int h);
+ int x, int y, int w, int h) const;
void DrawBitmapInt(skia::PlatformCanvas* canvas, const SkBitmap& bitmap,
int src_x, int src_y, int src_w, int src_h,
- int dest_x, int dest_y, int dest_w, int dest_h);
+ int dest_x, int dest_y, int dest_w, int dest_h) const;
void DrawTiledImage(SkCanvas* canvas,
const SkBitmap& bitmap,
@@ -229,9 +138,6 @@ class NativeThemeLinux {
static unsigned int scrollbar_width_;
static unsigned int button_length_;
- static unsigned int thumb_inactive_color_;
- static unsigned int thumb_active_color_;
- static unsigned int track_color_;
DISALLOW_COPY_AND_ASSIGN(NativeThemeLinux);
};