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

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

Issue 141523005: Combobox: Rename styles to STYLE_NORMAL and STYLE_ACTION and modify behaviors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment and test Created 6 years, 11 months 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
OLDNEW
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_COMBOBOX_H_ 5 #ifndef UI_VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_
6 #define UI_VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_ 6 #define UI_VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 21 matching lines...) Expand all
32 class FocusableBorder; 32 class FocusableBorder;
33 class MenuRunner; 33 class MenuRunner;
34 class MenuRunnerHandler; 34 class MenuRunnerHandler;
35 class Painter; 35 class Painter;
36 class PrefixSelector; 36 class PrefixSelector;
37 37
38 // A non-editable combobox (aka a drop-down list or selector). 38 // A non-editable combobox (aka a drop-down list or selector).
39 // Combobox has two distinct parts, the drop down arrow and the text. When the 39 // Combobox has two distinct parts, the drop down arrow and the text. When the
40 // user clicks on the text the drop down is either shown 40 // user clicks on the text the drop down is either shown
41 // (STYLE_SHOW_DROP_DOWN_ON_CLICK) or the listener is notified 41 // (STYLE_SHOW_DROP_DOWN_ON_CLICK) or the listener is notified
42 // (STYLE_NOTIFY_ON_CLICK). 42 // (STYLE_NOTIFY_ON_CLICK). When using STYLE_NOTIFY_ON_CLICK, the listener is
sky 2014/01/22 16:04:07 Sorry, this comment doesn't really help. Nuke it.
43 // notified even when the user clicks a menu item.
43 class VIEWS_EXPORT Combobox : public MenuDelegate, 44 class VIEWS_EXPORT Combobox : public MenuDelegate,
44 public PrefixDelegate, 45 public PrefixDelegate,
45 public ui::ComboboxModelObserver, 46 public ui::ComboboxModelObserver,
46 public ButtonListener { 47 public ButtonListener {
47 public: 48 public:
48 // The style of the combobox. 49 // The style of the combobox.
49 enum Style { 50 enum Style {
50 STYLE_SHOW_DROP_DOWN_ON_CLICK, 51 STYLE_SHOW_DROP_DOWN_ON_CLICK,
51 STYLE_NOTIFY_ON_CLICK, 52 STYLE_NOTIFY_ON_CLICK,
52 }; 53 };
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 115
115 // Overriden from ComboboxModelObserver: 116 // Overriden from ComboboxModelObserver:
116 virtual void OnComboboxModelChanged(ui::ComboboxModel* model) OVERRIDE; 117 virtual void OnComboboxModelChanged(ui::ComboboxModel* model) OVERRIDE;
117 118
118 // Overriden from ButtonListener: 119 // Overriden from ButtonListener:
119 virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; 120 virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE;
120 121
121 private: 122 private:
122 FRIEND_TEST_ALL_PREFIXES(ComboboxTest, Click); 123 FRIEND_TEST_ALL_PREFIXES(ComboboxTest, Click);
123 FRIEND_TEST_ALL_PREFIXES(ComboboxTest, NotifyOnClickWithMouse); 124 FRIEND_TEST_ALL_PREFIXES(ComboboxTest, NotifyOnClickWithMouse);
125 FRIEND_TEST_ALL_PREFIXES(ComboboxTest, ContentWidth);
124 126
125 // Updates the combobox's content from its model. 127 // Updates the combobox's content from its model.
126 void UpdateFromModel(); 128 void UpdateFromModel();
127 129
128 // Updates the border according to the current state. 130 // Updates the border according to the current state.
129 void UpdateBorder(); 131 void UpdateBorder();
130 132
131 // Given bounds within our View, this helper mirrors the bounds if necessary. 133 // Given bounds within our View, this helper mirrors the bounds if necessary.
132 void AdjustBoundsForRTLUI(gfx::Rect* rect) const; 134 void AdjustBoundsForRTLUI(gfx::Rect* rect) const;
133 135
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // The base View takes the ownerships of these as child views. 210 // The base View takes the ownerships of these as child views.
209 CustomButton* text_button_; 211 CustomButton* text_button_;
210 CustomButton* arrow_button_; 212 CustomButton* arrow_button_;
211 213
212 DISALLOW_COPY_AND_ASSIGN(Combobox); 214 DISALLOW_COPY_AND_ASSIGN(Combobox);
213 }; 215 };
214 216
215 } // namespace views 217 } // namespace views
216 218
217 #endif // UI_VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_ 219 #endif // UI_VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/combobox/combobox.cc » ('j') | ui/views/controls/combobox/combobox.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698