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

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: Fix around selected_index_ 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 virtual void SetSelectedRow(int row) OVERRIDE; 112 virtual void SetSelectedRow(int row) OVERRIDE;
113 virtual base::string16 GetTextForRow(int row) OVERRIDE; 113 virtual base::string16 GetTextForRow(int row) OVERRIDE;
114 114
115 // Overriden from ComboboxModelObserver: 115 // Overriden from ComboboxModelObserver:
116 virtual void OnComboboxModelChanged(ui::ComboboxModel* model) OVERRIDE; 116 virtual void OnComboboxModelChanged(ui::ComboboxModel* model) OVERRIDE;
117 117
118 // Overriden from ButtonListener: 118 // Overriden from ButtonListener:
119 virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; 119 virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE;
120 120
121 private: 121 private:
122 // The sources of the clicking event of the text button.
123 enum ClickEventSource {
124 CLICK_EVENT_SOURCE_MENU_ITEM,
125 CLICK_EVENT_SOURCE_MOUSE,
126 CLICK_EVENT_SOURCE_KEYBOARD,
127 };
128
122 FRIEND_TEST_ALL_PREFIXES(ComboboxTest, Click); 129 FRIEND_TEST_ALL_PREFIXES(ComboboxTest, Click);
123 FRIEND_TEST_ALL_PREFIXES(ComboboxTest, NotifyOnClickWithMouse); 130 FRIEND_TEST_ALL_PREFIXES(ComboboxTest, NotifyOnClickWithMouse);
131 FRIEND_TEST_ALL_PREFIXES(ComboboxTest, ContentWidth);
124 132
125 // Updates the combobox's content from its model. 133 // Updates the combobox's content from its model.
126 void UpdateFromModel(); 134 void UpdateFromModel();
127 135
128 // Updates the border according to the current state. 136 // Updates the border according to the current state.
129 void UpdateBorder(); 137 void UpdateBorder();
130 138
131 // Given bounds within our View, this helper mirrors the bounds if necessary. 139 // Given bounds within our View, this helper mirrors the bounds if necessary.
132 void AdjustBoundsForRTLUI(gfx::Rect* rect) const; 140 void AdjustBoundsForRTLUI(gfx::Rect* rect) const;
133 141
134 // Draws the selected value of the drop down list 142 // Draws the selected value of the drop down list
135 void PaintText(gfx::Canvas* canvas); 143 void PaintText(gfx::Canvas* canvas);
136 144
137 // Draws the button images. 145 // Draws the button images.
138 void PaintButtons(gfx::Canvas* canvas); 146 void PaintButtons(gfx::Canvas* canvas);
139 147
140 // Show the drop down list 148 // Show the drop down list
141 void ShowDropDownMenu(ui::MenuSourceType source_type); 149 void ShowDropDownMenu(ui::MenuSourceType source_type);
142 150
143 // Called when the selection is changed by the user. 151 // Called when the selection is changed by the user.
144 void OnSelectionChanged(); 152 void OnSelectionChanged();
145 153
146 // Converts a menu command ID to a menu item index. 154 // Converts a menu command ID to a menu item index.
147 int MenuCommandToIndex(int menu_command_id) const; 155 int MenuCommandToIndex(int menu_command_id) const;
148 156
149 int GetDisclosureArrowLeftPadding() const; 157 int GetDisclosureArrowLeftPadding() const;
150 int GetDisclosureArrowRightPadding() const; 158 int GetDisclosureArrowRightPadding() const;
151 159
152 // Handles the clicking event. 160 // Handles the clicking event.
153 void HandleClickEvent(); 161 void HandleClickEvent(ClickEventSource source);
154 162
155 // Our model. Not owned. 163 // Our model. Not owned.
156 ui::ComboboxModel* model_; 164 ui::ComboboxModel* model_;
157 165
158 // The visual style of this combobox. 166 // The visual style of this combobox.
159 Style style_; 167 Style style_;
160 168
161 // Our listener. Not owned. Notified when the selected index change. 169 // Our listener. Not owned. Notified when the selected index change.
162 ComboboxListener* listener_; 170 ComboboxListener* listener_;
163 171
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // The base View takes the ownerships of these as child views. 216 // The base View takes the ownerships of these as child views.
209 CustomButton* text_button_; 217 CustomButton* text_button_;
210 CustomButton* arrow_button_; 218 CustomButton* arrow_button_;
211 219
212 DISALLOW_COPY_AND_ASSIGN(Combobox); 220 DISALLOW_COPY_AND_ASSIGN(Combobox);
213 }; 221 };
214 222
215 } // namespace views 223 } // namespace views
216 224
217 #endif // UI_VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_ 225 #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