Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: views/controls/combobox/combobox.h

Issue 8682011: views: Move combobox directory to ui/views/controls/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/focus/focus_traversal_unittest.cc ('k') | views/controls/combobox/combobox.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_COMBOBOX_H_
6 #define VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_
7 #pragma once
8
9 #include <string>
10
11 #include "ui/gfx/native_widget_types.h"
12 #include "views/controls/combobox/native_combobox_wrapper.h"
13 #include "views/view.h"
14
15 namespace ui {
16 class ComboboxModel;
17 }
18
19 namespace views {
20
21 class ComboboxListener;
22
23 // A non-editable combo-box (aka a drop-down list)
24 class VIEWS_EXPORT Combobox : public View {
25 public:
26 // The combobox's class name.
27 static const char kViewClassName[];
28
29 // |model| is not owned by the combo box.
30 explicit Combobox(ui::ComboboxModel* model);
31 virtual ~Combobox();
32
33 // Register |listener| for item change events.
34 void set_listener(ComboboxListener* listener) {
35 listener_ = listener;
36 }
37
38 // Inform the combo box that its model changed.
39 void ModelChanged();
40
41 // Gets/Sets the selected item.
42 int selected_item() const { return selected_item_; }
43 void SetSelectedItem(int index);
44
45 // Called when the combo box's selection is changed by the user.
46 void SelectionChanged();
47
48 // Accessor for |model_|.
49 ui::ComboboxModel* model() const { return model_; }
50
51 // Set the accessible name of the combo box.
52 void SetAccessibleName(const string16& name);
53
54 // Provided only for testing:
55 gfx::NativeView GetTestingHandle() const {
56 return native_wrapper_ ? native_wrapper_->GetTestingHandle() : NULL;
57 }
58 NativeComboboxWrapper* GetNativeWrapperForTesting() const {
59 return native_wrapper_;
60 }
61
62 // Overridden from View:
63 virtual gfx::Size GetPreferredSize() OVERRIDE;
64 virtual void Layout() OVERRIDE;
65 virtual void OnEnabledChanged() OVERRIDE;
66 virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& e) OVERRIDE;
67 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE;
68 virtual bool OnKeyPressed(const views::KeyEvent& e) OVERRIDE;
69 virtual bool OnKeyReleased(const views::KeyEvent& e) OVERRIDE;
70 virtual void OnFocus() OVERRIDE;
71 virtual void OnBlur() OVERRIDE;
72 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
73
74 protected:
75 // Overridden from View:
76 virtual void ViewHierarchyChanged(bool is_add,
77 View* parent,
78 View* child) OVERRIDE;
79 virtual std::string GetClassName() const OVERRIDE;
80
81 // The object that actually implements the native combobox.
82 NativeComboboxWrapper* native_wrapper_;
83
84 private:
85 // Our model.
86 ui::ComboboxModel* model_;
87
88 // The combobox's listener. Notified when the selected item change.
89 ComboboxListener* listener_;
90
91 // The current selection.
92 int selected_item_;
93
94 // The accessible name of the text field.
95 string16 accessible_name_;
96
97 DISALLOW_COPY_AND_ASSIGN(Combobox);
98 };
99
100 } // namespace views
101
102 #endif // VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_
OLDNEW
« no previous file with comments | « ui/views/focus/focus_traversal_unittest.cc ('k') | views/controls/combobox/combobox.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698