OLD | NEW |
1 // Copyright (c) 2012 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 ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ | 5 #ifndef ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ |
6 #define ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ | 6 #define ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/wm/shelf_types.h" | 9 #include "ash/wm/shelf_types.h" |
10 #include "ui/gfx/font.h" | 10 #include "ui/gfx/font.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 protected: | 68 protected: |
69 void DrawBorder(gfx::Canvas* canvas, const gfx::Rect& bounds); | 69 void DrawBorder(gfx::Canvas* canvas, const gfx::Rect& bounds); |
70 | 70 |
71 // Performs an action when user clicks on the view (on mouse-press event), or | 71 // Performs an action when user clicks on the view (on mouse-press event), or |
72 // presses a key when this view is in focus. Returns true if the event has | 72 // presses a key when this view is in focus. Returns true if the event has |
73 // been handled and an action was performed. Returns false otherwise. | 73 // been handled and an action was performed. Returns false otherwise. |
74 virtual bool PerformAction(const ui::Event& event) = 0; | 74 virtual bool PerformAction(const ui::Event& event) = 0; |
75 | 75 |
76 // Overridden from views::View. | 76 // Overridden from views::View. |
77 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 77 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
78 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | 78 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
79 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; | 79 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
80 virtual void OnMouseCaptureLost() OVERRIDE; | 80 virtual void OnMouseCaptureLost() OVERRIDE; |
81 virtual ui::GestureStatus OnGestureEvent( | 81 virtual ui::GestureStatus OnGestureEvent( |
82 const views::GestureEvent& event) OVERRIDE; | 82 const views::GestureEvent& event) OVERRIDE; |
83 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 83 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
84 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; | 84 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; |
85 | 85 |
86 private: | 86 private: |
87 string16 accessible_name_; | 87 string16 accessible_name_; |
88 bool has_capture_; | 88 bool has_capture_; |
89 | 89 |
(...skipping 29 matching lines...) Expand all Loading... |
119 void set_text_highlight_color(SkColor c) { text_highlight_color_ = c; } | 119 void set_text_highlight_color(SkColor c) { text_highlight_color_ = c; } |
120 void set_text_default_color(SkColor color) { text_default_color_ = color; } | 120 void set_text_default_color(SkColor color) { text_default_color_ = color; } |
121 void set_fixed_height(int height) { fixed_height_ = height; } | 121 void set_fixed_height(int height) { fixed_height_ = height; } |
122 | 122 |
123 private: | 123 private: |
124 // Overridden from ActionableView. | 124 // Overridden from ActionableView. |
125 virtual bool PerformAction(const ui::Event& event) OVERRIDE; | 125 virtual bool PerformAction(const ui::Event& event) OVERRIDE; |
126 | 126 |
127 // Overridden from views::View. | 127 // Overridden from views::View. |
128 virtual gfx::Size GetPreferredSize() OVERRIDE; | 128 virtual gfx::Size GetPreferredSize() OVERRIDE; |
129 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; | 129 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; |
130 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; | 130 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
131 virtual void OnEnabledChanged() OVERRIDE; | 131 virtual void OnEnabledChanged() OVERRIDE; |
132 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; | 132 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; |
133 virtual void OnFocus() OVERRIDE; | 133 virtual void OnFocus() OVERRIDE; |
134 | 134 |
135 ViewClickListener* listener_; | 135 ViewClickListener* listener_; |
136 views::Label* text_label_; | 136 views::Label* text_label_; |
137 SkColor highlight_color_; | 137 SkColor highlight_color_; |
138 SkColor default_color_; | 138 SkColor default_color_; |
139 SkColor text_highlight_color_; | 139 SkColor text_highlight_color_; |
140 SkColor text_default_color_; | 140 SkColor text_default_color_; |
141 int fixed_height_; | 141 int fixed_height_; |
142 bool hover_; | 142 bool hover_; |
143 | 143 |
144 DISALLOW_COPY_AND_ASSIGN(HoverHighlightView); | 144 DISALLOW_COPY_AND_ASSIGN(HoverHighlightView); |
145 }; | 145 }; |
146 | 146 |
147 // A custom scroll-view that has a specified dimension. | 147 // A custom scroll-view that has a specified dimension. |
148 class FixedSizedScrollView : public views::ScrollView { | 148 class FixedSizedScrollView : public views::ScrollView { |
149 public: | 149 public: |
150 FixedSizedScrollView(); | 150 FixedSizedScrollView(); |
151 | 151 |
152 virtual ~FixedSizedScrollView(); | 152 virtual ~FixedSizedScrollView(); |
153 | 153 |
154 void SetContentsView(View* view); | 154 void SetContentsView(View* view); |
155 void SetFixedSize(gfx::Size size); | 155 void SetFixedSize(gfx::Size size); |
156 | 156 |
157 // views::View public method overrides. | 157 // views::View public method overrides. |
158 virtual gfx::Size GetPreferredSize() OVERRIDE; | 158 virtual gfx::Size GetPreferredSize() OVERRIDE; |
159 virtual void Layout() OVERRIDE; | 159 virtual void Layout() OVERRIDE; |
160 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; | 160 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; |
161 | 161 |
162 protected: | 162 protected: |
163 // views::View protected method overrides. | 163 // views::View protected method overrides. |
164 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; | 164 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; |
165 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; | 165 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; |
166 | 166 |
167 private: | 167 private: |
168 gfx::Size fixed_size_; | 168 gfx::Size fixed_size_; |
169 | 169 |
170 DISALLOW_COPY_AND_ASSIGN(FixedSizedScrollView); | 170 DISALLOW_COPY_AND_ASSIGN(FixedSizedScrollView); |
171 }; | 171 }; |
172 | 172 |
173 // A custom textbutton with some extra vertical padding, and custom border, | 173 // A custom textbutton with some extra vertical padding, and custom border, |
174 // alignment and hover-effects. | 174 // alignment and hover-effects. |
175 class TrayPopupTextButton : public views::TextButton { | 175 class TrayPopupTextButton : public views::TextButton { |
176 public: | 176 public: |
177 TrayPopupTextButton(views::ButtonListener* listener, const string16& text); | 177 TrayPopupTextButton(views::ButtonListener* listener, const string16& text); |
178 virtual ~TrayPopupTextButton(); | 178 virtual ~TrayPopupTextButton(); |
179 | 179 |
180 private: | 180 private: |
181 // Overridden from views::View. | 181 // Overridden from views::View. |
182 virtual gfx::Size GetPreferredSize() OVERRIDE; | 182 virtual gfx::Size GetPreferredSize() OVERRIDE; |
183 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; | 183 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; |
184 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; | 184 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
185 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; | 185 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; |
186 virtual void OnPaintBorder(gfx::Canvas* canvas) OVERRIDE; | 186 virtual void OnPaintBorder(gfx::Canvas* canvas) OVERRIDE; |
187 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; | 187 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; |
188 | 188 |
189 bool hover_; | 189 bool hover_; |
190 scoped_ptr<views::Background> hover_bg_; | 190 scoped_ptr<views::Background> hover_bg_; |
191 scoped_ptr<views::Border> hover_border_; | 191 scoped_ptr<views::Border> hover_border_; |
192 | 192 |
193 DISALLOW_COPY_AND_ASSIGN(TrayPopupTextButton); | 193 DISALLOW_COPY_AND_ASSIGN(TrayPopupTextButton); |
194 }; | 194 }; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 void SetTrayImageItemBorder(views::View* tray_view, ShelfAlignment alignment); | 295 void SetTrayImageItemBorder(views::View* tray_view, ShelfAlignment alignment); |
296 // Sets the empty border around a label tray item for adjusting the space | 296 // Sets the empty border around a label tray item for adjusting the space |
297 // around it. | 297 // around it. |
298 void SetTrayLabelItemBorder(TrayItemView* tray_view, | 298 void SetTrayLabelItemBorder(TrayItemView* tray_view, |
299 ShelfAlignment alignment); | 299 ShelfAlignment alignment); |
300 | 300 |
301 } // namespace internal | 301 } // namespace internal |
302 } // namespace ash | 302 } // namespace ash |
303 | 303 |
304 #endif // ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ | 304 #endif // ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ |
OLD | NEW |