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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/options/options_layout_gtk.cc
diff --git a/chrome/browser/gtk/options/options_layout_gtk.cc b/chrome/browser/gtk/options/options_layout_gtk.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e55f47cc4b12b52e861481e8f692fb6c23553fb7
--- /dev/null
+++ b/chrome/browser/gtk/options/options_layout_gtk.cc
@@ -0,0 +1,53 @@
+// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/gtk/options/options_layout_gtk.h"
+
+namespace {
+
+// Style for option group titles
+const char kGroupTitleMarkup[] =
+ "<span weight='bold'>%s</span>";
+
+// Space around the outsides of the page
+const int kBorderSize = 12;
+
+// Indent of the options within each group
+const int kOptionsIndent = 12;
+
+// Spacing between options of the same group
+const int kOptionSpacing = 6;
+
+// Spacing between groups
+const int kGroupSpacing = 18;
+
+}
+
+OptionsLayoutBuilderGtk::OptionsLayoutBuilderGtk(int num_rows) {
+ page_ = gtk_vbox_new(FALSE, kGroupSpacing);
+ gtk_container_set_border_width(GTK_CONTAINER(page_), kBorderSize);
+}
+
+void OptionsLayoutBuilderGtk::AddOptionGroup(const std::string& title,
+ GtkWidget* content) {
+ GtkWidget* title_label = gtk_label_new(NULL);
+ char* markup = g_markup_printf_escaped(kGroupTitleMarkup,
+ title.c_str());
+ gtk_label_set_markup(GTK_LABEL(title_label), markup);
+ g_free(markup);
+
+ GtkWidget* title_alignment = gtk_alignment_new(0.0, 0.5, 0.0, 0.0);
+ gtk_container_add(GTK_CONTAINER(title_alignment), title_label);
+
+ GtkWidget* content_alignment = gtk_alignment_new(0.0, 0.5, 1.0, 1.0);
+ gtk_alignment_set_padding(GTK_ALIGNMENT(content_alignment), 0, 0,
+ kOptionsIndent, 0);
+ gtk_container_add(GTK_CONTAINER(content_alignment), content);
+
+ GtkWidget* group = gtk_vbox_new(FALSE, kOptionSpacing);
+ gtk_container_add(GTK_CONTAINER(group), title_alignment);
+ gtk_container_add(GTK_CONTAINER(group), content_alignment);
+
+ gtk_box_pack_start(GTK_BOX(page_), group, FALSE, FALSE, 0);
+}
« 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