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 3 // found in the LICENSE file. 4 5 #ifndef ASH_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ 6 #define ASH_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ 7 8 #include "ash/system/tray/actionable_view.h" 9 #include "ui/views/view.h" 10 11 namespace views { 12 class ImageView; 13 class Label; 14 class View; 15 } 16 17 namespace ash { 18 19 class SystemTrayItem; 20 21 namespace internal { 22 23 // A view with a chevron ('>') on the right edge. Clicking on the view brings up 24 // the detailed view of the tray-item that owns it. 25 class TrayItemMore : public ActionableView { 26 public: 27 TrayItemMore(SystemTrayItem* owner, bool show_more); 28 virtual ~TrayItemMore(); 29 owner()30 SystemTrayItem* owner() const { return owner_; } 31 32 void SetLabel(const base::string16& label); 33 void SetImage(const gfx::ImageSkia* image_skia); 34 void SetAccessibleName(const base::string16& name); 35 36 protected: 37 // Replaces the default icon (on the left of the label), and allows a custom 38 // view to be placed there. Once the default icon is replaced, |SetImage| 39 // should never be called. 40 void ReplaceIcon(views::View* view); 41 42 private: 43 // Overridden from ActionableView. 44 virtual bool PerformAction(const ui::Event& event) OVERRIDE; 45 46 // Overridden from views::View. 47 virtual void Layout() OVERRIDE; 48 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; 49 50 SystemTrayItem* owner_; 51 // True if |more_| should be shown. 52 bool show_more_; 53 views::ImageView* icon_; 54 views::Label* label_; 55 views::ImageView* more_; 56 base::string16 accessible_name_; 57 58 DISALLOW_COPY_AND_ASSIGN(TrayItemMore); 59 }; 60 61 } // namespace internal 62 } // namespace ash 63 64 #endif // ASH_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ 65