OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/browser/ui/libgtkui/native_theme_gtk2.h" | 5 #include "chrome/browser/ui/libgtkui/native_theme_gtk2.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "chrome/browser/ui/libgtkui/chrome_gtk_frame.h" | 9 #include "chrome/browser/ui/libgtkui/chrome_gtk_frame.h" |
10 #include "chrome/browser/ui/libgtkui/chrome_gtk_menu_subclasses.h" | 10 #include "chrome/browser/ui/libgtkui/chrome_gtk_menu_subclasses.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 355 |
356 case kColorId_NumColors: | 356 case kColorId_NumColors: |
357 NOTREACHED(); | 357 NOTREACHED(); |
358 break; | 358 break; |
359 } | 359 } |
360 | 360 |
361 return kInvalidColorIdColor; | 361 return kInvalidColorIdColor; |
362 } | 362 } |
363 | 363 |
364 GtkWidget* NativeThemeGtk2::GetWindow() const { | 364 GtkWidget* NativeThemeGtk2::GetWindow() const { |
365 static GtkWidget* fake_window = NULL; | 365 static GtkWidget* fake_window = nullptr; |
366 | 366 |
367 if (!fake_window) { | 367 if (!fake_window) { |
368 fake_window = chrome_gtk_frame_new(); | 368 fake_window = chrome_gtk_frame_new(); |
369 gtk_widget_realize(fake_window); | 369 gtk_widget_realize(fake_window); |
370 } | 370 } |
371 | 371 |
372 return fake_window; | 372 return fake_window; |
373 } | 373 } |
374 | 374 |
375 GtkWidget* NativeThemeGtk2::GetEntry() const { | 375 GtkWidget* NativeThemeGtk2::GetEntry() const { |
376 static GtkWidget* fake_entry = NULL; | 376 static GtkWidget* fake_entry = nullptr; |
377 | 377 |
378 if (!fake_entry) { | 378 if (!fake_entry) { |
379 fake_entry = gtk_entry_new(); | 379 fake_entry = gtk_entry_new(); |
380 | 380 |
381 // The fake entry needs to be in the window so it can be realized so we can | 381 // The fake entry needs to be in the window so it can be realized so we can |
382 // use the computed parts of the style. | 382 // use the computed parts of the style. |
383 gtk_container_add(GTK_CONTAINER(GetWindow()), fake_entry); | 383 gtk_container_add(GTK_CONTAINER(GetWindow()), fake_entry); |
384 gtk_widget_realize(fake_entry); | 384 gtk_widget_realize(fake_entry); |
385 } | 385 } |
386 | 386 |
387 return fake_entry; | 387 return fake_entry; |
388 } | 388 } |
389 | 389 |
390 GtkWidget* NativeThemeGtk2::GetLabel() const { | 390 GtkWidget* NativeThemeGtk2::GetLabel() const { |
391 static GtkWidget* fake_label = NULL; | 391 static GtkWidget* fake_label = nullptr; |
392 | 392 |
393 if (!fake_label) | 393 if (!fake_label) |
394 fake_label = gtk_label_new(""); | 394 fake_label = gtk_label_new(""); |
395 | 395 |
396 return fake_label; | 396 return fake_label; |
397 } | 397 } |
398 | 398 |
399 GtkWidget* NativeThemeGtk2::GetButton() const { | 399 GtkWidget* NativeThemeGtk2::GetButton() const { |
400 static GtkWidget* fake_button = NULL; | 400 static GtkWidget* fake_button = nullptr; |
401 | 401 |
402 if (!fake_button) | 402 if (!fake_button) |
403 fake_button = gtk_button_new(); | 403 fake_button = gtk_button_new(); |
404 | 404 |
405 return fake_button; | 405 return fake_button; |
406 } | 406 } |
407 | 407 |
408 GtkWidget* NativeThemeGtk2::GetBlueButton() const { | 408 GtkWidget* NativeThemeGtk2::GetBlueButton() const { |
409 static GtkWidget* fake_bluebutton = NULL; | 409 static GtkWidget* fake_bluebutton = nullptr; |
410 | 410 |
411 if (!fake_bluebutton) { | 411 if (!fake_bluebutton) { |
412 fake_bluebutton = gtk_button_new(); | 412 fake_bluebutton = gtk_button_new(); |
413 TurnButtonBlue(fake_bluebutton); | 413 TurnButtonBlue(fake_bluebutton); |
414 } | 414 } |
415 | 415 |
416 return fake_bluebutton; | 416 return fake_bluebutton; |
417 } | 417 } |
418 | 418 |
419 GtkWidget* NativeThemeGtk2::GetTree() const { | 419 GtkWidget* NativeThemeGtk2::GetTree() const { |
420 static GtkWidget* fake_tree = NULL; | 420 static GtkWidget* fake_tree = nullptr; |
421 | 421 |
422 if (!fake_tree) | 422 if (!fake_tree) |
423 fake_tree = gtk_tree_view_new(); | 423 fake_tree = gtk_tree_view_new(); |
424 | 424 |
425 return fake_tree; | 425 return fake_tree; |
426 } | 426 } |
427 | 427 |
428 GtkWidget* NativeThemeGtk2::GetTooltip() const { | 428 GtkWidget* NativeThemeGtk2::GetTooltip() const { |
429 static GtkWidget* fake_tooltip = NULL; | 429 static GtkWidget* fake_tooltip = nullptr; |
430 | 430 |
431 if (!fake_tooltip) { | 431 if (!fake_tooltip) { |
432 fake_tooltip = gtk_window_new(GTK_WINDOW_TOPLEVEL); | 432 fake_tooltip = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
433 gtk_widget_set_name(fake_tooltip, "gtk-tooltip"); | 433 gtk_widget_set_name(fake_tooltip, "gtk-tooltip"); |
434 gtk_widget_realize(fake_tooltip); | 434 gtk_widget_realize(fake_tooltip); |
435 } | 435 } |
436 | 436 |
437 return fake_tooltip; | 437 return fake_tooltip; |
438 } | 438 } |
439 | 439 |
440 GtkWidget* NativeThemeGtk2::GetMenu() const { | 440 GtkWidget* NativeThemeGtk2::GetMenu() const { |
441 static GtkWidget* fake_menu = NULL; | 441 static GtkWidget* fake_menu = nullptr; |
442 | 442 |
443 if (!fake_menu) | 443 if (!fake_menu) |
444 fake_menu = gtk_custom_menu_new(); | 444 fake_menu = gtk_custom_menu_new(); |
445 | 445 |
446 return fake_menu; | 446 return fake_menu; |
447 } | 447 } |
448 | 448 |
449 GtkWidget* NativeThemeGtk2::GetMenuItem() const { | 449 GtkWidget* NativeThemeGtk2::GetMenuItem() const { |
450 static GtkWidget* fake_menu_item = NULL; | 450 static GtkWidget* fake_menu_item = nullptr; |
451 | 451 |
452 if (!fake_menu_item) { | 452 if (!fake_menu_item) { |
453 fake_menu_item = gtk_custom_menu_item_new(); | 453 fake_menu_item = gtk_custom_menu_item_new(); |
454 gtk_menu_shell_append(GTK_MENU_SHELL(GetMenu()), fake_menu_item); | 454 gtk_menu_shell_append(GTK_MENU_SHELL(GetMenu()), fake_menu_item); |
455 } | 455 } |
456 | 456 |
457 return fake_menu_item; | 457 return fake_menu_item; |
458 } | 458 } |
459 | 459 |
460 GtkWidget* NativeThemeGtk2::GetSeparator() const { | 460 GtkWidget* NativeThemeGtk2::GetSeparator() const { |
461 static GtkWidget* fake_separator = NULL; | 461 static GtkWidget* fake_separator = nullptr; |
462 | 462 |
463 if (!fake_separator) | 463 if (!fake_separator) |
464 fake_separator = gtk_hseparator_new(); | 464 fake_separator = gtk_hseparator_new(); |
465 | 465 |
466 return fake_separator; | 466 return fake_separator; |
467 } | 467 } |
468 | 468 |
469 } // namespace libgtkui | 469 } // namespace libgtkui |
OLD | NEW |