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

Unified Diff: ui/message_center/views/bounded_label.h

Issue 12757003: Revert 188637 "Added text line limits to collapsed and expanded ..." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 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 | « ui/message_center/run_all_unittests.cc ('k') | ui/message_center/views/bounded_label.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/views/bounded_label.h
===================================================================
--- ui/message_center/views/bounded_label.h (revision 188662)
+++ ui/message_center/views/bounded_label.h (working copy)
@@ -1,67 +0,0 @@
-// Copyright (c) 2012 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 UI_MESSAGE_CENTER_BOUNDED_LABEL_H_
-#define UI_MESSAGE_CENTER_BOUNDED_LABEL_H_
-
-#include "testing/gtest/include/gtest/gtest_prod.h"
-#include "ui/message_center/message_center_export.h"
-#include "ui/views/controls/label.h"
-
-namespace message_center {
-
-// BoundedLabels display text up to a maximum number of lines, with ellipsis at
-// the end of the last line for any omitted text. The font, text, multiline
-// behavior, character break behavior, elide behavior, and focus border of
-// instances of this views::Label subclass cannot be changed, so the following
-// views::Label methods should never be called with instances of this class:
-//
-// SetFont()
-// SetText()
-// SetMultiLine()
-// SetAllowCharacterBreak()
-// SetElideBehavior()
-// SetHasFocusBorder()
-//
-class MESSAGE_CENTER_EXPORT BoundedLabel : public views::Label {
- public:
- BoundedLabel(string16 text, size_t max_lines);
- BoundedLabel(string16 text, gfx::Font font, size_t max_lines);
- virtual ~BoundedLabel();
-
- void SetMaxLines(size_t lines);
- size_t GetMaxLines();
- size_t GetPreferredLines();
-
- virtual int GetHeightForWidth(int width) OVERRIDE;
-
- protected:
- // Overridden from views::Label.
- virtual gfx::Size GetTextSize() const OVERRIDE;
- virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
- virtual void PaintText(gfx::Canvas* canvas,
- const string16& text,
- const gfx::Rect& text_bounds,
- int flags) OVERRIDE;
-
- private:
- friend class BoundedLabelTest;
-
- void Init(size_t max_lines);
- int GetTextFlags() const;
- int GetTextHeightForWidth(int width) const;
- std::vector<string16> SplitLines(int width, size_t max_lines) const;
-
- size_t max_lines_;
- size_t preferred_lines_;
- bool is_preferred_lines_valid_;
- mutable gfx::Size text_size_;
- mutable bool is_text_size_valid_;
-
- DISALLOW_COPY_AND_ASSIGN(BoundedLabel);
-};
-
-} // namespace message_center
-
-#endif // UI_MESSAGE_CENTER_BOUNDED_LABEL_H_
« no previous file with comments | « ui/message_center/run_all_unittests.cc ('k') | ui/message_center/views/bounded_label.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698