summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-25 20:29:03 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-25 20:29:03 +0000
commit798ae67e6e6efd131c91974d1819c4ca2f30c563 (patch)
tree25ec0e262cb0db6c03c709daae8932860cbbd18d /ui
parenta051a469ec2b22b7786cc98e77bd59a2fbf73aae (diff)
downloadchromium_src-798ae67e6e6efd131c91974d1819c4ca2f30c563.zip
chromium_src-798ae67e6e6efd131c91974d1819c4ca2f30c563.tar.gz
chromium_src-798ae67e6e6efd131c91974d1819c4ca2f30c563.tar.bz2
content: Start splitting up chrome/browser/ui/gtk/gtk_util.h
This yak needs shaving because chunks of gtk using code in chrome/ are being moved to content/ to build the content_shell, but we can't depend on code in chrome/. While I'm here, split gtk_util.h into a set of logical chunks: hig constants, widget factory functions, etc instead of just moving the file. BUG=93804 TEST=none; code move Review URL: http://codereview.chromium.org/7737001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98287 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/base/gtk/gtk_hig_constants.cc16
-rw-r--r--ui/base/gtk/gtk_hig_constants.h58
-rw-r--r--ui/ui.gyp2
3 files changed, 76 insertions, 0 deletions
diff --git a/ui/base/gtk/gtk_hig_constants.cc b/ui/base/gtk/gtk_hig_constants.cc
new file mode 100644
index 0000000..f9d0280c
--- /dev/null
+++ b/ui/base/gtk/gtk_hig_constants.cc
@@ -0,0 +1,16 @@
+// Copyright (c) 2011 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 "ui/base/gtk/gtk_hig_constants.h"
+
+#include <gdk/gdk.h>
+
+namespace ui {
+
+const GdkColor kGdkWhite = GDK_COLOR_RGB(0xff, 0xff, 0xff);
+const GdkColor kGdkGray = GDK_COLOR_RGB(0x7f, 0x7f, 0x7f);
+const GdkColor kGdkBlack = GDK_COLOR_RGB(0x00, 0x00, 0x00);
+const GdkColor kGdkGreen = GDK_COLOR_RGB(0x00, 0xff, 0x00);
+
+} // namespace ui
diff --git a/ui/base/gtk/gtk_hig_constants.h b/ui/base/gtk/gtk_hig_constants.h
new file mode 100644
index 0000000..d868b2a
--- /dev/null
+++ b/ui/base/gtk/gtk_hig_constants.h
@@ -0,0 +1,58 @@
+// Copyright (c) 2011 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.
+//
+// A list of constants that are used in setting up GTK widgets.
+//
+// This contains named color constants, along with spacing constants from the
+// GNOME Human Interface Guide.
+
+#ifndef UI_BASE_GTK_GTK_HIG_CONSTANTS_H_
+#define UI_BASE_GTK_GTK_HIG_CONSTANTS_H_
+#pragma once
+
+#include "ui/base/ui_export.h"
+
+typedef struct _GdkColor GdkColor;
+
+namespace ui {
+
+// Multiply uint8 color components by this.
+const int kSkiaToGDKMultiplier = 257;
+
+// Named color constants.
+UI_EXPORT extern const GdkColor kGdkWhite;
+UI_EXPORT extern const GdkColor kGdkGray;
+UI_EXPORT extern const GdkColor kGdkBlack;
+UI_EXPORT extern const GdkColor kGdkGreen;
+
+// Constants relating to the layout of dialog windows:
+// (See http://library.gnome.org/devel/hig-book/stable/design-window.html.en)
+
+// Spacing between controls of the same group.
+const int kControlSpacing = 6;
+
+// Horizontal spacing between a label and its control.
+const int kLabelSpacing = 12;
+
+// Indent of the controls within each group.
+const int kGroupIndent = 12;
+
+// Space around the outside of a dialog's contents.
+const int kContentAreaBorder = 12;
+
+// Spacing between groups of controls.
+const int kContentAreaSpacing = 18;
+
+// Horizontal Spacing between controls in a form.
+const int kFormControlSpacing = 10;
+
+} // namespace ui
+
+// Define a macro for creating GdkColors from RGB values. This is a macro to
+// allow static construction of literals, etc. Use this like:
+// GdkColor white = GDK_COLOR_RGB(0xff, 0xff, 0xff);
+#define GDK_COLOR_RGB(r, g, b) {0, r * ::ui::kSkiaToGDKMultiplier, \
+ g * ::ui::kSkiaToGDKMultiplier, b * ::ui::kSkiaToGDKMultiplier}
+
+#endif // UI_BASE_GTK_GTK_HIG_CONSTANTS_H_
diff --git a/ui/ui.gyp b/ui/ui.gyp
index 3f5a2fe..ed5f16de 100644
--- a/ui/ui.gyp
+++ b/ui/ui.gyp
@@ -112,6 +112,8 @@
'base/gtk/gtk_floating_container.h',
'base/gtk/gtk_im_context_util.cc',
'base/gtk/gtk_im_context_util.h',
+ 'base/gtk/gtk_hig_constants.cc',
+ 'base/gtk/gtk_hig_constants.h',
'base/gtk/gtk_signal.h',
'base/gtk/gtk_signal_registrar.cc',
'base/gtk/gtk_signal_registrar.h',