| 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> |
| 11 | 11 |
| 12 #include "app/l10n_util.h" | 12 #include "app/l10n_util.h" |
| 13 #include "app/resource_bundle.h" |
| 13 #include "base/linux_util.h" | 14 #include "base/linux_util.h" |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "grit/theme_resources.h" |
| 15 #include "third_party/skia/include/core/SkBitmap.h" | 17 #include "third_party/skia/include/core/SkBitmap.h" |
| 16 | 18 |
| 17 namespace { | 19 namespace { |
| 18 | 20 |
| 19 // Callback used in RemoveAllChildren. | 21 // Callback used in RemoveAllChildren. |
| 20 void RemoveWidget(GtkWidget* widget, gpointer container) { | 22 void RemoveWidget(GtkWidget* widget, gpointer container) { |
| 21 gtk_container_remove(GTK_CONTAINER(container), widget); | 23 gtk_container_remove(GTK_CONTAINER(container), widget); |
| 22 } | 24 } |
| 23 | 25 |
| 24 // These two functions are copped almost directly from gtk core. The only | 26 // These two functions are copped almost directly from gtk core. The only |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 // defined as widget->window coordinates for widgets that are not | 390 // defined as widget->window coordinates for widgets that are not |
| 389 // GTK_NO_WINDOW widgets, and are relative to widget->allocation.x, | 391 // GTK_NO_WINDOW widgets, and are relative to widget->allocation.x, |
| 390 // widget->allocation.y for widgets that are GTK_NO_WINDOW widgets. | 392 // widget->allocation.y for widgets that are GTK_NO_WINDOW widgets. |
| 391 // | 393 // |
| 392 // So the base is always (0,0). | 394 // So the base is always (0,0). |
| 393 gfx::Rect widget_allocation(0, 0, widget->allocation.width, | 395 gfx::Rect widget_allocation(0, 0, widget->allocation.width, |
| 394 widget->allocation.height); | 396 widget->allocation.height); |
| 395 return widget_allocation.Contains(x, y); | 397 return widget_allocation.Contains(x, y); |
| 396 } | 398 } |
| 397 | 399 |
| 400 void SetWindowIcon(GtkWindow* window) { |
| 401 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 402 GList* icon_list = NULL; |
| 403 icon_list = g_list_append(icon_list, rb.GetPixbufNamed(IDR_PRODUCT_ICON_32)); |
| 404 icon_list = g_list_append(icon_list, rb.GetPixbufNamed(IDR_PRODUCT_LOGO_16)); |
| 405 gtk_window_set_icon_list(window, icon_list); |
| 406 g_list_free(icon_list); |
| 407 } |
| 408 |
| 398 } // namespace gtk_util | 409 } // namespace gtk_util |
| OLD | NEW |