OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_BITMAP_SCROLL_BAR_H_ | 5 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_BITMAP_SCROLL_BAR_H_ |
6 #define UI_VIEWS_CONTROLS_SCROLLBAR_BITMAP_SCROLL_BAR_H_ | 6 #define UI_VIEWS_CONTROLS_SCROLLBAR_BITMAP_SCROLL_BAR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ui/views/controls/scrollbar/base_scroll_bar.h" | 9 #include "ui/views/controls/scrollbar/base_scroll_bar.h" |
10 | 10 |
11 namespace views { | 11 namespace views { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 THUMB_MIDDLE, | 44 THUMB_MIDDLE, |
45 // The bottom/right segment of the thumb on the scrollbar. | 45 // The bottom/right segment of the thumb on the scrollbar. |
46 THUMB_END_CAP, | 46 THUMB_END_CAP, |
47 // The grippy that is rendered in the center of the thumb. | 47 // The grippy that is rendered in the center of the thumb. |
48 THUMB_GRIPPY, | 48 THUMB_GRIPPY, |
49 // The tiled background image of the thumb track. | 49 // The tiled background image of the thumb track. |
50 THUMB_TRACK, | 50 THUMB_TRACK, |
51 PART_COUNT | 51 PART_COUNT |
52 }; | 52 }; |
53 | 53 |
54 // Sets the bitmap to be rendered for the specified part and state. | 54 // Sets the image to be rendered for the specified part and state. |
55 void SetImage(ScrollBarPart part, | 55 void SetImage(ScrollBarPart part, |
56 CustomButton::ButtonState state, | 56 CustomButton::ButtonState state, |
57 SkBitmap* bitmap); | 57 gfx::ImageSkia* image_skia); |
58 | 58 |
59 | 59 |
60 gfx::Rect GetTrackBounds() const; | 60 gfx::Rect GetTrackBounds() const; |
61 | 61 |
62 protected: | 62 protected: |
63 // View overrides: | 63 // View overrides: |
64 virtual gfx::Size GetPreferredSize() OVERRIDE; | 64 virtual gfx::Size GetPreferredSize() OVERRIDE; |
65 virtual void Layout() OVERRIDE; | 65 virtual void Layout() OVERRIDE; |
66 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 66 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
67 | 67 |
68 // ScrollBar overrides: | 68 // ScrollBar overrides: |
69 virtual int GetLayoutSize() const OVERRIDE; | 69 virtual int GetLayoutSize() const OVERRIDE; |
70 | 70 |
71 // BaseButton::ButtonListener overrides: | 71 // BaseButton::ButtonListener overrides: |
72 virtual void ButtonPressed(Button* sender, | 72 virtual void ButtonPressed(Button* sender, |
73 const views::Event& event) OVERRIDE; | 73 const views::Event& event) OVERRIDE; |
74 | 74 |
75 private: | 75 private: |
76 // Up/Down/Left/Right buttons. | 76 // Up/Down/Left/Right buttons. |
77 ImageButton* prev_button_; | 77 ImageButton* prev_button_; |
78 ImageButton* next_button_; | 78 ImageButton* next_button_; |
79 | 79 |
80 // The thumb needs to be able to access the part images. | 80 // The thumb needs to be able to access the part images. |
81 friend BitmapScrollBarThumb; | 81 friend BitmapScrollBarThumb; |
82 SkBitmap* images_[PART_COUNT][CustomButton::BS_COUNT]; | 82 gfx::ImageSkia* images_[PART_COUNT][CustomButton::BS_COUNT]; |
83 | 83 |
84 // True if the scroll buttons at each end of the scroll bar should be shown. | 84 // True if the scroll buttons at each end of the scroll bar should be shown. |
85 bool show_scroll_buttons_; | 85 bool show_scroll_buttons_; |
86 | 86 |
87 DISALLOW_COPY_AND_ASSIGN(BitmapScrollBar); | 87 DISALLOW_COPY_AND_ASSIGN(BitmapScrollBar); |
88 }; | 88 }; |
89 | 89 |
90 } // namespace views | 90 } // namespace views |
91 | 91 |
92 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_BITMAP_SCROLL_BAR_H_ | 92 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_BITMAP_SCROLL_BAR_H_ |
OLD | NEW |