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 CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_VIEW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_VIEW_H_ |
7 | 7 |
8 #include "chrome/browser/chromeos/input_method/ibus_ui_controller.h" | 8 #include "chrome/browser/chromeos/input_method/ibus_ui_controller.h" |
9 #include "ui/views/view.h" | 9 #include "ui/views/view.h" |
10 | 10 |
11 namespace chromeos { | 11 namespace chromeos { |
12 namespace input_method { | 12 namespace input_method { |
13 | 13 |
14 class CandidateView; | 14 class CandidateView; |
15 class InformationTextArea; | 15 class InformationTextArea; |
16 class HidableArea; | 16 class HidableArea; |
17 | 17 |
18 // CandidateWindowView is the main container of the candidate window UI. | 18 // CandidateWindowView is the main container of the candidate window UI. |
19 class CandidateWindowView : public views::View { | 19 class CandidateWindowView : public views::View { |
20 public: | 20 public: |
21 // The object can be monitored by the observer. | 21 // The object can be monitored by the observer. |
22 class Observer { | 22 class Observer { |
23 public: | 23 public: |
24 virtual ~Observer() {} | 24 virtual ~Observer() {} |
25 // The function is called when a candidate is committed. | 25 // The function is called when a candidate is committed. |
26 // See comments at NotifyCandidateClicked() in chromeos_input_method_ui.h | 26 // See comments at NotifyCandidateClicked() in chromeos_input_method_ui.h |
27 // for details about the parameters. | 27 // for details about the parameters. |
28 virtual void OnCandidateCommitted(int index, int button, int flag) = 0; | 28 virtual void OnCandidateCommitted(int index, int button, int flag) = 0; |
| 29 |
| 30 virtual void OnCandidateWindowOpened() = 0; |
| 31 virtual void OnCandidateWindowClosed() = 0; |
29 }; | 32 }; |
30 | 33 |
31 explicit CandidateWindowView(views::Widget* parent_frame); | 34 explicit CandidateWindowView(views::Widget* parent_frame); |
32 virtual ~CandidateWindowView(); | 35 virtual ~CandidateWindowView(); |
33 void Init(); | 36 void Init(); |
34 | 37 |
35 // Adds the given observer. The ownership is not transferred. | 38 // Adds the given observer. The ownership is not transferred. |
36 void AddObserver(Observer* observer) { | 39 void AddObserver(Observer* observer) { |
37 observers_.AddObserver(observer); | 40 observers_.AddObserver(observer); |
38 } | 41 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; | 133 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; |
131 | 134 |
132 private: | 135 private: |
133 // Initializes the candidate views if needed. | 136 // Initializes the candidate views if needed. |
134 void MaybeInitializeCandidateViews( | 137 void MaybeInitializeCandidateViews( |
135 const InputMethodLookupTable& lookup_table); | 138 const InputMethodLookupTable& lookup_table); |
136 | 139 |
137 // Returns the appropriate area (header or footer) to put auxiliary texts. | 140 // Returns the appropriate area (header or footer) to put auxiliary texts. |
138 InformationTextArea* GetAuxiliaryTextArea(); | 141 InformationTextArea* GetAuxiliaryTextArea(); |
139 | 142 |
| 143 bool IsCandidateWindowOpen() const; |
| 144 |
140 // The lookup table (candidates). | 145 // The lookup table (candidates). |
141 InputMethodLookupTable lookup_table_; | 146 InputMethodLookupTable lookup_table_; |
142 | 147 |
143 // The index in the current page of the candidate currently being selected. | 148 // The index in the current page of the candidate currently being selected. |
144 int selected_candidate_index_in_page_; | 149 int selected_candidate_index_in_page_; |
145 | 150 |
146 // The observers of the object. | 151 // The observers of the object. |
147 ObserverList<Observer> observers_; | 152 ObserverList<Observer> observers_; |
148 | 153 |
149 // The parent frame. | 154 // The parent frame. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 192 |
188 bool is_suggestion_window_location_available_; | 193 bool is_suggestion_window_location_available_; |
189 | 194 |
190 DISALLOW_COPY_AND_ASSIGN(CandidateWindowView); | 195 DISALLOW_COPY_AND_ASSIGN(CandidateWindowView); |
191 }; | 196 }; |
192 | 197 |
193 } // namespace input_method | 198 } // namespace input_method |
194 } // namespace chromeos | 199 } // namespace chromeos |
195 | 200 |
196 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_VIEW_H_ | 201 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_VIEW_H_ |
OLD | NEW |