OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2006-2008 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_LANGUAGE_MENU_BUTTON_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LANGUAGE_MENU_BUTTON_H_ |
| 7 |
| 8 #include "chrome/browser/chromeos/language_library.h" |
| 9 #include "chrome/browser/chromeos/status_area_button.h" |
| 10 #include "views/controls/menu/menu_2.h" |
| 11 #include "views/controls/menu/view_menu_delegate.h" |
| 12 |
| 13 class Browser; |
| 14 class SkBitmap; |
| 15 |
| 16 namespace chromeos { |
| 17 |
| 18 // The language menu button in the status area. |
| 19 // This class will handle getting the IME/XKB status and populating the menu. |
| 20 class LanguageMenuButton : public views::MenuButton, |
| 21 public views::ViewMenuDelegate, |
| 22 public menus::MenuModel, |
| 23 public LanguageLibrary::Observer { |
| 24 public: |
| 25 explicit LanguageMenuButton(Browser* browser); |
| 26 virtual ~LanguageMenuButton(); |
| 27 |
| 28 // views::Menu2Model implementation. |
| 29 virtual bool HasIcons() const; |
| 30 virtual int GetItemCount() const; |
| 31 virtual menus::MenuModel::ItemType GetTypeAt(int index) const; |
| 32 virtual int GetCommandIdAt(int index) const; |
| 33 virtual string16 GetLabelAt(int index) const; |
| 34 virtual bool IsLabelDynamicAt(int index) const; |
| 35 virtual bool GetAcceleratorAt(int index, |
| 36 menus::Accelerator* accelerator) const; |
| 37 virtual bool IsItemCheckedAt(int index) const; |
| 38 virtual int GetGroupIdAt(int index) const; |
| 39 virtual bool GetIconAt(int index, SkBitmap* icon) const; |
| 40 virtual bool IsEnabledAt(int index) const; |
| 41 virtual menus::MenuModel* GetSubmenuModelAt(int index) const; |
| 42 virtual void HighlightChangedTo(int index); |
| 43 virtual void ActivatedAt(int index); |
| 44 virtual void MenuWillShow(); |
| 45 |
| 46 // LanguageLibrary::Observer implementation. |
| 47 virtual void LanguageChanged(LanguageLibrary* obj); |
| 48 |
| 49 private: |
| 50 // views::ViewMenuDelegate implementation. |
| 51 virtual void RunMenu(views::View* source, const gfx::Point& pt); |
| 52 |
| 53 // Update the status area with |name|. |
| 54 void UpdateIcon(const std::wstring& name); |
| 55 |
| 56 // The current language list. |
| 57 scoped_ptr<InputLanguageList> language_list_; |
| 58 |
| 59 // The language menu. |
| 60 views::Menu2 language_menu_; |
| 61 // The browser window that owns us. |
| 62 Browser* browser_; |
| 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(LanguageMenuButton); |
| 65 }; |
| 66 |
| 67 } // namespace chromeos |
| 68 |
| 69 #endif // CHROME_BROWSER_CHROMEOS_LANGUAGE_MENU_BUTTON_H_ |
OLD | NEW |