diff options
author | chocobo@chromium.org <chocobo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-04 20:36:41 +0000 |
---|---|---|
committer | chocobo@chromium.org <chocobo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-04 20:36:41 +0000 |
commit | 83a90f766cab48799eb12c9261f3f4c8032a4016 (patch) | |
tree | 7b56f90cc0bf5ef597c3740e1a9e5e3a8e091833 /chrome/browser/chromeos/status/power_menu_button.h | |
parent | e27e998ec728d85382cb8b50d63192e6f05ece16 (diff) | |
download | chromium_src-83a90f766cab48799eb12c9261f3f4c8032a4016.zip chromium_src-83a90f766cab48799eb12c9261f3f4c8032a4016.tar.gz chromium_src-83a90f766cab48799eb12c9261f3f4c8032a4016.tar.bz2 |
Refactor chromeos status area files into subdirectory status
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/561077
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38127 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/status/power_menu_button.h')
-rw-r--r-- | chrome/browser/chromeos/status/power_menu_button.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/chrome/browser/chromeos/status/power_menu_button.h b/chrome/browser/chromeos/status/power_menu_button.h new file mode 100644 index 0000000..58612f3 --- /dev/null +++ b/chrome/browser/chromeos/status/power_menu_button.h @@ -0,0 +1,67 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_ +#define CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_ + +#include "app/menus/menu_model.h" +#include "chrome/browser/chromeos/power_library.h" +#include "chrome/browser/chromeos/status/status_area_button.h" +#include "views/controls/menu/menu_2.h" +#include "views/controls/menu/view_menu_delegate.h" + +class SkBitmap; + +namespace chromeos { + +// The power menu button in the status area. +// This class will handle getting the power status and populating the menu. +class PowerMenuButton : public StatusAreaButton, + public views::ViewMenuDelegate, + public menus::MenuModel, + public PowerLibrary::Observer { + public: + PowerMenuButton(); + virtual ~PowerMenuButton(); + + // menus::MenuModel implementation. + virtual bool HasIcons() const { return false; } + virtual int GetItemCount() const; + virtual menus::MenuModel::ItemType GetTypeAt(int index) const; + virtual int GetCommandIdAt(int index) const { return index; } + virtual string16 GetLabelAt(int index) const; + virtual bool IsLabelDynamicAt(int index) const { return true; } + virtual bool GetAcceleratorAt(int index, + menus::Accelerator* accelerator) const { return false; } + virtual bool IsItemCheckedAt(int index) const { return false; } + virtual int GetGroupIdAt(int index) const { return 0; } + virtual bool GetIconAt(int index, SkBitmap* icon) const { return false; } + virtual bool IsEnabledAt(int index) const { return false; } + virtual menus::MenuModel* GetSubmenuModelAt(int index) const { return NULL; } + virtual void HighlightChangedTo(int index) {} + virtual void ActivatedAt(int index) {} + virtual void MenuWillShow() {} + + // PowerLibrary::Observer implementation. + virtual void PowerChanged(PowerLibrary* obj); + + private: + // views::ViewMenuDelegate implementation. + virtual void RunMenu(views::View* source, const gfx::Point& pt); + + // Update the power icon depending on the power status. + void UpdateIcon(); + + // The number of power images. + static const int kNumPowerImages; + + // The power menu. + views::Menu2 power_menu_; + + DISALLOW_COPY_AND_ASSIGN(PowerMenuButton); +}; + +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_STATUS_POWER_MENU_BUTTON_H_ |