Commit 7351ada6 authored by deanm@chromium.org's avatar deanm@chromium.org

Use the new selected icons in Linux Omnibox.

Review URL: http://codereview.chromium.org/100200


git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14942 0039d316-1c4b-4281-b951-d872f2087c98
parent 4d8c97a0
...@@ -173,34 +173,39 @@ void SetupLayoutForMatch(PangoLayout* layout, ...@@ -173,34 +173,39 @@ void SetupLayoutForMatch(PangoLayout* layout,
pango_attr_list_unref(attrs); pango_attr_list_unref(attrs);
} }
GdkPixbuf* IconForMatch(const AutocompleteMatch& match) { GdkPixbuf* IconForMatch(const AutocompleteMatch& match, bool selected) {
// TODO(deanm): These would be better as pixmaps someday. // TODO(deanm): These would be better as pixmaps someday.
ResourceBundle& rb = ResourceBundle::GetSharedInstance(); ResourceBundle& rb = ResourceBundle::GetSharedInstance();
static GdkPixbuf* o2_globe = rb.GetPixbufNamed(IDR_O2_GLOBE); static GdkPixbuf* o2_globe = rb.GetPixbufNamed(IDR_O2_GLOBE);
static GdkPixbuf* o2_globe_s = rb.GetPixbufNamed(IDR_O2_GLOBE_SELECTED);
static GdkPixbuf* o2_history = rb.GetPixbufNamed(IDR_O2_HISTORY); static GdkPixbuf* o2_history = rb.GetPixbufNamed(IDR_O2_HISTORY);
static GdkPixbuf* o2_history_s = rb.GetPixbufNamed(IDR_O2_HISTORY_SELECTED);
static GdkPixbuf* o2_more = rb.GetPixbufNamed(IDR_O2_MORE); static GdkPixbuf* o2_more = rb.GetPixbufNamed(IDR_O2_MORE);
static GdkPixbuf* o2_more_s = rb.GetPixbufNamed(IDR_O2_MORE_SELECTED);
static GdkPixbuf* o2_search = rb.GetPixbufNamed(IDR_O2_SEARCH); static GdkPixbuf* o2_search = rb.GetPixbufNamed(IDR_O2_SEARCH);
static GdkPixbuf* o2_search_s = rb.GetPixbufNamed(IDR_O2_SEARCH_SELECTED);
static GdkPixbuf* o2_star = rb.GetPixbufNamed(IDR_O2_STAR); static GdkPixbuf* o2_star = rb.GetPixbufNamed(IDR_O2_STAR);
static GdkPixbuf* o2_star_s = rb.GetPixbufNamed(IDR_O2_STAR_SELECTED);
if (match.starred) if (match.starred)
return o2_star; return selected ? o2_star_s : o2_star;
switch (match.type) { switch (match.type) {
case AutocompleteMatch::URL_WHAT_YOU_TYPED: case AutocompleteMatch::URL_WHAT_YOU_TYPED:
case AutocompleteMatch::NAVSUGGEST: case AutocompleteMatch::NAVSUGGEST:
return o2_globe; return selected ? o2_globe_s : o2_globe;
case AutocompleteMatch::HISTORY_URL: case AutocompleteMatch::HISTORY_URL:
case AutocompleteMatch::HISTORY_TITLE: case AutocompleteMatch::HISTORY_TITLE:
case AutocompleteMatch::HISTORY_BODY: case AutocompleteMatch::HISTORY_BODY:
case AutocompleteMatch::HISTORY_KEYWORD: case AutocompleteMatch::HISTORY_KEYWORD:
return o2_history; return selected ? o2_history_s : o2_history;
case AutocompleteMatch::SEARCH_WHAT_YOU_TYPED: case AutocompleteMatch::SEARCH_WHAT_YOU_TYPED:
case AutocompleteMatch::SEARCH_HISTORY: case AutocompleteMatch::SEARCH_HISTORY:
case AutocompleteMatch::SEARCH_SUGGEST: case AutocompleteMatch::SEARCH_SUGGEST:
case AutocompleteMatch::SEARCH_OTHER_ENGINE: case AutocompleteMatch::SEARCH_OTHER_ENGINE:
return o2_search; return selected ? o2_search_s : o2_search;
case AutocompleteMatch::OPEN_HISTORY_PAGE: case AutocompleteMatch::OPEN_HISTORY_PAGE:
return o2_more; return selected ? o2_more_s : o2_more;
default: default:
NOTREACHED(); NOTREACHED();
break; break;
...@@ -425,7 +430,7 @@ gboolean AutocompletePopupViewGtk::HandleExpose(GtkWidget* widget, ...@@ -425,7 +430,7 @@ gboolean AutocompletePopupViewGtk::HandleExpose(GtkWidget* widget,
} }
// Draw the icon for this result time. // Draw the icon for this result time.
DrawFullPixbuf(drawable, gc, IconForMatch(match), DrawFullPixbuf(drawable, gc, IconForMatch(match, is_selected),
kIconLeftPadding, line_rect.y() + kIconTopPadding); kIconLeftPadding, line_rect.y() + kIconTopPadding);
// Draw the results text vertically centered in the results space. // Draw the results text vertically centered in the results space.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment