 Chromium Code Reviews
 Chromium Code Reviews 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
    
  
    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| 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_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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 explicit Combobox(ui::ComboboxModel* model); | 58 explicit Combobox(ui::ComboboxModel* model); | 
| 59 virtual ~Combobox(); | 59 virtual ~Combobox(); | 
| 60 | 60 | 
| 61 static const gfx::FontList& GetFontList(); | 61 static const gfx::FontList& GetFontList(); | 
| 62 | 62 | 
| 63 // Sets the listener which will be called when a selection has been made. | 63 // Sets the listener which will be called when a selection has been made. | 
| 64 void set_listener(ComboboxListener* listener) { listener_ = listener; } | 64 void set_listener(ComboboxListener* listener) { listener_ = listener; } | 
| 65 | 65 | 
| 66 void SetStyle(Style style); | 66 void SetStyle(Style style); | 
| 67 | 67 | 
| 68 void SetMenuItemRaisesClickEvent(bool value); | |
| 69 | |
| 68 // Informs the combobox that its model changed. | 70 // Informs the combobox that its model changed. | 
| 69 void ModelChanged(); | 71 void ModelChanged(); | 
| 70 | 72 | 
| 71 // Gets/Sets the selected index. | 73 // Gets/Sets the selected index. | 
| 72 int selected_index() const { return selected_index_; } | 74 int selected_index() const { return selected_index_; } | 
| 73 void SetSelectedIndex(int index); | 75 void SetSelectedIndex(int index); | 
| 74 | 76 | 
| 75 // Looks for the first occurrence of |value| in |model()|. If found, selects | 77 // Looks for the first occurrence of |value| in |model()|. If found, selects | 
| 76 // the found index and returns true. Otherwise simply noops and returns false. | 78 // the found index and returns true. Otherwise simply noops and returns false. | 
| 77 bool SelectValue(const base::string16& value); | 79 bool SelectValue(const base::string16& value); | 
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 | 153 | 
| 152 // Handles the clicking event. | 154 // Handles the clicking event. | 
| 153 void HandleClickEvent(); | 155 void HandleClickEvent(); | 
| 154 | 156 | 
| 155 // Our model. Not owned. | 157 // Our model. Not owned. | 
| 156 ui::ComboboxModel* model_; | 158 ui::ComboboxModel* model_; | 
| 157 | 159 | 
| 158 // The visual style of this combobox. | 160 // The visual style of this combobox. | 
| 159 Style style_; | 161 Style style_; | 
| 160 | 162 | 
| 163 // Whether clicking a menu item raises a click event. When |style_| is not | |
| 164 // STYLE_NOTIFY_ON_CLICK, this is ignored. | |
| 
sky
2014/01/17 16:01:55
AFAIK you are the only using STYLE_NOTIFY_ON_CLICK
 
hajimehoshi
2014/01/20 03:06:14
Done.
 | |
| 165 bool menu_item_raises_click_event_; | |
| 166 | |
| 161 // Our listener. Not owned. Notified when the selected index change. | 167 // Our listener. Not owned. Notified when the selected index change. | 
| 162 ComboboxListener* listener_; | 168 ComboboxListener* listener_; | 
| 163 | 169 | 
| 164 // The current selected index; -1 and means no selection. | 170 // The current selected index; -1 and means no selection. | 
| 165 int selected_index_; | 171 int selected_index_; | 
| 166 | 172 | 
| 167 // True when the selection is visually denoted as invalid. | 173 // True when the selection is visually denoted as invalid. | 
| 168 bool invalid_; | 174 bool invalid_; | 
| 169 | 175 | 
| 170 // The accessible name of this combobox. | 176 // The accessible name of this combobox. | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 // The base View takes the ownerships of these as child views. | 214 // The base View takes the ownerships of these as child views. | 
| 209 CustomButton* text_button_; | 215 CustomButton* text_button_; | 
| 210 CustomButton* arrow_button_; | 216 CustomButton* arrow_button_; | 
| 211 | 217 | 
| 212 DISALLOW_COPY_AND_ASSIGN(Combobox); | 218 DISALLOW_COPY_AND_ASSIGN(Combobox); | 
| 213 }; | 219 }; | 
| 214 | 220 | 
| 215 } // namespace views | 221 } // namespace views | 
| 216 | 222 | 
| 217 #endif // UI_VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_ | 223 #endif // UI_VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_ | 
| OLD | NEW |