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

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

Issue 10056001: chromeos: Remove old status-area related code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 8 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
(Empty)
1 // Copyright (c) 2012 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_STATUS_AREA_BUTTON_H_
6 #define CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_BUTTON_H_
7 #pragma once
8
9 #include "base/compiler_specific.h"
10 #include "base/string16.h"
11 #include "ui/gfx/font.h"
12 #include "ui/views/controls/button/menu_button.h"
13 #include "ui/views/controls/button/menu_button_listener.h"
14
15 // Button to be used to represent status and allow menus to be popped up.
16 // Shows current button state by drawing a border around the current icon.
17 class StatusAreaButton : public views::MenuButton {
18 public:
19 // Different text styles for different types of backgrounds.
20 enum TextStyle {
21 WHITE_PLAIN_BOLD,
22 GRAY_PLAIN_LIGHT,
23 WHITE_HALOED_BOLD,
24 GRAY_EMBOSSED_BOLD
25 };
26
27 class Delegate {
28 public:
29 // Commands to be passed to ExecuteCommand().
30 enum Command {
31 SHOW_LANGUAGE_OPTIONS,
32 SHOW_NETWORK_OPTIONS,
33 SHOW_DATE_OPTIONS
34 };
35
36 // |command_id| can be any int, passed from the button to the delegate.
37 virtual bool ShouldExecuteStatusAreaCommand(
38 const views::View* button_view, int command_id) const = 0;
39
40 virtual void ExecuteStatusAreaCommand(
41 const views::View* button_view, int command_id) = 0;
42
43 // Get the style that should currently be used in rendering the button's
44 // text.
45 virtual TextStyle GetStatusAreaTextStyle() const = 0;
46
47 // Handle visibility changes (e.g. resize the status area).
48 virtual void ButtonVisibilityChanged(views::View* button_view) = 0;
49
50 protected:
51 virtual ~Delegate() {}
52 };
53
54 StatusAreaButton(Delegate* button_delegate,
55 views::MenuButtonListener* menu_button_listener);
56 virtual ~StatusAreaButton() {}
57 virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) OVERRIDE;
58
59 // Overrides TextButton's SetText to clear max text size before seting new
60 // text content so that the button size would fit the new text size.
61 virtual void SetText(const string16& text) OVERRIDE;
62
63 // views::MenuButton overrides.
64 virtual bool Activate() OVERRIDE;
65
66 // View overrides.
67 virtual gfx::Size GetPreferredSize() OVERRIDE;
68 virtual gfx::Insets GetInsets() const OVERRIDE;
69 virtual void OnThemeChanged() OVERRIDE;
70 virtual void SetVisible(bool visible) OVERRIDE;
71 virtual bool HitTest(const gfx::Point& l) const OVERRIDE;
72
73 // Sets menu_active_. Override this to perform additional actions when
74 // menus are activated.
75 virtual void SetMenuActive(bool active);
76
77 // Refresh the style used to paint this button's text. Schedules repaint.
78 void UpdateTextStyle();
79
80 bool menu_active() const { return menu_active_; }
81
82 protected:
83 Delegate* delegate() { return delegate_; }
84 const Delegate* delegate() const { return delegate_; }
85
86 // Subclasses should override these methods to return the correct dimensions.
87 virtual int icon_height();
88 virtual int icon_width();
89
90 // Subclasses can override this method to return more or less padding.
91 // The padding is added to both the left and right side.
92 virtual int horizontal_padding();
93
94 // Insets to use for this button.
95 gfx::Insets insets_;
96
97 // Controls whether or not the menu can be activated. This is independent of
98 // IsEnabled state, so that we can prevent the menu from appearing without
99 // affecting the appearance of the button.
100 bool menu_active_;
101
102 private:
103 Delegate* delegate_;
104
105 // Fonts used to render the button's text.
106 gfx::Font light_font_;
107 gfx::Font bold_font_;
108
109 DISALLOW_COPY_AND_ASSIGN(StatusAreaButton);
110 };
111
112 #endif // CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_BUTTON_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/status_area_bubble.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