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/shelf_types.h" | 9 #include "ash/shelf_types.h" |
10 #include "ui/gfx/font.h" | 10 #include "ui/gfx/font.h" |
11 #include "ui/gfx/size.h" | 11 #include "ui/gfx/size.h" |
12 #include "ui/views/controls/button/custom_button.h" | 12 #include "ui/views/controls/button/custom_button.h" |
13 #include "ui/views/controls/button/image_button.h" | 13 #include "ui/views/controls/button/image_button.h" |
14 #include "ui/views/controls/button/label_button.h" | 14 #include "ui/views/controls/button/label_button.h" |
15 #include "ui/views/controls/button/label_button_border.h" | 15 #include "ui/views/controls/button/label_button_border.h" |
16 #include "ui/views/controls/image_view.h" | 16 #include "ui/views/controls/image_view.h" |
17 #include "ui/views/controls/scroll_view.h" | 17 #include "ui/views/controls/scroll_view.h" |
18 #include "ui/views/controls/slider.h" | 18 #include "ui/views/controls/slider.h" |
| 19 #include "ui/views/controls/throbber.h" |
19 #include "ui/views/view.h" | 20 #include "ui/views/view.h" |
20 | 21 |
21 typedef unsigned int SkColor; | 22 typedef unsigned int SkColor; |
22 | 23 |
23 namespace gfx { | 24 namespace gfx { |
24 class ImageSkia; | 25 class ImageSkia; |
25 } | 26 } |
26 | 27 |
27 namespace views { | 28 namespace views { |
28 class Label; | 29 class Label; |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 class TrayBarButton; | 265 class TrayBarButton; |
265 | 266 |
266 TrayBarButton* image_; | 267 TrayBarButton* image_; |
267 views::Label* title_; | 268 views::Label* title_; |
268 int width_; | 269 int width_; |
269 int image_height_; | 270 int image_height_; |
270 | 271 |
271 DISALLOW_COPY_AND_ASSIGN(TrayBarButtonWithTitle); | 272 DISALLOW_COPY_AND_ASSIGN(TrayBarButtonWithTitle); |
272 }; | 273 }; |
273 | 274 |
| 275 // A SmoothedThrobber with tooltip. |
| 276 class SystemTrayThrobber : public views::SmoothedThrobber { |
| 277 public: |
| 278 SystemTrayThrobber(int frame_delay_ms); |
| 279 virtual ~SystemTrayThrobber(); |
| 280 |
| 281 void SetTooltipText(const string16& tooltip_text); |
| 282 |
| 283 // Overriden from views::View. |
| 284 virtual bool GetTooltipText( |
| 285 const gfx::Point& p, string16* tooltip) const OVERRIDE; |
| 286 |
| 287 private: |
| 288 // The current tooltip text. |
| 289 string16 tooltip_text_; |
| 290 |
| 291 DISALLOW_COPY_AND_ASSIGN(SystemTrayThrobber); |
| 292 }; |
| 293 |
| 294 // A View containing a SystemTrayThrobber with animation for starting/stopping. |
| 295 class ThrobberView : public views::View { |
| 296 public: |
| 297 ThrobberView(); |
| 298 virtual ~ThrobberView(); |
| 299 |
| 300 void Start(); |
| 301 void Stop(); |
| 302 void SetTooltipText(const string16& tooltip_text); |
| 303 |
| 304 // Overriden from views::View. |
| 305 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 306 virtual void Layout() OVERRIDE; |
| 307 virtual bool GetTooltipText( |
| 308 const gfx::Point& p, string16* tooltip) const OVERRIDE; |
| 309 |
| 310 private: |
| 311 // Schedules animation for starting/stopping throbber. |
| 312 void ScheduleAnimation(bool start_throbber); |
| 313 |
| 314 SystemTrayThrobber* throbber_; |
| 315 |
| 316 // The current tooltip text. |
| 317 string16 tooltip_text_; |
| 318 |
| 319 DISALLOW_COPY_AND_ASSIGN(ThrobberView); |
| 320 }; |
| 321 |
274 // The 'special' looking row in the uber-tray popups. This is usually the bottom | 322 // The 'special' looking row in the uber-tray popups. This is usually the bottom |
275 // row in the popups, and has a fixed height. | 323 // row in the popups, and has a fixed height. |
276 class SpecialPopupRow : public views::View { | 324 class SpecialPopupRow : public views::View { |
277 public: | 325 public: |
278 SpecialPopupRow(); | 326 SpecialPopupRow(); |
279 virtual ~SpecialPopupRow(); | 327 virtual ~SpecialPopupRow(); |
280 | 328 |
281 void SetTextLabel(int string_id, ViewClickListener* listener); | 329 void SetTextLabel(int string_id, ViewClickListener* listener); |
282 void SetContent(views::View* view); | 330 void SetContent(views::View* view); |
283 | 331 |
284 void AddButton(TrayPopupHeaderButton* button); | 332 void AddButton(TrayPopupHeaderButton* button); |
| 333 void AddThrobber(ThrobberView* throbber); |
285 | 334 |
286 views::View* content() const { return content_; } | 335 views::View* content() const { return content_; } |
287 | 336 |
288 private: | 337 private: |
289 // Overridden from views::View. | 338 // Overridden from views::View. |
290 virtual gfx::Size GetPreferredSize() OVERRIDE; | 339 virtual gfx::Size GetPreferredSize() OVERRIDE; |
291 virtual void Layout() OVERRIDE; | 340 virtual void Layout() OVERRIDE; |
292 | 341 |
293 views::View* content_; | 342 views::View* content_; |
294 views::View* button_container_; | 343 views::View* button_container_; |
(...skipping 10 matching lines...) Expand all Loading... |
305 void SetTrayImageItemBorder(views::View* tray_view, ShelfAlignment alignment); | 354 void SetTrayImageItemBorder(views::View* tray_view, ShelfAlignment alignment); |
306 // Sets the empty border around a label tray item for adjusting the space | 355 // Sets the empty border around a label tray item for adjusting the space |
307 // around it. | 356 // around it. |
308 void SetTrayLabelItemBorder(TrayItemView* tray_view, | 357 void SetTrayLabelItemBorder(TrayItemView* tray_view, |
309 ShelfAlignment alignment); | 358 ShelfAlignment alignment); |
310 | 359 |
311 } // namespace internal | 360 } // namespace internal |
312 } // namespace ash | 361 } // namespace ash |
313 | 362 |
314 #endif // ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ | 363 #endif // ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ |
OLD | NEW |