| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/common/gtk_util.h" | 5 #include "chrome/common/gtk_util.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 #include <gdk/gdkx.h> | 8 #include <gdk/gdkx.h> |
| 9 | 9 |
| 10 #include <cstdarg> | 10 #include <cstdarg> |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 GtkWidget* centering_vbox = gtk_vbox_new(FALSE, 0); | 260 GtkWidget* centering_vbox = gtk_vbox_new(FALSE, 0); |
| 261 gtk_box_pack_start(GTK_BOX(centering_vbox), widget, TRUE, FALSE, 0); | 261 gtk_box_pack_start(GTK_BOX(centering_vbox), widget, TRUE, FALSE, 0); |
| 262 if (pack_at_end) | 262 if (pack_at_end) |
| 263 gtk_box_pack_end(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, padding); | 263 gtk_box_pack_end(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, padding); |
| 264 else | 264 else |
| 265 gtk_box_pack_start(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, padding); | 265 gtk_box_pack_start(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, padding); |
| 266 } | 266 } |
| 267 | 267 |
| 268 std::string ConvertAcceleratorsFromWindowsStyle(const std::string& label) { | 268 std::string ConvertAcceleratorsFromWindowsStyle(const std::string& label) { |
| 269 std::string ret; | 269 std::string ret; |
| 270 ret.reserve(label.length()); | 270 ret.reserve(label.length() * 2); |
| 271 for (size_t i = 0; i < label.length(); ++i) { | 271 for (size_t i = 0; i < label.length(); ++i) { |
| 272 if ('&' == label[i]) { | 272 if ('_' == label[i]) { |
| 273 ret.push_back('_'); |
| 274 ret.push_back('_'); |
| 275 } else if ('&' == label[i]) { |
| 273 if (i + 1 < label.length() && '&' == label[i + 1]) { | 276 if (i + 1 < label.length() && '&' == label[i + 1]) { |
| 274 ret.push_back(label[i]); | 277 ret.push_back(label[i]); |
| 275 ++i; | 278 ++i; |
| 276 } else { | 279 } else { |
| 277 ret.push_back('_'); | 280 ret.push_back('_'); |
| 278 } | 281 } |
| 279 } else { | 282 } else { |
| 280 ret.push_back(label[i]); | 283 ret.push_back(label[i]); |
| 281 } | 284 } |
| 282 } | 285 } |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 } | 532 } |
| 530 #endif | 533 #endif |
| 531 } | 534 } |
| 532 | 535 |
| 533 GdkCursor* GetCursor(GdkCursorType type) { | 536 GdkCursor* GetCursor(GdkCursorType type) { |
| 534 static GdkCursorCache impl; | 537 static GdkCursorCache impl; |
| 535 return impl.GetCursorImpl(type); | 538 return impl.GetCursorImpl(type); |
| 536 } | 539 } |
| 537 | 540 |
| 538 } // namespace gtk_util | 541 } // namespace gtk_util |
| OLD | NEW |