| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_CONTROLS_LABEL_H_ | 5 #ifndef UI_VIEWS_CONTROLS_LABEL_H_ |
| 6 #define UI_VIEWS_CONTROLS_LABEL_H_ | 6 #define UI_VIEWS_CONTROLS_LABEL_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "ui/gfx/render_text.h" | 11 #include "ui/gfx/render_text.h" |
| 12 #include "ui/views/selection_controller_delegate.h" | 12 #include "ui/views/selection_controller_delegate.h" |
| 13 #include "ui/views/view.h" | 13 #include "ui/views/view.h" |
| 14 | 14 |
| 15 namespace views { | 15 namespace views { |
| 16 class LabelTest; | 16 class LabelSelectionTest; |
| 17 class SelectionController; | 17 class SelectionController; |
| 18 | 18 |
| 19 // A view subclass that can display a string. | 19 // A view subclass that can display a string. |
| 20 class VIEWS_EXPORT Label : public View, public SelectionControllerDelegate { | 20 class VIEWS_EXPORT Label : public View, public SelectionControllerDelegate { |
| 21 public: | 21 public: |
| 22 // Internal class name. | 22 // Internal class name. |
| 23 static const char kViewClassName[]; | 23 static const char kViewClassName[]; |
| 24 | 24 |
| 25 // The padding for the focus border when rendering focused text. | 25 // The padding for the focus border when rendering focused text. |
| 26 static const int kFocusBorderPadding; | 26 static const int kFocusBorderPadding; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 void OnMouseReleased(const ui::MouseEvent& event) override; | 209 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 210 void OnMouseCaptureLost() override; | 210 void OnMouseCaptureLost() override; |
| 211 | 211 |
| 212 private: | 212 private: |
| 213 FRIEND_TEST_ALL_PREFIXES(LabelTest, ResetRenderTextData); | 213 FRIEND_TEST_ALL_PREFIXES(LabelTest, ResetRenderTextData); |
| 214 FRIEND_TEST_ALL_PREFIXES(LabelTest, MultilineSupportedRenderText); | 214 FRIEND_TEST_ALL_PREFIXES(LabelTest, MultilineSupportedRenderText); |
| 215 FRIEND_TEST_ALL_PREFIXES(LabelTest, TextChangeWithoutLayout); | 215 FRIEND_TEST_ALL_PREFIXES(LabelTest, TextChangeWithoutLayout); |
| 216 FRIEND_TEST_ALL_PREFIXES(LabelTest, EmptyLabel); | 216 FRIEND_TEST_ALL_PREFIXES(LabelTest, EmptyLabel); |
| 217 FRIEND_TEST_ALL_PREFIXES(LabelTest, FocusBounds); | 217 FRIEND_TEST_ALL_PREFIXES(LabelTest, FocusBounds); |
| 218 FRIEND_TEST_ALL_PREFIXES(LabelTest, MultiLineSizingWithElide); | 218 FRIEND_TEST_ALL_PREFIXES(LabelTest, MultiLineSizingWithElide); |
| 219 friend class LabelTest; | 219 friend class LabelSelectionTest; |
| 220 | 220 |
| 221 // SelectionControllerDelegate overrides: | 221 // SelectionControllerDelegate overrides: |
| 222 gfx::RenderText* GetRenderTextForSelectionController() override; | 222 gfx::RenderText* GetRenderTextForSelectionController() override; |
| 223 bool IsReadOnly() const override; | 223 bool IsReadOnly() const override; |
| 224 bool SupportsDrag() const override; | 224 bool SupportsDrag() const override; |
| 225 bool HasTextBeingDragged() const override; | 225 bool HasTextBeingDragged() const override; |
| 226 void SetTextBeingDragged(bool value) override; | 226 void SetTextBeingDragged(bool value) override; |
| 227 int GetViewHeight() const override; | 227 int GetViewHeight() const override; |
| 228 int GetViewWidth() const override; | 228 int GetViewWidth() const override; |
| 229 int GetDragSelectionDelay() const override; | 229 int GetDragSelectionDelay() const override; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 bool is_first_paint_text_; | 308 bool is_first_paint_text_; |
| 309 | 309 |
| 310 std::unique_ptr<SelectionController> selection_controller_; | 310 std::unique_ptr<SelectionController> selection_controller_; |
| 311 | 311 |
| 312 DISALLOW_COPY_AND_ASSIGN(Label); | 312 DISALLOW_COPY_AND_ASSIGN(Label); |
| 313 }; | 313 }; |
| 314 | 314 |
| 315 } // namespace views | 315 } // namespace views |
| 316 | 316 |
| 317 #endif // UI_VIEWS_CONTROLS_LABEL_H_ | 317 #endif // UI_VIEWS_CONTROLS_LABEL_H_ |
| OLD | NEW |