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

Unified Diff: views/controls/button/text_button.h

Issue 2833013: Tweaks for the merged menu: (Closed)
Patch Set: Created 10 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/accelerator.h ('k') | views/controls/button/text_button.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/button/text_button.h
diff --git a/views/controls/button/text_button.h b/views/controls/button/text_button.h
index 4257f0a32c400e599f80d3a615e502126f0ad7f7..5953a34c1712c3b094debd2ebfd844bc1a62d76a 100644
--- a/views/controls/button/text_button.h
+++ b/views/controls/button/text_button.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -71,6 +71,19 @@ class TextButtonBorder : public Border {
////////////////////////////////////////////////////////////////////////////////
class TextButton : public CustomButton {
public:
+ // Enumeration of how the prefix ('&') character is processed. The default
+ // is |PREFIX_NONE|.
+ enum PrefixType {
+ // No special processing is done.
+ PREFIX_NONE,
+
+ // The character following the prefix character is not rendered specially.
+ PREFIX_HIDE,
+
+ // The character following the prefix character is underlined.
+ PREFIX_SHOW
+ };
+
TextButton(ButtonListener* listener, const std::wstring& text);
virtual ~TextButton();
@@ -88,6 +101,8 @@ class TextButton : public CustomButton {
void set_alignment(TextAlignment alignment) { alignment_ = alignment; }
+ void set_prefix_type(PrefixType type) { prefix_type_ = type; }
+
// Sets the icon.
void SetIcon(const SkBitmap& icon);
SkBitmap icon() const { return icon_; }
@@ -136,7 +151,6 @@ class TextButton : public CustomButton {
static const SkColor kHoverColor;
protected:
- virtual bool OnMousePressed(const MouseEvent& e);
virtual void Paint(gfx::Canvas* canvas);
// Called when enabled or disabled state changes, or the colors for those
@@ -144,6 +158,10 @@ class TextButton : public CustomButton {
virtual void UpdateColor();
private:
+ // Updates text_size_ and max_text_size_ from the current text/font. This is
+ // invoked when the font or text changes.
+ void UpdateTextSize();
+
// The text string that is displayed in the button.
std::wstring text_;
@@ -189,6 +207,8 @@ class TextButton : public CustomButton {
// Whether or not to show the highlighted (i.e. hot) state.
bool show_highlighted_;
+ PrefixType prefix_type_;
+
DISALLOW_COPY_AND_ASSIGN(TextButton);
};
« no previous file with comments | « views/accelerator.h ('k') | views/controls/button/text_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698