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

Side by Side Diff: trunk/src/ui/base/ime/candidate_window.h

Issue 130833002: Revert 243777 "Moves CandidateWindow model to ui/base/ime." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef UI_BASE_IME_CANDIDATE_WINDOW_H_
6 #define UI_BASE_IME_CANDIDATE_WINDOW_H_
7
8 #include <string>
9 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "ui/base/ui_base_export.h"
13
14 namespace ui {
15
16 // CandidateWindow represents the structure of candidates generated from IME.
17 class UI_BASE_EXPORT CandidateWindow {
18 public:
19 enum Orientation {
20 HORIZONTAL = 0,
21 VERTICAL = 1,
22 };
23
24 struct UI_BASE_EXPORT CandidateWindowProperty {
25 CandidateWindowProperty();
26 virtual ~CandidateWindowProperty();
27 int page_size;
28 int cursor_position;
29 bool is_cursor_visible;
30 bool is_vertical;
31 bool show_window_at_composition;
32
33 // Auxiliary text is typically displayed in the footer of the candidate
34 // window.
35 std::string auxiliary_text;
36 bool is_auxiliary_text_visible;
37 };
38
39 // Represents a candidate entry.
40 struct UI_BASE_EXPORT Entry {
41 Entry();
42 virtual ~Entry();
43 std::string value;
44 std::string label;
45 std::string annotation;
46 std::string description_title;
47 std::string description_body;
48 };
49
50 CandidateWindow();
51 virtual ~CandidateWindow();
52
53 // Returns true if the given |candidate_window| is equal to myself.
54 bool IsEqual(const CandidateWindow& candidate_window) const;
55
56 // Copies |candidate_window| to myself.
57 void CopyFrom(const CandidateWindow& candidate_window);
58
59 const CandidateWindowProperty& GetProperty() const {
60 return *property_;
61 }
62 void SetProperty(const CandidateWindowProperty& property) {
63 *property_ = property;
64 }
65
66 // Returns the number of candidates in one page.
67 uint32 page_size() const { return property_->page_size; }
68 void set_page_size(uint32 page_size) { property_->page_size = page_size; }
69
70 // Returns the cursor index of the currently selected candidate.
71 uint32 cursor_position() const { return property_->cursor_position; }
72 void set_cursor_position(uint32 cursor_position) {
73 property_->cursor_position = cursor_position;
74 }
75
76 // Returns true if the cursor is visible.
77 bool is_cursor_visible() const { return property_->is_cursor_visible; }
78 void set_is_cursor_visible(bool is_cursor_visible) {
79 property_->is_cursor_visible = is_cursor_visible;
80 }
81
82 // Returns the orientation of the candidate window.
83 Orientation orientation() const {
84 return property_->is_vertical ? VERTICAL : HORIZONTAL;
85 }
86 void set_orientation(Orientation orientation) {
87 property_->is_vertical = (orientation == VERTICAL);
88 }
89
90 // Returns true if the auxiliary text is visible.
91 bool is_auxiliary_text_visible() const {
92 return property_->is_auxiliary_text_visible;
93 }
94 void set_is_auxiliary_text_visible(bool is_auxiliary_text_visible) const {
95 property_->is_auxiliary_text_visible = is_auxiliary_text_visible;
96 }
97
98 // Accessors of auxiliary_text.
99 const std::string& auxiliary_text() const {
100 return property_->auxiliary_text;
101 }
102 void set_auxiliary_text(const std::string& auxiliary_text) const {
103 property_->auxiliary_text = auxiliary_text;
104 }
105
106 const std::vector<Entry>& candidates() const { return candidates_; }
107 std::vector<Entry>* mutable_candidates() { return &candidates_; }
108
109 bool show_window_at_composition() const {
110 return property_->show_window_at_composition;
111 }
112 void set_show_window_at_composition(bool show_window_at_composition) {
113 property_->show_window_at_composition = show_window_at_composition;
114 }
115
116 private:
117 scoped_ptr<CandidateWindowProperty> property_;
118 std::vector<Entry> candidates_;
119
120 DISALLOW_COPY_AND_ASSIGN(CandidateWindow);
121 };
122
123 } // namespace ui
124
125 #endif // UI_BASE_IME_CANDIDATE_WINDOW_H_
OLDNEW
« no previous file with comments | « trunk/src/chromeos/ime/candidate_window_unittest.cc ('k') | trunk/src/ui/base/ime/candidate_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698