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

Side by Side Diff: chrome/browser/ui/gtk/gtk_util.cc

Issue 7779040: Start moving code from BrowserMain to content, so that it can be reused by all embedders of conte... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix windows unittest Created 9 years, 3 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/gtk/gtk_util.h" 5 #include "chrome/browser/ui/gtk/gtk_util.h"
6 6
7 #include <cairo/cairo.h> 7 #include <cairo/cairo.h>
8 #include <gdk/gdkx.h> 8 #include <gdk/gdkx.h>
9 #include <gtk/gtk.h> 9 #include <gtk/gtk.h>
10 10
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 } 489 }
490 490
491 void ConvertWidgetPointToScreen(GtkWidget* widget, gfx::Point* p) { 491 void ConvertWidgetPointToScreen(GtkWidget* widget, gfx::Point* p) {
492 DCHECK(widget); 492 DCHECK(widget);
493 DCHECK(p); 493 DCHECK(p);
494 494
495 gfx::Point position = GetWidgetScreenPosition(widget); 495 gfx::Point position = GetWidgetScreenPosition(widget);
496 p->SetPoint(p->x() + position.x(), p->y() + position.y()); 496 p->SetPoint(p->x() + position.x(), p->y() + position.y());
497 } 497 }
498 498
499 void InitRCStyles() {
500 static const char kRCText[] =
501 // Make our dialogs styled like the GNOME HIG.
502 //
503 // TODO(evanm): content-area-spacing was introduced in a later
504 // version of GTK, so we need to set that manually on all dialogs.
505 // Perhaps it would make sense to have a shared FixupDialog() function.
506 "style \"gnome-dialog\" {\n"
507 " xthickness = 12\n"
508 " GtkDialog::action-area-border = 0\n"
509 " GtkDialog::button-spacing = 6\n"
510 " GtkDialog::content-area-spacing = 18\n"
511 " GtkDialog::content-area-border = 12\n"
512 "}\n"
513 // Note we set it at the "application" priority, so users can override.
514 "widget \"GtkDialog\" style : application \"gnome-dialog\"\n"
515
516 // Make our about dialog special, so the image is flush with the edge.
517 "style \"about-dialog\" {\n"
518 " GtkDialog::action-area-border = 12\n"
519 " GtkDialog::button-spacing = 6\n"
520 " GtkDialog::content-area-spacing = 18\n"
521 " GtkDialog::content-area-border = 0\n"
522 "}\n"
523 "widget \"about-dialog\" style : application \"about-dialog\"\n";
524
525 gtk_rc_parse_string(kRCText);
526 }
527
528 GtkWidget* CenterWidgetInHBox(GtkWidget* hbox, GtkWidget* widget, 499 GtkWidget* CenterWidgetInHBox(GtkWidget* hbox, GtkWidget* widget,
529 bool pack_at_end, int padding) { 500 bool pack_at_end, int padding) {
530 GtkWidget* centering_vbox = gtk_vbox_new(FALSE, 0); 501 GtkWidget* centering_vbox = gtk_vbox_new(FALSE, 0);
531 gtk_box_pack_start(GTK_BOX(centering_vbox), widget, TRUE, FALSE, 0); 502 gtk_box_pack_start(GTK_BOX(centering_vbox), widget, TRUE, FALSE, 0);
532 if (pack_at_end) 503 if (pack_at_end)
533 gtk_box_pack_end(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, padding); 504 gtk_box_pack_end(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, padding);
534 else 505 else
535 gtk_box_pack_start(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, padding); 506 gtk_box_pack_start(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, padding);
536 507
537 return centering_vbox; 508 return centering_vbox;
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 1237
1267 void DoCopy(BrowserWindow* window) { 1238 void DoCopy(BrowserWindow* window) {
1268 DoCutCopyPaste(window, &RenderViewHost::Copy, "copy-clipboard"); 1239 DoCutCopyPaste(window, &RenderViewHost::Copy, "copy-clipboard");
1269 } 1240 }
1270 1241
1271 void DoPaste(BrowserWindow* window) { 1242 void DoPaste(BrowserWindow* window) {
1272 DoCutCopyPaste(window, &RenderViewHost::Paste, "paste-clipboard"); 1243 DoCutCopyPaste(window, &RenderViewHost::Paste, "paste-clipboard");
1273 } 1244 }
1274 1245
1275 } // namespace gtk_util 1246 } // namespace gtk_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698