Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(571)

Side by Side Diff: chrome/browser/gtk/tabs/tab_strip_gtk.cc

Issue 113532: Implement DraggedTabGtk, the object that handles rendering either a dragged t... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/gtk/tabs/tab_renderer_gtk.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" 5 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h"
6 6
7 #include "app/gfx/canvas.h" 7 #include "app/gfx/canvas.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "app/resource_bundle.h" 9 #include "app/resource_bundle.h"
10 #include "app/slide_animation.h" 10 #include "app/slide_animation.h"
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 } 852 }
853 853
854 // Calculate the desired tab widths by dividing the available space into equal 854 // Calculate the desired tab widths by dividing the available space into equal
855 // portions. Don't let tabs get larger than the "standard width" or smaller 855 // portions. Don't let tabs get larger than the "standard width" or smaller
856 // than the minimum width for each type, respectively. 856 // than the minimum width for each type, respectively.
857 const int total_offset = kTabHOffset * (tab_count - 1); 857 const int total_offset = kTabHOffset * (tab_count - 1);
858 const double desired_tab_width = std::min( 858 const double desired_tab_width = std::min(
859 (static_cast<double>(available_width - total_offset) / 859 (static_cast<double>(available_width - total_offset) /
860 static_cast<double>(tab_count)), 860 static_cast<double>(tab_count)),
861 static_cast<double>(TabGtk::GetStandardSize().width())); 861 static_cast<double>(TabGtk::GetStandardSize().width()));
862
862 *unselected_width = std::max(desired_tab_width, min_unselected_width); 863 *unselected_width = std::max(desired_tab_width, min_unselected_width);
863 *selected_width = std::max(desired_tab_width, min_selected_width); 864 *selected_width = std::max(desired_tab_width, min_selected_width);
864 865
865 // When there are multiple tabs, we'll have one selected and some unselected 866 // When there are multiple tabs, we'll have one selected and some unselected
866 // tabs. If the desired width was between the minimum sizes of these types, 867 // tabs. If the desired width was between the minimum sizes of these types,
867 // try to shrink the tabs with the smaller minimum. For example, if we have 868 // try to shrink the tabs with the smaller minimum. For example, if we have
868 // a strip of width 10 with 4 tabs, the desired width per tab will be 2.5. If 869 // a strip of width 10 with 4 tabs, the desired width per tab will be 2.5. If
869 // selected tabs have a minimum width of 4 and unselected tabs have a minimum 870 // selected tabs have a minimum width of 4 and unselected tabs have a minimum
870 // width of 1, the above code would set *unselected_width = 2.5, 871 // width of 1, the above code would set *unselected_width = 2.5,
871 // *selected_width = 4, which results in a total width of 11.5. Instead, we 872 // *selected_width = 4, which results in a total width of 11.5. Instead, we
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 CustomDrawButton* button = new CustomDrawButton(IDR_NEWTAB_BUTTON, 1075 CustomDrawButton* button = new CustomDrawButton(IDR_NEWTAB_BUTTON,
1075 IDR_NEWTAB_BUTTON_P, IDR_NEWTAB_BUTTON_H, 0); 1076 IDR_NEWTAB_BUTTON_P, IDR_NEWTAB_BUTTON_H, 0);
1076 1077
1077 g_signal_connect(G_OBJECT(button->widget()), "clicked", 1078 g_signal_connect(G_OBJECT(button->widget()), "clicked",
1078 G_CALLBACK(OnNewTabClicked), this); 1079 G_CALLBACK(OnNewTabClicked), this);
1079 GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS); 1080 GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS);
1080 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), button->widget(), 0, 0); 1081 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), button->widget(), 0, 0);
1081 1082
1082 return button; 1083 return button;
1083 } 1084 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/tabs/tab_renderer_gtk.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698