Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Side by Side Diff: chrome/browser/gtk/gtk_chrome_button.cc

Issue 67179: Have ResourceBundle own GdkPixbufs. (Closed)
Patch Set: null Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/browser/gtk/gtk_chrome_button.h" 5 #include "chrome/browser/gtk/gtk_chrome_button.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "chrome/common/resource_bundle.h" 8 #include "chrome/common/resource_bundle.h"
9 #include "chrome/browser/gtk/nine_box.h" 9 #include "chrome/browser/gtk/nine_box.h"
10 10
(...skipping 15 matching lines...) Expand all
26 GdkEventExpose *event); 26 GdkEventExpose *event);
27 27
28 static void gtk_chrome_button_class_init(GtkChromeButtonClass *button_class) { 28 static void gtk_chrome_button_class_init(GtkChromeButtonClass *button_class) {
29 GtkWidgetClass* widget_class = (GtkWidgetClass*)button_class; 29 GtkWidgetClass* widget_class = (GtkWidgetClass*)button_class;
30 widget_class->expose_event = gtk_chrome_button_expose; 30 widget_class->expose_event = gtk_chrome_button_expose;
31 31
32 GdkPixbuf* images[9]; 32 GdkPixbuf* images[9];
33 int i = 0; 33 int i = 0;
34 34
35 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 35 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
36 images[i++] = rb.LoadPixbuf(IDR_TEXTBUTTON_TOP_LEFT_H); 36 images[i++] = rb.GetPixbufNamed(IDR_TEXTBUTTON_TOP_LEFT_H);
37 images[i++] = rb.LoadPixbuf(IDR_TEXTBUTTON_TOP_H); 37 images[i++] = rb.GetPixbufNamed(IDR_TEXTBUTTON_TOP_H);
38 images[i++] = rb.LoadPixbuf(IDR_TEXTBUTTON_TOP_RIGHT_H); 38 images[i++] = rb.GetPixbufNamed(IDR_TEXTBUTTON_TOP_RIGHT_H);
39 images[i++] = rb.LoadPixbuf(IDR_TEXTBUTTON_LEFT_H); 39 images[i++] = rb.GetPixbufNamed(IDR_TEXTBUTTON_LEFT_H);
40 images[i++] = rb.LoadPixbuf(IDR_TEXTBUTTON_CENTER_H); 40 images[i++] = rb.GetPixbufNamed(IDR_TEXTBUTTON_CENTER_H);
41 images[i++] = rb.LoadPixbuf(IDR_TEXTBUTTON_RIGHT_H); 41 images[i++] = rb.GetPixbufNamed(IDR_TEXTBUTTON_RIGHT_H);
42 images[i++] = rb.LoadPixbuf(IDR_TEXTBUTTON_BOTTOM_LEFT_H); 42 images[i++] = rb.GetPixbufNamed(IDR_TEXTBUTTON_BOTTOM_LEFT_H);
43 images[i++] = rb.LoadPixbuf(IDR_TEXTBUTTON_BOTTOM_H); 43 images[i++] = rb.GetPixbufNamed(IDR_TEXTBUTTON_BOTTOM_H);
44 images[i++] = rb.LoadPixbuf(IDR_TEXTBUTTON_BOTTOM_RIGHT_H); 44 images[i++] = rb.GetPixbufNamed(IDR_TEXTBUTTON_BOTTOM_RIGHT_H);
45 nine_box_prelight.reset(new NineBox(images)); 45 nine_box_prelight.reset(new NineBox(images));
46 46
47 i = 0; 47 i = 0;
48 images[i++] = rb.LoadPixbuf(IDR_TEXTBUTTON_TOP_LEFT_P); 48 images[i++] = rb.GetPixbufNamed(IDR_TEXTBUTTON_TOP_LEFT_P);
49 images[i++] = rb.LoadPixbuf(IDR_TEXTBUTTON_TOP_P); 49 images[i++] = rb.GetPixbufNamed(IDR_TEXTBUTTON_TOP_P);
50 images[i++] = rb.LoadPixbuf(IDR_TEXTBUTTON_TOP_RIGHT_P); 50 images[i++] = rb.GetPixbufNamed(IDR_TEXTBUTTON_TOP_RIGHT_P);
51 images[i++] = rb.LoadPixbuf(IDR_TEXTBUTTON_LEFT_P); 51 images[i++] = rb.GetPixbufNamed(IDR_TEXTBUTTON_LEFT_P);
52 images[i++] = rb.LoadPixbuf(IDR_TEXTBUTTON_CENTER_P); 52 images[i++] = rb.GetPixbufNamed(IDR_TEXTBUTTON_CENTER_P);
53 images[i++] = rb.LoadPixbuf(IDR_TEXTBUTTON_RIGHT_P); 53 images[i++] = rb.GetPixbufNamed(IDR_TEXTBUTTON_RIGHT_P);
54 images[i++] = rb.LoadPixbuf(IDR_TEXTBUTTON_BOTTOM_LEFT_P); 54 images[i++] = rb.GetPixbufNamed(IDR_TEXTBUTTON_BOTTOM_LEFT_P);
55 images[i++] = rb.LoadPixbuf(IDR_TEXTBUTTON_BOTTOM_P); 55 images[i++] = rb.GetPixbufNamed(IDR_TEXTBUTTON_BOTTOM_P);
56 images[i++] = rb.LoadPixbuf(IDR_TEXTBUTTON_BOTTOM_RIGHT_P); 56 images[i++] = rb.GetPixbufNamed(IDR_TEXTBUTTON_BOTTOM_RIGHT_P);
57 nine_box_active.reset(new NineBox(images)); 57 nine_box_active.reset(new NineBox(images));
58 } 58 }
59 59
60 static void gtk_chrome_button_init(GtkChromeButton* button) { 60 static void gtk_chrome_button_init(GtkChromeButton* button) {
61 gtk_widget_set_app_paintable(GTK_WIDGET(button), TRUE); 61 gtk_widget_set_app_paintable(GTK_WIDGET(button), TRUE);
62 } 62 }
63 63
64 static gboolean gtk_chrome_button_expose (GtkWidget *widget, 64 static gboolean gtk_chrome_button_expose (GtkWidget *widget,
65 GdkEventExpose *event) { 65 GdkEventExpose *event) {
66 NineBox* nine_box = NULL; 66 NineBox* nine_box = NULL;
(...skipping 12 matching lines...) Expand all
79 79
80 return FALSE; 80 return FALSE;
81 } 81 }
82 82
83 GtkWidget* gtk_chrome_button_new(void) { 83 GtkWidget* gtk_chrome_button_new(void) {
84 return GTK_WIDGET(g_object_new(GTK_TYPE_CHROME_BUTTON, NULL)); 84 return GTK_WIDGET(g_object_new(GTK_TYPE_CHROME_BUTTON, NULL));
85 } 85 }
86 86
87 G_END_DECLS 87 G_END_DECLS
88 88
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698