summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 20:14:56 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 20:14:56 +0000
commitd2b23c9de93d3963d751c493dba2582b13771abf (patch)
tree09c30c0808b80094e3c16b4b012a3b708859a097
parentba40bc9bde3df411bbc9826e54c7b151e36e0679 (diff)
downloadchromium_src-d2b23c9de93d3963d751c493dba2582b13771abf.zip
chromium_src-d2b23c9de93d3963d751c493dba2582b13771abf.tar.gz
chromium_src-d2b23c9de93d3963d751c493dba2582b13771abf.tar.bz2
GTK: Use rounded corners in AutocompletePopupViewGtk.
Review URL: http://codereview.chromium.org/173646 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25080 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc26
1 files changed, 12 insertions, 14 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc
index dffc91a..d197828 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc
@@ -24,6 +24,7 @@
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_model.h"
+#include "chrome/browser/gtk/rounded_window.h"
#include "chrome/common/notification_service.h"
#include "grit/theme_resources.h"
@@ -62,6 +63,9 @@ const int kRightPadding = 3;
// the total width.
const float kContentWidthPercentage = 0.7;
+// Radius of the rounded corners.
+const int kCornerSize = 3;
+
// UTF-8 Left-to-right embedding.
const char* kLRE = "\xe2\x80\xaa";
@@ -285,6 +289,12 @@ AutocompletePopupViewGtk::AutocompletePopupViewGtk(
G_CALLBACK(&HandleButtonReleaseThunk), this);
g_signal_connect(window_, "expose-event",
G_CALLBACK(&HandleExposeThunk), this);
+
+ // Make the popup have rounded corners. (Must be called after we hook up
+ // AutocompletePopupViewGtk's expose-event handler.)
+ gtk_util::ActAsRoundedWindow(
+ window_, kBorderColor, kCornerSize,
+ gtk_util::ROUNDED_ALL, gtk_util::BORDER_ALL);
}
AutocompletePopupViewGtk::~AutocompletePopupViewGtk() {
@@ -414,23 +424,11 @@ gboolean AutocompletePopupViewGtk::HandleExpose(GtkWidget* widget,
// This means we won't draw the border, but, yeah, whatever.
// TODO(deanm): Make the code more robust and remove this check.
if (window_rect.width() < (kIconAreaWidth * 3))
- return TRUE;
+ return FALSE;
GdkDrawable* drawable = GDK_DRAWABLE(event->window);
GdkGC* gc = gdk_gc_new(drawable);
- // kBorderColor is unallocated, so use the GdkRGB routine.
- gdk_gc_set_rgb_fg_color(gc, &kBorderColor);
-
- // This assert is kinda ugly, but it would be more currently unneeded work
- // to support painting a border that isn't 1 pixel thick. There is no point
- // in writing that code now, and explode if that day ever comes.
- COMPILE_ASSERT(kBorderThickness == 1, border_1px_implied);
- // Draw the 1px border around the entire window.
- gdk_draw_rectangle(drawable, gc, FALSE,
- 0, 0,
- window_rect.width() - 1, window_rect.height() - 1);
-
pango_layout_set_height(layout_, kHeightPerResult * PANGO_SCALE);
// TODO(deanm): Intersect the line and damage rects, and only repaint and
@@ -506,7 +504,7 @@ gboolean AutocompletePopupViewGtk::HandleExpose(GtkWidget* widget,
g_object_unref(gc);
- return TRUE;
+ return FALSE;
}
// static