blob: 6d5717857ef4b12652094903ec4da28075215a5f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
// 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_STATUS_AREA_BUTTON_H_
#define CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_BUTTON_H_
#pragma once
#include "views/controls/button/menu_button.h"
#include "views/controls/menu/view_menu_delegate.h"
namespace chromeos {
// Button to be used to represent status and allow menus to be popped up.
// Shows current button state by drawing a border around the current icon.
class StatusAreaButton : public views::MenuButton {
public:
explicit StatusAreaButton(views::ViewMenuDelegate* menu_delegate);
virtual ~StatusAreaButton() {}
virtual void Paint(gfx::Canvas* canvas, bool for_drag);
virtual gfx::Size GetPreferredSize();
virtual gfx::Insets GetInsets() const;
// Overrides TextButton's SetText to clear max text size before seting new
// text content so that the button size would fit the new text size.
virtual void SetText(const std::wstring& text);
void set_use_menu_button_paint(bool use_menu_button_paint) {
use_menu_button_paint_ = use_menu_button_paint;
}
protected:
// Draws the pressed icon. This is called before DrawIcon if the state is
// pressed. Subclasses should override this method if they need to draw a
// pressed icon.
virtual void DrawPressed(gfx::Canvas* canvas) {}
// Draws the icon for this status area button on the canvas.
// Subclasses should override this method if they need to draw their own icon.
// Otherwise, just call SetIcon() and the it will be handled for you.
virtual void DrawIcon(gfx::Canvas* canvas);
// True if the button wants to use views::MenuButton drawings.
bool use_menu_button_paint_;
// Insets to use for this button.
gfx::Insets insets_;
DISALLOW_COPY_AND_ASSIGN(StatusAreaButton);
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_BUTTON_H_
|