summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authordeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-13 17:50:34 +0000
committerdeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-13 17:50:34 +0000
commit08fb74a9f12f59c531cc5d7acdb0afea183dba12 (patch)
tree78eb1b586a658ac8433c2972a518748ad9ce47dc /base
parent4a3cb4ea699653a8e516b00c057a4f7df20f2343 (diff)
downloadchromium_src-08fb74a9f12f59c531cc5d7acdb0afea183dba12.zip
chromium_src-08fb74a9f12f59c531cc5d7acdb0afea183dba12.tar.gz
chromium_src-08fb74a9f12f59c531cc5d7acdb0afea183dba12.tar.bz2
Improve the look of the Linux omnibox.
- Paint a border around the input widget, which makes it fit better into the toolbar. A bordered widget is also very nice to have for debugging, so I abstracted a small helper for making a bordered bin. - Improve the results popup by painting with some Pango attributes. Sort of looks awful over NX, but I'm hoping it looks better on a real session. BUG=8236 Review URL: http://codereview.chromium.org/46035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11644 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rwxr-xr-xbase/gfx/gtk_util.cc15
-rwxr-xr-xbase/gfx/gtk_util.h7
2 files changed, 22 insertions, 0 deletions
diff --git a/base/gfx/gtk_util.cc b/base/gfx/gtk_util.cc
index e12bb6e..0808193 100755
--- a/base/gfx/gtk_util.cc
+++ b/base/gfx/gtk_util.cc
@@ -5,6 +5,7 @@
#include "base/gfx/gtk_util.h"
#include <gdk/gdk.h>
+#include <gtk/gtk.h>
#include "base/gfx/rect.h"
#include "skia/include/SkBitmap.h"
@@ -60,4 +61,18 @@ GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap* bitmap) {
return pixbuf;
}
+GtkWidget* CreateGtkBorderBin(GtkWidget* child, const GdkColor* color,
+ int top, int bottom, int left, int right) {
+ // Use a GtkEventBox to get the background painted. However, we can't just
+ // use a container border, since it won't paint there. Use an alignment
+ // inside to get the sizes exactly of how we want the border painted.
+ GtkWidget* ebox = gtk_event_box_new();
+ gtk_widget_modify_bg(ebox, GTK_STATE_NORMAL, color);
+ GtkWidget* alignment = gtk_alignment_new(0, 0, 1, 1);
+ gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), top, bottom, left, right);
+ gtk_container_add(GTK_CONTAINER(alignment), child);
+ gtk_container_add(GTK_CONTAINER(ebox), alignment);
+ return ebox;
+}
+
} // namespace gfx
diff --git a/base/gfx/gtk_util.h b/base/gfx/gtk_util.h
index 40a7855..02b1385 100755
--- a/base/gfx/gtk_util.h
+++ b/base/gfx/gtk_util.h
@@ -7,8 +7,10 @@
#include <vector>
+typedef struct _GdkColor GdkColor;
typedef struct _GdkPixbuf GdkPixbuf;
typedef struct _GdkRegion GdkRegion;
+typedef struct _GtkWidget GtkWidget;
class SkBitmap;
// Define a macro for creating GdkColors from RGB values. This is a macro to
@@ -28,6 +30,11 @@ void SubtractRectanglesFromRegion(GdkRegion* region,
// operation, all of the pixels must be copied and their order swapped.
GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap* bitmap);
+// Create a GtkBin with |child| as its child widget. This bin will paint a
+// border of color |color| with the sizes specified in pixels.
+GtkWidget* CreateGtkBorderBin(GtkWidget* child, const GdkColor* color,
+ int top, int bottom, int left, int right);
+
} // namespace gfx
#endif // BASE_GFX_GTK_UTIL_H_