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

Side by Side Diff: chrome/browser/gtk/options/options_layout_gtk.cc

Issue 113967: Add general options page. Options are working with the following exceptions: (Closed)
Patch Set: Created 11 years, 7 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
(Empty)
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/gtk/options/options_layout_gtk.h"
6
7 namespace {
8
9 // Style for option group titles
10 const char kGroupTitleMarkup[] =
11 "<span weight='bold'>%s</span>";
12
13 // Space around the outsides of the page
14 const int kBorderSize = 12;
15
16 // Indent of the options within each group
17 const int kOptionsIndent = 12;
18
19 // Spacing between options of the same group
20 const int kOptionSpacing = 6;
21
22 // Spacing between groups
23 const int kGroupSpacing = 18;
24
25 }
26
27 OptionsLayoutBuilderGtk::OptionsLayoutBuilderGtk(int num_rows) {
28 page_ = gtk_vbox_new(FALSE, kGroupSpacing);
29 gtk_container_set_border_width(GTK_CONTAINER(page_), kBorderSize);
30 }
31
32 void OptionsLayoutBuilderGtk::AddOptionGroup(const std::string& title,
33 GtkWidget* content) {
34 GtkWidget* title_label = gtk_label_new(NULL);
35 char* markup = g_markup_printf_escaped(kGroupTitleMarkup,
36 title.c_str());
37 gtk_label_set_markup(GTK_LABEL(title_label), markup);
38 g_free(markup);
39
40 GtkWidget* title_alignment = gtk_alignment_new(0.0, 0.5, 0.0, 0.0);
41 gtk_container_add(GTK_CONTAINER(title_alignment), title_label);
42
43 GtkWidget* content_alignment = gtk_alignment_new(0.0, 0.5, 1.0, 1.0);
44 gtk_alignment_set_padding(GTK_ALIGNMENT(content_alignment), 0, 0,
45 kOptionsIndent, 0);
46 gtk_container_add(GTK_CONTAINER(content_alignment), content);
47
48 GtkWidget* group = gtk_vbox_new(FALSE, kOptionSpacing);
49 gtk_container_add(GTK_CONTAINER(group), title_alignment);
50 gtk_container_add(GTK_CONTAINER(group), content_alignment);
51
52 gtk_box_pack_start(GTK_BOX(page_), group, FALSE, FALSE, 0);
53 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/options/options_layout_gtk.h ('k') | chrome/browser/gtk/options/options_window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698