| 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 CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_VIEW_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "chromeos/ime/candidate_window.h" | 9 #include "ui/base/ime/candidate_window.h" |
| 10 #include "ui/views/controls/button/custom_button.h" | 10 #include "ui/views/controls/button/custom_button.h" |
| 11 #include "ui/views/controls/label.h" | 11 #include "ui/views/controls/label.h" |
| 12 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
| 13 | 13 |
| 14 namespace chromeos { | 14 namespace chromeos { |
| 15 namespace input_method { | 15 namespace input_method { |
| 16 | 16 |
| 17 // CandidateView renderes a row of a candidate. | 17 // CandidateView renderes a row of a candidate. |
| 18 class CandidateView : public views::CustomButton { | 18 class CandidateView : public views::CustomButton { |
| 19 public: | 19 public: |
| 20 CandidateView(views::ButtonListener* listener, | 20 CandidateView(views::ButtonListener* listener, |
| 21 CandidateWindow::Orientation orientation); | 21 ui::CandidateWindow::Orientation orientation); |
| 22 virtual ~CandidateView() {} | 22 virtual ~CandidateView() {} |
| 23 | 23 |
| 24 void GetPreferredWidths(int* shortcut_width, | 24 void GetPreferredWidths(int* shortcut_width, |
| 25 int* candidate_width); | 25 int* candidate_width); |
| 26 | 26 |
| 27 void SetWidths(int shortcut_width, | 27 void SetWidths(int shortcut_width, |
| 28 int candidate_width); | 28 int candidate_width); |
| 29 | 29 |
| 30 void SetEntry(const CandidateWindow::Entry& entry); | 30 void SetEntry(const ui::CandidateWindow::Entry& entry); |
| 31 | 31 |
| 32 // Sets infolist icon. | 32 // Sets infolist icon. |
| 33 void SetInfolistIcon(bool enable); | 33 void SetInfolistIcon(bool enable); |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 friend class CandidateWindowViewTest; | 36 friend class CandidateWindowViewTest; |
| 37 FRIEND_TEST_ALL_PREFIXES(CandidateWindowViewTest, ShortcutSettingTest); | 37 FRIEND_TEST_ALL_PREFIXES(CandidateWindowViewTest, ShortcutSettingTest); |
| 38 | 38 |
| 39 // Overridden from views::CustomButton: | 39 // Overridden from views::CustomButton: |
| 40 virtual void StateChanged() OVERRIDE; | 40 virtual void StateChanged() OVERRIDE; |
| 41 | 41 |
| 42 // Overridden from View: | 42 // Overridden from View: |
| 43 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; | 43 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; |
| 44 virtual void Layout() OVERRIDE; | 44 virtual void Layout() OVERRIDE; |
| 45 virtual gfx::Size GetPreferredSize() OVERRIDE; | 45 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 46 | 46 |
| 47 // The orientation of the candidate view. | 47 // The orientation of the candidate view. |
| 48 CandidateWindow::Orientation orientation_; | 48 ui::CandidateWindow::Orientation orientation_; |
| 49 | 49 |
| 50 // Views created in the class will be part of tree of |this|, so these | 50 // Views created in the class will be part of tree of |this|, so these |
| 51 // child views will be deleted when |this| is deleted. | 51 // child views will be deleted when |this| is deleted. |
| 52 | 52 |
| 53 // The shortcut label renders shortcut numbers like 1, 2, and 3. | 53 // The shortcut label renders shortcut numbers like 1, 2, and 3. |
| 54 views::Label* shortcut_label_; | 54 views::Label* shortcut_label_; |
| 55 // The candidate label renders candidates. | 55 // The candidate label renders candidates. |
| 56 views::Label* candidate_label_; | 56 views::Label* candidate_label_; |
| 57 // The annotation label renders annotations. | 57 // The annotation label renders annotations. |
| 58 views::Label* annotation_label_; | 58 views::Label* annotation_label_; |
| 59 | 59 |
| 60 int shortcut_width_; | 60 int shortcut_width_; |
| 61 int candidate_width_; | 61 int candidate_width_; |
| 62 | 62 |
| 63 // The infolist icon. | 63 // The infolist icon. |
| 64 views::View* infolist_icon_; | 64 views::View* infolist_icon_; |
| 65 | 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(CandidateView); | 66 DISALLOW_COPY_AND_ASSIGN(CandidateView); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace input_method | 69 } // namespace input_method |
| 70 } // namespace chromeos | 70 } // namespace chromeos |
| 71 | 71 |
| 72 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_VIEW_H_ | 72 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_VIEW_H_ |
| OLD | NEW |