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 CHROMEOS_DBUS_IBUS_IBUS_LOOKUP_TABLE_H_ | 5 #ifndef CHROMEOS_DBUS_IBUS_IBUS_LOOKUP_TABLE_H_ |
6 #define CHROMEOS_DBUS_IBUS_IBUS_LOOKUP_TABLE_H_ | 6 #define CHROMEOS_DBUS_IBUS_IBUS_LOOKUP_TABLE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 IBusLookupTable* table); | 75 IBusLookupTable* table); |
76 // Appends a IBusLookupTable to |writer| except mozc_candidates_ in |table|. | 76 // Appends a IBusLookupTable to |writer| except mozc_candidates_ in |table|. |
77 void CHROMEOS_EXPORT AppendIBusLookupTable(const IBusLookupTable& table, | 77 void CHROMEOS_EXPORT AppendIBusLookupTable(const IBusLookupTable& table, |
78 dbus::MessageWriter* writer); | 78 dbus::MessageWriter* writer); |
79 | 79 |
80 // An representation of IBusLookupTable object which is used in dbus | 80 // An representation of IBusLookupTable object which is used in dbus |
81 // communication with ibus-daemon. | 81 // communication with ibus-daemon. |
82 class CHROMEOS_EXPORT IBusLookupTable { | 82 class CHROMEOS_EXPORT IBusLookupTable { |
83 public: | 83 public: |
84 enum Orientation { | 84 enum Orientation { |
85 IBUS_LOOKUP_TABLE_ORIENTATION_HORIZONTAL = 0, | 85 HORIZONTAL = 0, |
86 IBUS_LOOKUP_TABLE_ORIENTATION_VERTICAL = 1, | 86 VERTICAL = 1, |
87 }; | 87 }; |
88 | 88 |
89 // Represents a candidate entry. In dbus communication, each | 89 // Represents a candidate entry. In dbus communication, each |
90 // field is represented as IBusText, but attributes are not used in Chrome. | 90 // field is represented as IBusText, but attributes are not used in Chrome. |
91 // So just simple string is sufficient in this case. | 91 // So just simple string is sufficient in this case. |
92 struct Entry { | 92 struct Entry { |
93 Entry(); | 93 Entry(); |
94 virtual ~Entry(); | 94 virtual ~Entry(); |
95 std::string value; | 95 std::string value; |
96 std::string label; | 96 std::string label; |
97 std::string annotation; | 97 std::string annotation; |
98 std::string description_title; | 98 std::string description_title; |
99 std::string description_body; | 99 std::string description_body; |
100 }; | 100 }; |
101 | 101 |
102 IBusLookupTable(); | 102 IBusLookupTable(); |
103 virtual ~IBusLookupTable(); | 103 virtual ~IBusLookupTable(); |
104 | 104 |
| 105 // Returns true if the given |table| is equal to myself. |
| 106 bool IsEqual(const IBusLookupTable& table) const; |
| 107 |
| 108 // Copies |table| to myself. |
| 109 void CopyFrom(const IBusLookupTable& table); |
| 110 |
105 // Returns the number of candidates in one page. | 111 // Returns the number of candidates in one page. |
106 uint32 page_size() const { return page_size_; } | 112 uint32 page_size() const { return page_size_; } |
107 void set_page_size(uint32 page_size) { page_size_ = page_size; } | 113 void set_page_size(uint32 page_size) { page_size_ = page_size; } |
108 | 114 |
109 // Returns the cursor index of the currently selected candidate. | 115 // Returns the cursor index of the currently selected candidate. |
110 uint32 cursor_position() const { return cursor_position_; } | 116 uint32 cursor_position() const { return cursor_position_; } |
111 void set_cursor_position(uint32 cursor_position) { | 117 void set_cursor_position(uint32 cursor_position) { |
112 cursor_position_ = cursor_position; | 118 cursor_position_ = cursor_position; |
113 } | 119 } |
114 | 120 |
(...skipping 27 matching lines...) Expand all Loading... |
142 std::vector<Entry> candidates_; | 148 std::vector<Entry> candidates_; |
143 bool show_window_at_composition_; | 149 bool show_window_at_composition_; |
144 | 150 |
145 DISALLOW_COPY_AND_ASSIGN(IBusLookupTable); | 151 DISALLOW_COPY_AND_ASSIGN(IBusLookupTable); |
146 }; | 152 }; |
147 | 153 |
148 } // namespace ibus | 154 } // namespace ibus |
149 } // namespace chromeos | 155 } // namespace chromeos |
150 | 156 |
151 #endif // CHROMEOS_DBUS_IBUS_IBUS_LOOKUP_TABLE_H_ | 157 #endif // CHROMEOS_DBUS_IBUS_IBUS_LOOKUP_TABLE_H_ |
OLD | NEW |