Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / chromeos / ime / candidate_view.h
blobbc89160af66cfba74506c6f374aa941b4102821b
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_CHROMEOS_IME_CANDIDATE_VIEW_H_
6 #define UI_CHROMEOS_IME_CANDIDATE_VIEW_H_
8 #include "base/gtest_prod_util.h"
9 #include "ui/base/ime/candidate_window.h"
10 #include "ui/chromeos/ui_chromeos_export.h"
11 #include "ui/views/controls/button/custom_button.h"
12 #include "ui/views/controls/label.h"
13 #include "ui/views/view.h"
15 namespace ui {
16 namespace ime {
18 // CandidateView renderes a row of a candidate.
19 class UI_CHROMEOS_EXPORT CandidateView : public views::CustomButton {
20 public:
21 CandidateView(views::ButtonListener* listener,
22 ui::CandidateWindow::Orientation orientation);
23 ~CandidateView() override {}
25 void GetPreferredWidths(int* shortcut_width,
26 int* candidate_width);
28 void SetWidths(int shortcut_width,
29 int candidate_width);
31 void SetEntry(const ui::CandidateWindow::Entry& entry);
33 // Sets infolist icon.
34 void SetInfolistIcon(bool enable);
36 void SetHighlighted(bool highlighted);
38 private:
39 friend class CandidateWindowViewTest;
40 FRIEND_TEST_ALL_PREFIXES(CandidateWindowViewTest, ShortcutSettingTest);
42 // Overridden from views::CustomButton:
43 void StateChanged() override;
45 // Overridden from View:
46 const char* GetClassName() const override;
47 bool OnMouseDragged(const ui::MouseEvent& event) override;
48 void Layout() override;
49 gfx::Size GetPreferredSize() const override;
51 // The orientation of the candidate view.
52 ui::CandidateWindow::Orientation orientation_;
54 // Views created in the class will be part of tree of |this|, so these
55 // child views will be deleted when |this| is deleted.
57 // The shortcut label renders shortcut numbers like 1, 2, and 3.
58 views::Label* shortcut_label_;
59 // The candidate label renders candidates.
60 views::Label* candidate_label_;
61 // The annotation label renders annotations.
62 views::Label* annotation_label_;
63 // The infolist icon.
64 views::View* infolist_icon_;
66 int shortcut_width_;
67 int candidate_width_;
68 bool highlighted_;
70 DISALLOW_COPY_AND_ASSIGN(CandidateView);
73 } // namespace ime
74 } // namespace ui
76 #endif // UI_CHROMEOS_IME_CANDIDATE_VIEW_H_