| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 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_STATUS_FEEDBACK_MENU_BUTTON_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_STATUS_FEEDBACK_MENU_BUTTON_H_ | |
| 7 | |
| 8 #include "app/menus/simple_menu_model.h" | |
| 9 #include "chrome/browser/chromeos/status/status_area_button.h" | |
| 10 #include "views/controls/menu/menu_2.h" | |
| 11 #include "views/controls/menu/view_menu_delegate.h" | |
| 12 | |
| 13 class SkBitmap; | |
| 14 | |
| 15 namespace chromeos { | |
| 16 | |
| 17 class StatusAreaHost; | |
| 18 | |
| 19 // The language menu button in the status area. | |
| 20 // This class will handle getting the IME/XKB status and populating the menu. | |
| 21 class FeedbackMenuButton : public StatusAreaButton, | |
| 22 public views::ViewMenuDelegate, | |
| 23 public menus::MenuModel { | |
| 24 public: | |
| 25 explicit FeedbackMenuButton(StatusAreaHost* host); | |
| 26 virtual ~FeedbackMenuButton(); | |
| 27 | |
| 28 private: | |
| 29 // StatusAreaButton implementation. | |
| 30 virtual void DrawPressed(gfx::Canvas* canvas); | |
| 31 virtual void DrawIcon(gfx::Canvas* canvas); | |
| 32 | |
| 33 // views::ViewMenuDelegate implementation. | |
| 34 virtual void RunMenu(views::View* source, const gfx::Point& pt); | |
| 35 | |
| 36 // menus::MenuModel implementation. | |
| 37 virtual int GetItemCount() const { return 0; } | |
| 38 virtual bool HasIcons() const { return false; } | |
| 39 virtual menus::MenuModel::ItemType GetTypeAt(int index) const { | |
| 40 return menus::MenuModel::TYPE_COMMAND; | |
| 41 } | |
| 42 virtual int GetCommandIdAt(int index) const { return index; } | |
| 43 virtual string16 GetLabelAt(int index) const { return string16(); } | |
| 44 virtual bool IsLabelDynamicAt(int index) const { return true; } | |
| 45 virtual bool GetAcceleratorAt(int index, | |
| 46 menus::Accelerator* accelerator) const { return false; } | |
| 47 virtual bool IsItemCheckedAt(int index) const { return false; } | |
| 48 virtual int GetGroupIdAt(int index) const { return 0; } | |
| 49 virtual bool GetIconAt(int index, SkBitmap* icon) const { return false; } | |
| 50 virtual bool IsEnabledAt(int index) const { return false; } | |
| 51 virtual menus::MenuModel* GetSubmenuModelAt(int index) const { return NULL; } | |
| 52 virtual void HighlightChangedTo(int index) {} | |
| 53 virtual void ActivatedAt(int index) {} | |
| 54 virtual void MenuWillShow() {} | |
| 55 | |
| 56 // This method will draw the |icon| in the appropriate place on the |canvas|. | |
| 57 void DrawFeedbackIcon(gfx::Canvas* canvas, SkBitmap icon); | |
| 58 | |
| 59 StatusAreaHost* host_; | |
| 60 | |
| 61 DISALLOW_COPY_AND_ASSIGN(FeedbackMenuButton); | |
| 62 }; | |
| 63 | |
| 64 } // namespace chromeos | |
| 65 | |
| 66 #endif // CHROME_BROWSER_CHROMEOS_STATUS_FEEDBACK_MENU_BUTTON_H_ | |
| 67 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 68 // Use of this source code is governed by a BSD-style license that can be | |
| 69 // found in the LICENSE file. | |
| 70 | |
| 71 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_FEEDBACK_MENU_BUTTON_H_ | |
| 72 #define CHROME_BROWSER_CHROMEOS_STATUS_FEEDBACK_MENU_BUTTON_H_ | |
| 73 | |
| 74 #include "app/menus/simple_menu_model.h" | |
| 75 #include "chrome/browser/chromeos/status/status_area_button.h" | |
| 76 #include "views/controls/menu/menu_2.h" | |
| 77 #include "views/controls/menu/view_menu_delegate.h" | |
| 78 | |
| 79 class SkBitmap; | |
| 80 | |
| 81 namespace chromeos { | |
| 82 | |
| 83 class StatusAreaHost; | |
| 84 | |
| 85 // The language menu button in the status area. | |
| 86 // This class will handle getting the IME/XKB status and populating the menu. | |
| 87 class FeedbackMenuButton : public StatusAreaButton, | |
| 88 public views::ViewMenuDelegate, | |
| 89 public menus::MenuModel { | |
| 90 public: | |
| 91 explicit FeedbackMenuButton(StatusAreaHost* host); | |
| 92 virtual ~FeedbackMenuButton(); | |
| 93 | |
| 94 private: | |
| 95 // StatusAreaButton implementation. | |
| 96 virtual void DrawPressed(gfx::Canvas* canvas); | |
| 97 virtual void DrawIcon(gfx::Canvas* canvas); | |
| 98 | |
| 99 // views::ViewMenuDelegate implementation. | |
| 100 virtual void RunMenu(views::View* source, const gfx::Point& pt); | |
| 101 | |
| 102 // menus::MenuModel implementation. | |
| 103 virtual int GetItemCount() const { return 0; } | |
| 104 virtual bool HasIcons() const { return false; } | |
| 105 virtual menus::MenuModel::ItemType GetTypeAt(int index) const { | |
| 106 return menus::MenuModel::TYPE_COMMAND; | |
| 107 } | |
| 108 virtual int GetCommandIdAt(int index) const { return index; } | |
| 109 virtual string16 GetLabelAt(int index) const { return string16(); } | |
| 110 virtual bool IsLabelDynamicAt(int index) const { return true; } | |
| 111 virtual bool GetAcceleratorAt(int index, | |
| 112 menus::Accelerator* accelerator) const { return false; } | |
| 113 virtual bool IsItemCheckedAt(int index) const { return false; } | |
| 114 virtual int GetGroupIdAt(int index) const { return 0; } | |
| 115 virtual bool GetIconAt(int index, SkBitmap* icon) const { return false; } | |
| 116 virtual bool IsEnabledAt(int index) const { return false; } | |
| 117 virtual menus::MenuModel* GetSubmenuModelAt(int index) const { return NULL; } | |
| 118 virtual void HighlightChangedTo(int index) {} | |
| 119 virtual void ActivatedAt(int index) {} | |
| 120 virtual void MenuWillShow() {} | |
| 121 | |
| 122 // This method will draw the |icon| in the appropriate place on the |canvas|. | |
| 123 void DrawFeedbackIcon(gfx::Canvas* canvas, SkBitmap icon); | |
| 124 | |
| 125 StatusAreaHost* host_; | |
| 126 | |
| 127 DISALLOW_COPY_AND_ASSIGN(FeedbackMenuButton); | |
| 128 }; | |
| 129 | |
| 130 } // namespace chromeos | |
| 131 | |
| 132 #endif // CHROME_BROWSER_CHROMEOS_STATUS_FEEDBACK_MENU_BUTTON_H_ | |
| OLD | NEW |