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 UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_VIEWS_H_ | 5 #ifndef UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_VIEWS_H_ |
6 #define UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_VIEWS_H_ | 6 #define UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_VIEWS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ui/views/controls/combobox/native_combobox_wrapper.h" | 9 #include "ui/views/controls/combobox/native_combobox_wrapper.h" |
10 #include "ui/views/controls/menu/menu_delegate.h" | 10 #include "ui/views/controls/menu/menu_delegate.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 class MenuRunner; | 21 class MenuRunner; |
22 | 22 |
23 // A views/skia only implementation of NativeComboboxWrapper. | 23 // A views/skia only implementation of NativeComboboxWrapper. |
24 // No platform specific code is used. | 24 // No platform specific code is used. |
25 class NativeComboboxViews : public views::View, | 25 class NativeComboboxViews : public views::View, |
26 public NativeComboboxWrapper, | 26 public NativeComboboxWrapper, |
27 public views::MenuDelegate { | 27 public views::MenuDelegate { |
28 public: | 28 public: |
29 static const char kViewClassName[]; | 29 static const char kViewClassName[]; |
30 | 30 |
31 explicit NativeComboboxViews(Combobox* parent); | 31 explicit NativeComboboxViews(Combobox* combo_box); |
32 virtual ~NativeComboboxViews(); | 32 virtual ~NativeComboboxViews(); |
33 | 33 |
34 // views::View overrides: | 34 // views::View overrides: |
35 virtual bool OnMousePressed(const views::MouseEvent& mouse_event) OVERRIDE; | 35 virtual bool OnMousePressed(const views::MouseEvent& mouse_event) OVERRIDE; |
36 virtual bool OnMouseDragged(const views::MouseEvent& mouse_event) OVERRIDE; | 36 virtual bool OnMouseDragged(const views::MouseEvent& mouse_event) OVERRIDE; |
37 virtual bool OnKeyPressed(const views::KeyEvent& key_event) OVERRIDE; | 37 virtual bool OnKeyPressed(const views::KeyEvent& key_event) OVERRIDE; |
38 virtual bool OnKeyReleased(const views::KeyEvent& key_event) OVERRIDE; | 38 virtual bool OnKeyReleased(const views::KeyEvent& key_event) OVERRIDE; |
39 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 39 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
40 virtual void OnFocus() OVERRIDE; | 40 virtual void OnFocus() OVERRIDE; |
41 virtual void OnBlur() OVERRIDE; | 41 virtual void OnBlur() OVERRIDE; |
42 | 42 |
43 // NativeComboboxWrapper overrides: | 43 // NativeComboboxWrapper overrides: |
44 virtual void UpdateFromModel() OVERRIDE; | 44 virtual void UpdateFromModel() OVERRIDE; |
45 virtual void UpdateSelectedItem() OVERRIDE; | 45 virtual void UpdateSelectedIndex() OVERRIDE; |
46 virtual void UpdateEnabled() OVERRIDE; | 46 virtual void UpdateEnabled() OVERRIDE; |
47 virtual int GetSelectedItem() const OVERRIDE; | 47 virtual int GetSelectedIndex() const OVERRIDE; |
48 virtual bool IsDropdownOpen() const OVERRIDE; | 48 virtual bool IsDropdownOpen() const OVERRIDE; |
49 virtual gfx::Size GetPreferredSize() OVERRIDE; | 49 virtual gfx::Size GetPreferredSize() OVERRIDE; |
50 virtual View* GetView() OVERRIDE; | 50 virtual View* GetView() OVERRIDE; |
51 virtual void SetFocus() OVERRIDE; | 51 virtual void SetFocus() OVERRIDE; |
52 virtual bool HandleKeyPressed(const views::KeyEvent& event) OVERRIDE; | 52 virtual bool HandleKeyPressed(const views::KeyEvent& event) OVERRIDE; |
53 virtual bool HandleKeyReleased(const views::KeyEvent& event) OVERRIDE; | 53 virtual bool HandleKeyReleased(const views::KeyEvent& event) OVERRIDE; |
54 virtual void HandleFocus() OVERRIDE; | 54 virtual void HandleFocus() OVERRIDE; |
55 virtual void HandleBlur() OVERRIDE; | 55 virtual void HandleBlur() OVERRIDE; |
56 virtual gfx::NativeView GetTestingHandle() const OVERRIDE; | 56 virtual gfx::NativeView GetTestingHandle() const OVERRIDE; |
57 | 57 |
(...skipping 22 matching lines...) Expand all Loading... |
80 | 80 |
81 // The disclosure arrow next to the currently selected item from the list. | 81 // The disclosure arrow next to the currently selected item from the list. |
82 const SkBitmap* disclosure_arrow_; | 82 const SkBitmap* disclosure_arrow_; |
83 | 83 |
84 // Responsible for showing the context menu. | 84 // Responsible for showing the context menu. |
85 scoped_ptr<MenuRunner> dropdown_list_menu_runner_; | 85 scoped_ptr<MenuRunner> dropdown_list_menu_runner_; |
86 | 86 |
87 // Is the drop down list showing | 87 // Is the drop down list showing |
88 bool dropdown_open_; | 88 bool dropdown_open_; |
89 | 89 |
90 // Index in the model of the selected item: -1 => none | 90 // The selected index in the model. The default value is -1, which means no |
91 int selected_item_; | 91 // selection. |
| 92 int selected_index_; |
92 | 93 |
93 // The maximum dimensions of the content in the dropdown | 94 // The maximum dimensions of the content in the dropdown |
94 int content_width_; | 95 int content_width_; |
95 int content_height_; | 96 int content_height_; |
96 | 97 |
97 DISALLOW_COPY_AND_ASSIGN(NativeComboboxViews); | 98 DISALLOW_COPY_AND_ASSIGN(NativeComboboxViews); |
98 }; | 99 }; |
99 | 100 |
100 } // namespace views | 101 } // namespace views |
101 | 102 |
102 #endif // UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_VIEWS_H_ | 103 #endif // UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_VIEWS_H_ |
OLD | NEW |