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

Side by Side Diff: views/controls/button/text_button.h

Issue 113443: ChromeCanvas->gfx::Canvas (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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
« no previous file with comments | « views/controls/button/native_button.h ('k') | views/controls/button/text_button.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ 5 #ifndef VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_
6 #define VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ 6 #define VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_
7 7
8 #include "app/gfx/chrome_font.h" 8 #include "app/gfx/font.h"
9 #include "third_party/skia/include/core/SkBitmap.h" 9 #include "third_party/skia/include/core/SkBitmap.h"
10 #include "views/border.h" 10 #include "views/border.h"
11 #include "views/controls/button/custom_button.h" 11 #include "views/controls/button/custom_button.h"
12 12
13 namespace views { 13 namespace views {
14 14
15 //////////////////////////////////////////////////////////////////////////////// 15 ////////////////////////////////////////////////////////////////////////////////
16 // 16 //
17 // TextButtonBorder 17 // TextButtonBorder
18 // 18 //
19 // A Border subclass that paints a TextButton's background layer - 19 // A Border subclass that paints a TextButton's background layer -
20 // basically the button frame in the hot/pushed states. 20 // basically the button frame in the hot/pushed states.
21 // 21 //
22 //////////////////////////////////////////////////////////////////////////////// 22 ////////////////////////////////////////////////////////////////////////////////
23 class TextButtonBorder : public Border { 23 class TextButtonBorder : public Border {
24 public: 24 public:
25 TextButtonBorder(); 25 TextButtonBorder();
26 virtual ~TextButtonBorder(); 26 virtual ~TextButtonBorder();
27 27
28 // Render the background for the provided view 28 // Render the background for the provided view
29 virtual void Paint(const View& view, ChromeCanvas* canvas) const; 29 virtual void Paint(const View& view, gfx::Canvas* canvas) const;
30 30
31 // Returns the insets for the border. 31 // Returns the insets for the border.
32 virtual void GetInsets(gfx::Insets* insets) const; 32 virtual void GetInsets(gfx::Insets* insets) const;
33 33
34 private: 34 private:
35 DISALLOW_EVIL_CONSTRUCTORS(TextButtonBorder); 35 DISALLOW_EVIL_CONSTRUCTORS(TextButtonBorder);
36 36
37 // Images 37 // Images
38 struct MBBImageSet { 38 struct MBBImageSet {
39 SkBitmap* top_left; 39 SkBitmap* top_left;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 // TextButton remembers the maximum display size of the text passed to 86 // TextButton remembers the maximum display size of the text passed to
87 // SetText. This method resets the cached maximum display size to the 87 // SetText. This method resets the cached maximum display size to the
88 // current size. 88 // current size.
89 void ClearMaxTextSize(); 89 void ClearMaxTextSize();
90 90
91 void set_max_width(int max_width) { max_width_ = max_width; } 91 void set_max_width(int max_width) { max_width_ = max_width; }
92 92
93 // Paint the button into the specified canvas. If |for_drag| is true, the 93 // Paint the button into the specified canvas. If |for_drag| is true, the
94 // function paints a drag image representation into the canvas. 94 // function paints a drag image representation into the canvas.
95 virtual void Paint(ChromeCanvas* canvas, bool for_drag); 95 virtual void Paint(gfx::Canvas* canvas, bool for_drag);
96 96
97 // Overridden from View: 97 // Overridden from View:
98 virtual gfx::Size GetPreferredSize(); 98 virtual gfx::Size GetPreferredSize();
99 virtual gfx::Size GetMinimumSize(); 99 virtual gfx::Size GetMinimumSize();
100 virtual void SetEnabled(bool enabled); 100 virtual void SetEnabled(bool enabled);
101 101
102 protected: 102 protected:
103 virtual bool OnMousePressed(const MouseEvent& e); 103 virtual bool OnMousePressed(const MouseEvent& e);
104 virtual void Paint(ChromeCanvas* canvas); 104 virtual void Paint(gfx::Canvas* canvas);
105 105
106 private: 106 private:
107 // The text string that is displayed in the button. 107 // The text string that is displayed in the button.
108 std::wstring text_; 108 std::wstring text_;
109 109
110 // The size of the text string. 110 // The size of the text string.
111 gfx::Size text_size_; 111 gfx::Size text_size_;
112 112
113 // Track the size of the largest text string seen so far, so that 113 // Track the size of the largest text string seen so far, so that
114 // changing text_ will not resize the button boundary. 114 // changing text_ will not resize the button boundary.
(...skipping 14 matching lines...) Expand all
129 // The width of the button will never be larger than this value. A value <= 0 129 // The width of the button will never be larger than this value. A value <= 0
130 // indicates the width is not constrained. 130 // indicates the width is not constrained.
131 int max_width_; 131 int max_width_;
132 132
133 DISALLOW_EVIL_CONSTRUCTORS(TextButton); 133 DISALLOW_EVIL_CONSTRUCTORS(TextButton);
134 }; 134 };
135 135
136 } // namespace views 136 } // namespace views
137 137
138 #endif // VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ 138 #endif // VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_
OLDNEW
« no previous file with comments | « views/controls/button/native_button.h ('k') | views/controls/button/text_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698