OLD | NEW |
1 // Copyright (c) 2011 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 UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_WRAPPER_H_ | 5 #ifndef UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_WRAPPER_H_ |
6 #define UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_WRAPPER_H_ | 6 #define UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_WRAPPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
10 #include "ui/views/views_export.h" | 10 #include "ui/views/views_export.h" |
11 | 11 |
12 namespace gfx{ | 12 namespace gfx{ |
13 class Size; | 13 class Size; |
14 } | 14 } |
15 | 15 |
16 namespace views { | 16 namespace views { |
17 | 17 |
18 class Combobox; | 18 class Combobox; |
19 class KeyEvent; | 19 class KeyEvent; |
20 class View; | 20 class View; |
21 | 21 |
22 class VIEWS_EXPORT NativeComboboxWrapper { | 22 class VIEWS_EXPORT NativeComboboxWrapper { |
23 public: | 23 public: |
24 // Updates the combobox's content from its model. | 24 // Updates the combobox's content from its model. |
25 virtual void UpdateFromModel() = 0; | 25 virtual void UpdateFromModel() = 0; |
26 | 26 |
27 // Updates the displayed selected item from the associated Combobox. | 27 // Updates the selected index from the associated combobox. |
28 virtual void UpdateSelectedItem() = 0; | 28 virtual void UpdateSelectedIndex() = 0; |
29 | 29 |
30 // Updates the enabled state of the combobox from the associated view. | 30 // Updates the enabled state of the combobox from the associated view. |
31 virtual void UpdateEnabled() = 0; | 31 virtual void UpdateEnabled() = 0; |
32 | 32 |
33 // Gets the selected index. | 33 // Returns the selected index. |
34 virtual int GetSelectedItem() const = 0; | 34 virtual int GetSelectedIndex() const = 0; |
35 | 35 |
36 // Returns true if the Combobox dropdown is open. | 36 // Returns true if the combobox dropdown is open. |
37 virtual bool IsDropdownOpen() const = 0; | 37 virtual bool IsDropdownOpen() const = 0; |
38 | 38 |
39 // Returns the preferred size of the combobox. | 39 // Returns the preferred size of the combobox. |
40 virtual gfx::Size GetPreferredSize() = 0; | 40 virtual gfx::Size GetPreferredSize() = 0; |
41 | 41 |
42 // Retrieves the views::View that hosts the native control. | 42 // Retrieves the view that hosts the native control. |
43 virtual View* GetView() = 0; | 43 virtual View* GetView() = 0; |
44 | 44 |
45 // Sets the focus to the button. | 45 // Sets the focus to the button. |
46 virtual void SetFocus() = 0; | 46 virtual void SetFocus() = 0; |
47 | 47 |
48 // Invoked when a key is pressed/release on Combobox. Subclasser | 48 // Invoked when a key is pressed/release on combobox. Subclasser should |
49 // should return true if the event has been processed and false | 49 // return true if the event has been processed and false otherwise. |
50 // otherwise. | |
51 // See also View::OnKeyPressed/OnKeyReleased. | 50 // See also View::OnKeyPressed/OnKeyReleased. |
52 virtual bool HandleKeyPressed(const views::KeyEvent& e) = 0; | 51 virtual bool HandleKeyPressed(const views::KeyEvent& e) = 0; |
53 virtual bool HandleKeyReleased(const views::KeyEvent& e) = 0; | 52 virtual bool HandleKeyReleased(const views::KeyEvent& e) = 0; |
54 | 53 |
55 // Invoked when focus is being moved from or to the Combobox. | 54 // Invoked when focus is being moved from or to the combobox. |
56 // See also View::OnFocus/OnBlur. | 55 // See also View::OnFocus/OnBlur. |
57 virtual void HandleFocus() = 0; | 56 virtual void HandleFocus() = 0; |
58 virtual void HandleBlur() = 0; | 57 virtual void HandleBlur() = 0; |
59 | 58 |
60 // Returns a handle to the underlying native view for testing. | 59 // Returns a handle to the underlying native view for testing. |
61 virtual gfx::NativeView GetTestingHandle() const = 0; | 60 virtual gfx::NativeView GetTestingHandle() const = 0; |
62 | 61 |
63 static NativeComboboxWrapper* CreateWrapper(Combobox* combobox); | 62 static NativeComboboxWrapper* CreateWrapper(Combobox* combobox); |
64 | 63 |
65 protected: | 64 protected: |
66 virtual ~NativeComboboxWrapper() {} | 65 virtual ~NativeComboboxWrapper() {} |
67 }; | 66 }; |
68 | 67 |
69 } // namespace views | 68 } // namespace views |
70 | 69 |
71 #endif // UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_WRAPPER_H_ | 70 #endif // UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_WRAPPER_H_ |
OLD | NEW |