summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-17 20:38:36 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-17 20:38:36 +0000
commit6a0968853359103f9b13cb1652572509d902ea40 (patch)
tree4164fc6c023c3f1551e7934e31459a8ef898cae6
parent7133f3639754e0189d58b90c07835e8d165ce3e1 (diff)
downloadchromium_src-6a0968853359103f9b13cb1652572509d902ea40.zip
chromium_src-6a0968853359103f9b13cb1652572509d902ea40.tar.gz
chromium_src-6a0968853359103f9b13cb1652572509d902ea40.tar.bz2
Adds the tab overview button to the tab strip.
BUG=none TEST=none Review URL: http://codereview.chromium.org/125262 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18651 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-xchrome/browser/gtk/tabs/tab_strip_gtk.cc37
-rw-r--r--chrome/browser/gtk/tabs/tab_strip_gtk.h14
2 files changed, 51 insertions, 0 deletions
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
index 87d1d9d..516a343 100755
--- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
@@ -494,6 +494,10 @@ void TabStripGtk::Init(Profile* profile) {
newtab_button_.reset(MakeNewTabButton());
+#if defined(LINUX2)
+ tab_overview_button_.reset(MakeTabOverviewButton());
+#endif
+
gtk_widget_show_all(tabstrip_.get());
bounds_ = GetInitialWidgetBounds(tabstrip_.get());
@@ -532,6 +536,10 @@ void TabStripGtk::Layout() {
}
LayoutNewTabButton(static_cast<double>(tab_right), current_unselected_width_);
+#if defined(LINUX2)
+ gtk_fixed_move(GTK_FIXED(tabstrip_.get()), tab_overview_button_->widget(),
+ bounds_.width() - tab_overview_button_->width(), 0);
+#endif
gtk_widget_queue_draw(tabstrip_.get());
}
@@ -994,6 +1002,9 @@ void TabStripGtk::GetDesiredTabWidths(int tab_count,
available_width = bounds_.width();
available_width -=
(kNewTabButtonHOffset + newtab_button_->width());
+#if defined(LINUX2)
+ available_width -= tab_overview_button_->width();
+#endif
} else {
// Interesting corner case: if |available_width_for_tabs_| > the result
// of the calculation in the conditional arm above, the strip is in
@@ -1426,6 +1437,12 @@ gboolean TabStripGtk::OnExpose(GtkWidget* widget, GdkEventExpose* event,
gtk_container_propagate_expose(GTK_CONTAINER(tabstrip->tabstrip_.get()),
tabstrip->newtab_button_->widget(), event);
+#if defined(LINUX2)
+ // Paint the tab overview button.
+ gtk_container_propagate_expose(GTK_CONTAINER(tabstrip->tabstrip_.get()),
+ tabstrip->tab_overview_button_->widget(), event);
+#endif
+
// Paint the tabs in reverse order, so they stack to the left.
TabGtk* selected_tab = NULL;
int tab_count = tabstrip->GetTabCount();
@@ -1556,3 +1573,23 @@ CustomDrawButton* TabStripGtk::MakeNewTabButton() {
return button;
}
+
+#if defined(LINUX2)
+CustomDrawButton* TabStripGtk::MakeTabOverviewButton() {
+ CustomDrawButton* button =
+ new CustomDrawButton(IDR_TAB_OVERVIEW_BUTTON_ICON, 0, 0, 0);
+
+ g_signal_connect(G_OBJECT(button->widget()), "clicked",
+ G_CALLBACK(OnTabOverviewButtonClicked), this);
+ GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS);
+ gtk_fixed_put(GTK_FIXED(tabstrip_.get()), button->widget(), 0, 0);
+
+ return button;
+}
+
+// static
+void TabStripGtk::OnTabOverviewButtonClicked(GtkWidget* widget,
+ TabStripGtk* tabstrip) {
+ // TODO(sky): implement me.
+}
+#endif
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.h b/chrome/browser/gtk/tabs/tab_strip_gtk.h
index 4e85403..417653c 100644
--- a/chrome/browser/gtk/tabs/tab_strip_gtk.h
+++ b/chrome/browser/gtk/tabs/tab_strip_gtk.h
@@ -319,6 +319,15 @@ class TabStripGtk : public TabStripModelObserver,
// Optionally a full Layout will be performed, specified by |layout|.
void FinishAnimation(TabAnimation* animation, bool layout);
+#if defined(LINUX2)
+ // Creates and returns the tab overview button.
+ CustomDrawButton* MakeTabOverviewButton();
+
+ // Invoked when the user clicks the tab overview button.
+ static void OnTabOverviewButtonClicked(GtkWidget* widget,
+ TabStripGtk* tabstrip);
+#endif
+
// The Tabs we contain, and their last generated "good" bounds.
std::vector<TabData> tab_data_;
@@ -361,6 +370,11 @@ class TabStripGtk : public TabStripModelObserver,
// The New Tab button.
scoped_ptr<CustomDrawButton> newtab_button_;
+#if defined(LINUX2)
+ // The tab overview button.
+ scoped_ptr<CustomDrawButton> tab_overview_button_;
+#endif
+
// Valid for the lifetime of a drag over us.
scoped_ptr<DropInfo> drop_info_;