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