OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "views/controls/menu/native_menu_gtk.h" | 5 #include "views/controls/menu/native_menu_gtk.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 for (std::vector<MenuListener*>::iterator iter = listeners_.begin(); | 188 for (std::vector<MenuListener*>::iterator iter = listeners_.begin(); |
189 iter != listeners_.end(); | 189 iter != listeners_.end(); |
190 ++iter) { | 190 ++iter) { |
191 if (*iter == listener) { | 191 if (*iter == listener) { |
192 listeners_.erase(iter); | 192 listeners_.erase(iter); |
193 return; | 193 return; |
194 } | 194 } |
195 } | 195 } |
196 } | 196 } |
197 | 197 |
| 198 void NativeMenuGtk::SetMinimumWidth(int width) { |
| 199 gtk_widget_set_size_request(menu_, width, -1); |
| 200 } |
| 201 |
198 bool NativeMenuGtk::Dispatch(GdkEvent* event) { | 202 bool NativeMenuGtk::Dispatch(GdkEvent* event) { |
199 if (menu_hidden_) { | 203 if (menu_hidden_) { |
200 // The menu has been closed but the message loop is still nested. Don't | 204 // The menu has been closed but the message loop is still nested. Don't |
201 // dispatch a message, otherwise we might spawn another message loop. | 205 // dispatch a message, otherwise we might spawn another message loop. |
202 return false; // Exits the nested message loop. | 206 return false; // Exits the nested message loop. |
203 } | 207 } |
204 switch (event->type) { | 208 switch (event->type) { |
205 case GDK_BUTTON_PRESS: | 209 case GDK_BUTTON_PRESS: |
206 case GDK_2BUTTON_PRESS: | 210 case GDK_2BUTTON_PRESS: |
207 case GDK_3BUTTON_PRESS: { | 211 case GDK_3BUTTON_PRESS: { |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 | 497 |
494 //////////////////////////////////////////////////////////////////////////////// | 498 //////////////////////////////////////////////////////////////////////////////// |
495 // MenuWrapper, public: | 499 // MenuWrapper, public: |
496 | 500 |
497 // static | 501 // static |
498 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { | 502 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { |
499 return new NativeMenuGtk(menu); | 503 return new NativeMenuGtk(menu); |
500 } | 504 } |
501 | 505 |
502 } // namespace views | 506 } // namespace views |
OLD | NEW |