summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-28 23:35:18 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-28 23:35:18 +0000
commit8d3f80e9171c23d5c998af155da4ad8ce3b63802 (patch)
treeae1b98d5b16daded7133e41152696dcd0337df78 /chrome/common
parent7bc61d31c08b04d429ff3ba6190ddabda341c3f5 (diff)
downloadchromium_src-8d3f80e9171c23d5c998af155da4ad8ce3b63802.zip
chromium_src-8d3f80e9171c23d5c998af155da4ad8ce3b63802.tar.gz
chromium_src-8d3f80e9171c23d5c998af155da4ad8ce3b63802.tar.bz2
Paint a focus indication on LinkButtonGtk buttons.
Also, rearrange helper code for centering things in hboxes so they don't expand to take up the full vertical space. Also, don't allow focus on gtk_chrome_button buttons. This is to prevent the "Other bookmarks" button from getting focus (which matches windows) and is in line with disallowing focus on all custom chrome buttons (see CustomDrawButton). BUG=12829 TEST=everything should look the same. Also if you tab to focus on a link button (e.g. download shelf's "show all downloads"), it should have a dotted line around the exterior. Review URL: http://codereview.chromium.org/113970 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17132 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/gtk_util.cc10
-rw-r--r--chrome/common/gtk_util.h8
2 files changed, 17 insertions, 1 deletions
diff --git a/chrome/common/gtk_util.cc b/chrome/common/gtk_util.cc
index 01d952e..fb34a66 100644
--- a/chrome/common/gtk_util.cc
+++ b/chrome/common/gtk_util.cc
@@ -122,4 +122,14 @@ void InitRCStyles() {
gtk_rc_parse_string(kRCText);
}
+void CenterWidgetInHBox(GtkWidget* hbox, GtkWidget* widget, bool pack_at_end,
+ int padding) {
+ GtkWidget* centering_vbox = gtk_vbox_new(FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(centering_vbox), widget, TRUE, FALSE, 0);
+ if (pack_at_end)
+ gtk_box_pack_end(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, padding);
+ else
+ gtk_box_pack_start(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, padding);
+}
+
} // namespace gtk_util
diff --git a/chrome/common/gtk_util.h b/chrome/common/gtk_util.h
index d72045b..45ebdbb 100644
--- a/chrome/common/gtk_util.h
+++ b/chrome/common/gtk_util.h
@@ -24,7 +24,7 @@ WindowOpenDisposition DispositionFromEventFlags(guint state);
namespace gtk_util {
- // Create a GtkBin with |child| as its child widget. This bin will paint a
+// 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);
@@ -44,6 +44,12 @@ gfx::Rect GetWidgetScreenBounds(GtkWidget* widget);
// Initialize some GTK settings so that our dialogs are consistent.
void InitRCStyles();
+// Stick the widget in the given hbox without expanding vertically. The widget
+// is packed at the start of the hbox. This is useful for widgets that would
+// otherwise expand to fill the vertical space of the hbox (e.g. buttons).
+void CenterWidgetInHBox(GtkWidget* hbox, GtkWidget* widget, bool pack_at_end,
+ int padding);
+
} // namespace gtk_util
#endif // CHROME_COMMON_GTK_UTIL_H_