| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 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 CHROME_BROWSER_CHROMEOS_CLOCK_MENU_BUTTON_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_CLOCK_MENU_BUTTON_H_ |
| 7 |
| 8 #include "base/timer.h" |
| 9 #include "views/controls/button/menu_button.h" |
| 10 #include "views/controls/menu/menu_2.h" |
| 11 #include "views/controls/menu/view_menu_delegate.h" |
| 12 |
| 13 // The clock menu button in the status area. |
| 14 // This button shows the current time. |
| 15 class ClockMenuButton : public views::MenuButton, |
| 16 public views::ViewMenuDelegate, |
| 17 public views::Menu2Model { |
| 18 public: |
| 19 ClockMenuButton(); |
| 20 virtual ~ClockMenuButton() {} |
| 21 |
| 22 // views::Menu2Model implementation. |
| 23 virtual bool HasIcons() const { return false; } |
| 24 virtual int GetItemCount() const; |
| 25 virtual views::Menu2Model::ItemType GetTypeAt(int index) const; |
| 26 virtual int GetCommandIdAt(int index) const { return index; } |
| 27 virtual string16 GetLabelAt(int index) const; |
| 28 virtual bool IsLabelDynamicAt(int index) const { return true; } |
| 29 virtual bool GetAcceleratorAt(int index, |
| 30 views::Accelerator* accelerator) const { return false; } |
| 31 virtual bool IsItemCheckedAt(int index) const { return false; } |
| 32 virtual int GetGroupIdAt(int index) const { return 0; } |
| 33 virtual bool GetIconAt(int index, SkBitmap* icon) const { return false; } |
| 34 virtual bool IsEnabledAt(int index) const { return false; } |
| 35 virtual Menu2Model* GetSubmenuModelAt(int index) const { return NULL; } |
| 36 virtual void HighlightChangedTo(int index) {} |
| 37 virtual void ActivatedAt(int index) {} |
| 38 virtual void MenuWillShow() {} |
| 39 |
| 40 private: |
| 41 // views::ViewMenuDelegate implementation. |
| 42 virtual void RunMenu(views::View* source, const gfx::Point& pt, |
| 43 gfx::NativeView hwnd); |
| 44 |
| 45 // Schedules the timer to fire at the next minute interval. |
| 46 void SetNextTimer(); |
| 47 |
| 48 // Updates the time on the menu button and sets the next timer. |
| 49 void UpdateText(); |
| 50 |
| 51 base::OneShotTimer<ClockMenuButton> timer_; |
| 52 |
| 53 // The clock menu. |
| 54 views::Menu2 clock_menu_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(ClockMenuButton); |
| 57 }; |
| 58 |
| 59 #endif // CHROME_BROWSER_CHROMEOS_CLOCK_MENU_BUTTON_H_ |
| OLD | NEW |