| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_TEXTFIELD_TEXTFIELD_H_ | 5 #ifndef VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
| 6 #define VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 6 #define VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 // Returns true if the selection is made in reverse order. | 63 // Returns true if the selection is made in reverse order. |
| 64 bool is_reverse() const { return start_ > end_; } | 64 bool is_reverse() const { return start_ > end_; } |
| 65 | 65 |
| 66 // Returns the min of selected range. | 66 // Returns the min of selected range. |
| 67 size_t GetMin() const; | 67 size_t GetMin() const; |
| 68 | 68 |
| 69 // Returns the max of selected range. | 69 // Returns the max of selected range. |
| 70 size_t GetMax() const; | 70 size_t GetMax() const; |
| 71 | 71 |
| 72 // Returns true if |range| has same start, end position. | 72 // Returns true if the the selection range is same ignoring the direction. |
| 73 bool Equals(const TextRange& range) const { | 73 bool EqualsIgnoringDirection(const TextRange& range) const { |
| 74 return start_ == range.start_ && end_ == range.end_; | 74 return GetMin() == range.GetMin() && GetMax() == range.GetMax(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 // Set the range with |start| and |end|. | 77 // Set the range with |start| and |end|. |
| 78 void SetRange(size_t start, size_t end); | 78 void SetRange(size_t start, size_t end); |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 size_t start_; | 81 size_t start_; |
| 82 size_t end_; | 82 size_t end_; |
| 83 | 83 |
| 84 // No assign. | 84 // No assign. |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 340 |
| 341 // Text to display when empty. | 341 // Text to display when empty. |
| 342 string16 text_to_display_when_empty_; | 342 string16 text_to_display_when_empty_; |
| 343 | 343 |
| 344 DISALLOW_COPY_AND_ASSIGN(Textfield); | 344 DISALLOW_COPY_AND_ASSIGN(Textfield); |
| 345 }; | 345 }; |
| 346 | 346 |
| 347 } // namespace views | 347 } // namespace views |
| 348 | 348 |
| 349 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 349 #endif // VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
| OLD | NEW |