Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(842)

Side by Side Diff: chrome/browser/chromeos/status/status_area_button.h

Issue 6904160: Implement new gray mock. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review nits Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_BUTTON_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_BUTTON_H_
6 #define CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_BUTTON_H_ 6 #define CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_BUTTON_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/chromeos/status/status_area_host.h"
9 #include "views/controls/button/menu_button.h" 10 #include "views/controls/button/menu_button.h"
10 #include "views/controls/menu/view_menu_delegate.h" 11 #include "views/controls/menu/view_menu_delegate.h"
11 12
12 namespace chromeos { 13 namespace chromeos {
13 14
14 // Button to be used to represent status and allow menus to be popped up. 15 // Button to be used to represent status and allow menus to be popped up.
15 // Shows current button state by drawing a border around the current icon. 16 // Shows current button state by drawing a border around the current icon.
16 class StatusAreaButton : public views::MenuButton { 17 class StatusAreaButton : public views::MenuButton {
17 public: 18 public:
18 explicit StatusAreaButton(views::ViewMenuDelegate* menu_delegate); 19 explicit StatusAreaButton(StatusAreaHost* host,
20 views::ViewMenuDelegate* menu_delegate);
19 virtual ~StatusAreaButton() {} 21 virtual ~StatusAreaButton() {}
20 virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode); 22 virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode);
21 virtual gfx::Size GetPreferredSize();
22 virtual gfx::Insets GetInsets() const;
23 23
24 // Overrides TextButton's SetText to clear max text size before seting new 24 // Overrides TextButton's SetText to clear max text size before seting new
25 // text content so that the button size would fit the new text size. 25 // text content so that the button size would fit the new text size.
26 virtual void SetText(const std::wstring& text); 26 virtual void SetText(const std::wstring& text);
27 27
28 void set_use_menu_button_paint(bool use_menu_button_paint) { 28 void set_use_menu_button_paint(bool use_menu_button_paint) {
29 use_menu_button_paint_ = use_menu_button_paint; 29 use_menu_button_paint_ = use_menu_button_paint;
30 } 30 }
31 31
32 // views::MenuButton overrides. 32 // views::MenuButton overrides.
33 virtual bool Activate(); 33 virtual bool Activate() OVERRIDE;
34
35 // View overrides.
36 virtual gfx::Size GetPreferredSize() OVERRIDE;
37 virtual gfx::Insets GetInsets() const OVERRIDE;
38 virtual void OnThemeChanged() OVERRIDE;
34 39
35 // Controls whether or not this status area button is able to be pressed. 40 // Controls whether or not this status area button is able to be pressed.
36 void set_active(bool active) { active_ = active; } 41 void set_active(bool active) { active_ = active; }
37 bool active() const { return active_; } 42 bool active() const { return active_; }
38 43
39 protected: 44 protected:
40
41 // Subclasses should override these methods to return the correct dimensions. 45 // Subclasses should override these methods to return the correct dimensions.
42 virtual int icon_height() { return 24; } 46 virtual int icon_height() { return 24; }
43 virtual int icon_width() { return 23; } 47 virtual int icon_width() { return 23; }
44 48
45 // Subclasses can override this method to return more or less padding. 49 // Subclasses can override this method to return more or less padding.
46 // The padding is added to both the left and right side. 50 // The padding is added to both the left and right side.
47 virtual int horizontal_padding() { return 1; } 51 virtual int horizontal_padding() { return 1; }
48 52
49 // True if the button wants to use views::MenuButton drawings. 53 // True if the button wants to use views::MenuButton drawings.
50 bool use_menu_button_paint_; 54 bool use_menu_button_paint_;
51 55
52 // Insets to use for this button. 56 // Insets to use for this button.
53 gfx::Insets insets_; 57 gfx::Insets insets_;
54 58
55 // Indicates when this button can be pressed. Independent of 59 // Indicates when this button can be pressed. Independent of
56 // IsEnabled state, so that when IsEnabled is true, this can still 60 // IsEnabled state, so that when IsEnabled is true, this can still
57 // be false, and vice versa. 61 // be false, and vice versa.
58 bool active_; 62 bool active_;
59 63
64 // The status area host,
65 StatusAreaHost* host_;
66
67 private:
68 void UpdateTextStyle();
69
60 DISALLOW_COPY_AND_ASSIGN(StatusAreaButton); 70 DISALLOW_COPY_AND_ASSIGN(StatusAreaButton);
61 }; 71 };
62 72
63 } // namespace chromeos 73 } // namespace chromeos
64 74
65 #endif // CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_BUTTON_H_ 75 #endif // CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_BUTTON_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/power_menu_button_browsertest.cc ('k') | chrome/browser/chromeos/status/status_area_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698