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

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

Issue 150078: GTK custom frame: Don't show the border when maximized. Enlarge the close but... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: now with bidi support Created 11 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/gtk/browser_window_gtk.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/custom_button.h" 5 #include "chrome/browser/gtk/custom_button.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 10
(...skipping 27 matching lines...) Expand all
38 38
39 // Fall back to the default image if we don't have one for this state. 39 // Fall back to the default image if we don't have one for this state.
40 if (!pixbuf) 40 if (!pixbuf)
41 pixbuf = pixbufs_[GTK_STATE_NORMAL]; 41 pixbuf = pixbufs_[GTK_STATE_NORMAL];
42 42
43 if (!pixbuf) 43 if (!pixbuf)
44 return FALSE; 44 return FALSE;
45 45
46 cairo_t* cairo_context = gdk_cairo_create(GDK_DRAWABLE(widget->window)); 46 cairo_t* cairo_context = gdk_cairo_create(GDK_DRAWABLE(widget->window));
47 cairo_translate(cairo_context, widget->allocation.x, widget->allocation.y); 47 cairo_translate(cairo_context, widget->allocation.x, widget->allocation.y);
48 gdk_cairo_set_source_pixbuf(cairo_context, pixbuf, 0, 0); 48
49 // The widget might be larger than the pixbuf. Paint the pixbuf flush with the
50 // start of the widget (left for LTR, right for RTL).
51 int pixbuf_width = gdk_pixbuf_get_width(pixbuf);
52 int widget_width = widget->allocation.width;
53 int x = gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL ?
54 widget_width - pixbuf_width : 0;
55
56 gdk_cairo_set_source_pixbuf(cairo_context, pixbuf, x, 0);
49 cairo_paint(cairo_context); 57 cairo_paint(cairo_context);
50 cairo_destroy(cairo_context); 58 cairo_destroy(cairo_context);
51 59
52 return TRUE; 60 return TRUE;
53 } 61 }
54 62
55 CustomDrawButton::CustomDrawButton( 63 CustomDrawButton::CustomDrawButton(
56 int normal_id, 64 int normal_id,
57 int active_id, 65 int active_id,
58 int highlight_id, 66 int highlight_id,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 GdkEventExpose* e, 99 GdkEventExpose* e,
92 CustomDrawButton* button) { 100 CustomDrawButton* button) {
93 return button->button_base_.OnExpose(widget, e); 101 return button->button_base_.OnExpose(widget, e);
94 } 102 }
95 103
96 // static 104 // static
97 CustomDrawButton* CustomDrawButton::CloseButton() { 105 CustomDrawButton* CustomDrawButton::CloseButton() {
98 return new CustomDrawButton(IDR_CLOSE_BAR, IDR_CLOSE_BAR_P, 106 return new CustomDrawButton(IDR_CLOSE_BAR, IDR_CLOSE_BAR_P,
99 IDR_CLOSE_BAR_H, 0); 107 IDR_CLOSE_BAR_H, 0);
100 } 108 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/browser_window_gtk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698