Chromium Code Reviews| 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/view.h" | 19 #include "ui/views/view.h" |
| 20 | 20 |
| 21 typedef unsigned int SkColor; | 21 typedef unsigned int SkColor; |
| 22 | 22 |
| 23 namespace gfx { | 23 namespace gfx { |
| 24 class ImageSkia; | 24 class ImageSkia; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace views { | 27 namespace views { |
| 28 class Label; | 28 class Label; |
| 29 class SmoothedThrobber; | |
| 29 } | 30 } |
| 30 | 31 |
| 31 namespace ash { | 32 namespace ash { |
| 32 namespace internal { | 33 namespace internal { |
| 33 | 34 |
| 34 class TrayItemView; | 35 class TrayItemView; |
| 35 | 36 |
| 36 // An image view with a specified width and height (kTrayPopupDetailsIconWidth). | 37 // An image view with a specified width and height (kTrayPopupDetailsIconWidth). |
| 37 // If the specified width or height is zero, then the image size is used for | 38 // If the specified width or height is zero, then the image size is used for |
| 38 // that dimension. | 39 // that dimension. |
| (...skipping 225 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 throbber with tooltip and animation for starting/stopping. | |
| 276 class ThrobberView : public views::View { | |
| 277 public: | |
| 278 ThrobberView(); | |
| 279 virtual ~ThrobberView(); | |
| 280 | |
| 281 // Overriden from views::View. | |
| 282 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
|
sadrul
2013/02/05 02:31:42
Overrides usually go after the non-overrides.
jennyz
2013/02/05 17:37:20
Done.
| |
| 283 virtual void Layout() OVERRIDE; | |
| 284 virtual bool GetTooltipText( | |
| 285 const gfx::Point& p, string16* tooltip) const OVERRIDE; | |
| 286 | |
| 287 void Start(); | |
| 288 void Stop(); | |
| 289 void SetTooltipText(const string16& tooltip_text); | |
| 290 | |
| 291 private: | |
| 292 // Schedules animation for starting/stopping throbber. | |
| 293 void ScheduleAnimation(bool start_throbber); | |
| 294 | |
| 295 views::SmoothedThrobber* throbber_; | |
| 296 | |
| 297 // The current tooltip text. | |
| 298 string16 tooltip_text_; | |
| 299 | |
| 300 DISALLOW_COPY_AND_ASSIGN(ThrobberView); | |
| 301 }; | |
| 302 | |
| 274 // The 'special' looking row in the uber-tray popups. This is usually the bottom | 303 // The 'special' looking row in the uber-tray popups. This is usually the bottom |
| 275 // row in the popups, and has a fixed height. | 304 // row in the popups, and has a fixed height. |
| 276 class SpecialPopupRow : public views::View { | 305 class SpecialPopupRow : public views::View { |
| 277 public: | 306 public: |
| 278 SpecialPopupRow(); | 307 SpecialPopupRow(); |
| 279 virtual ~SpecialPopupRow(); | 308 virtual ~SpecialPopupRow(); |
| 280 | 309 |
| 281 void SetTextLabel(int string_id, ViewClickListener* listener); | 310 void SetTextLabel(int string_id, ViewClickListener* listener); |
| 282 void SetContent(views::View* view); | 311 void SetContent(views::View* view); |
| 283 | 312 |
| 284 void AddButton(TrayPopupHeaderButton* button); | 313 void AddButton(TrayPopupHeaderButton* button); |
| 314 void AddThrobber(ThrobberView* throbber); | |
| 285 | 315 |
| 286 views::View* content() const { return content_; } | 316 views::View* content() const { return content_; } |
| 287 | 317 |
| 288 private: | 318 private: |
| 289 // Overridden from views::View. | 319 // Overridden from views::View. |
| 290 virtual gfx::Size GetPreferredSize() OVERRIDE; | 320 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 291 virtual void Layout() OVERRIDE; | 321 virtual void Layout() OVERRIDE; |
| 292 | 322 |
| 293 views::View* content_; | 323 views::View* content_; |
| 294 views::View* button_container_; | 324 views::View* button_container_; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 305 void SetTrayImageItemBorder(views::View* tray_view, ShelfAlignment alignment); | 335 void SetTrayImageItemBorder(views::View* tray_view, ShelfAlignment alignment); |
| 306 // Sets the empty border around a label tray item for adjusting the space | 336 // Sets the empty border around a label tray item for adjusting the space |
| 307 // around it. | 337 // around it. |
| 308 void SetTrayLabelItemBorder(TrayItemView* tray_view, | 338 void SetTrayLabelItemBorder(TrayItemView* tray_view, |
| 309 ShelfAlignment alignment); | 339 ShelfAlignment alignment); |
| 310 | 340 |
| 311 } // namespace internal | 341 } // namespace internal |
| 312 } // namespace ash | 342 } // namespace ash |
| 313 | 343 |
| 314 #endif // ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ | 344 #endif // ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ |
| OLD | NEW |