blob: b1d7043b1e025a5f771bf11a5eb1d49b5dd2cbf1 (
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
// Copyright (c) 2010 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 VIEWS_CONTROLS_PROGRESS_BAR_H_
#define VIEWS_CONTROLS_PROGRESS_BAR_H_
#pragma once
#include <string>
#include "views/view.h"
namespace gfx {
class Canvas;
class Point;
class Size;
}
namespace views {
/////////////////////////////////////////////////////////////////////////////
//
// ProgressBar class
//
// A progress bar is a control that indicates progress visually.
//
/////////////////////////////////////////////////////////////////////////////
class ProgressBar : public View {
public:
ProgressBar();
virtual ~ProgressBar();
// Overridden to return preferred size of the progress bar.
virtual gfx::Size GetPreferredSize();
// Returns views/ProgressBar.
virtual std::string GetClassName() const;
// Overridden to paint
virtual void Paint(gfx::Canvas* canvas);
// Set and get the progress bar progress in range [0, kMaxProgress].
virtual void SetProgress(int progress);
virtual int GetProgress() const;
// Add progress to current.
virtual void AddProgress(int tick);
// Sets the tooltip text. Default behavior for a progress bar is to show
// no tooltip on mouse hover. Calling this lets you set a custom tooltip.
// To revert to default behavior, call this with an empty string.
virtual void SetTooltipText(const std::wstring& tooltip_text);
// Gets the tooltip text if has been specified with SetTooltipText().
virtual bool GetTooltipText(const gfx::Point& p, std::wstring* tooltip);
// Sets the enabled state.
virtual void SetEnabled(bool enabled);
// Accessibility accessors, overridden from View.
virtual bool GetAccessibleRole(AccessibilityTypes::Role* role);
virtual bool GetAccessibleState(AccessibilityTypes::State* state);
// Maximum value of progress.
static const int kMaxProgress;
private:
// Progress in range [0, kMaxProgress].
int progress_;
// Tooltip text.
std::wstring tooltip_text_;
// The view class name.
static const char kViewClassName[];
DISALLOW_COPY_AND_ASSIGN(ProgressBar);
};
} // namespace views
#endif // VIEWS_CONTROLS_PROGRESS_BAR_H_
|