OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/gtk/tabs/tab_strip_gtk.h" | 5 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 const Type type_; | 256 const Type type_; |
257 | 257 |
258 DISALLOW_COPY_AND_ASSIGN(TabAnimation); | 258 DISALLOW_COPY_AND_ASSIGN(TabAnimation); |
259 }; | 259 }; |
260 | 260 |
261 //////////////////////////////////////////////////////////////////////////////// | 261 //////////////////////////////////////////////////////////////////////////////// |
262 | 262 |
263 // Handles insertion of a Tab at |index|. | 263 // Handles insertion of a Tab at |index|. |
264 class InsertTabAnimation : public TabStripGtk::TabAnimation { | 264 class InsertTabAnimation : public TabStripGtk::TabAnimation { |
265 public: | 265 public: |
266 explicit InsertTabAnimation(TabStripGtk* tabstrip, int index) | 266 InsertTabAnimation(TabStripGtk* tabstrip, int index) |
267 : TabAnimation(tabstrip, INSERT), | 267 : TabAnimation(tabstrip, INSERT), |
268 index_(index) { | 268 index_(index) { |
269 int tab_count = tabstrip->GetTabCount(); | 269 int tab_count = tabstrip->GetTabCount(); |
270 int end_mini_count = tabstrip->GetMiniTabCount(); | 270 int end_mini_count = tabstrip->GetMiniTabCount(); |
271 int start_mini_count = end_mini_count; | 271 int start_mini_count = end_mini_count; |
272 if (index < end_mini_count) | 272 if (index < end_mini_count) |
273 start_mini_count--; | 273 start_mini_count--; |
274 GenerateStartAndEndWidths(tab_count - 1, tab_count, start_mini_count, | 274 GenerateStartAndEndWidths(tab_count - 1, tab_count, start_mini_count, |
275 end_mini_count); | 275 end_mini_count); |
276 } | 276 } |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 } | 519 } |
520 } | 520 } |
521 | 521 |
522 DISALLOW_COPY_AND_ASSIGN(ResizeLayoutAnimation); | 522 DISALLOW_COPY_AND_ASSIGN(ResizeLayoutAnimation); |
523 }; | 523 }; |
524 | 524 |
525 // Handles a tabs mini-state changing while the tab does not change position | 525 // Handles a tabs mini-state changing while the tab does not change position |
526 // in the model. | 526 // in the model. |
527 class MiniTabAnimation : public TabStripGtk::TabAnimation { | 527 class MiniTabAnimation : public TabStripGtk::TabAnimation { |
528 public: | 528 public: |
529 explicit MiniTabAnimation(TabStripGtk* tabstrip, int index) | 529 MiniTabAnimation(TabStripGtk* tabstrip, int index) |
530 : TabAnimation(tabstrip, MINI), | 530 : TabAnimation(tabstrip, MINI), |
531 index_(index) { | 531 index_(index) { |
532 int tab_count = tabstrip->GetTabCount(); | 532 int tab_count = tabstrip->GetTabCount(); |
533 int start_mini_count = tabstrip->GetMiniTabCount(); | 533 int start_mini_count = tabstrip->GetMiniTabCount(); |
534 int end_mini_count = start_mini_count; | 534 int end_mini_count = start_mini_count; |
535 if (tabstrip->GetTabAt(index)->mini()) | 535 if (tabstrip->GetTabAt(index)->mini()) |
536 start_mini_count--; | 536 start_mini_count--; |
537 else | 537 else |
538 start_mini_count++; | 538 start_mini_count++; |
539 tabstrip_->GetTabAt(index)->set_animating_mini_change(true); | 539 tabstrip_->GetTabAt(index)->set_animating_mini_change(true); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 | 579 |
580 DISALLOW_COPY_AND_ASSIGN(MiniTabAnimation); | 580 DISALLOW_COPY_AND_ASSIGN(MiniTabAnimation); |
581 }; | 581 }; |
582 | 582 |
583 //////////////////////////////////////////////////////////////////////////////// | 583 //////////////////////////////////////////////////////////////////////////////// |
584 | 584 |
585 // Handles the animation when a tabs mini-state changes and the tab moves as a | 585 // Handles the animation when a tabs mini-state changes and the tab moves as a |
586 // result. | 586 // result. |
587 class MiniMoveAnimation : public TabStripGtk::TabAnimation { | 587 class MiniMoveAnimation : public TabStripGtk::TabAnimation { |
588 public: | 588 public: |
589 explicit MiniMoveAnimation(TabStripGtk* tabstrip, | 589 MiniMoveAnimation(TabStripGtk* tabstrip, |
590 int from_index, | 590 int from_index, |
591 int to_index, | 591 int to_index, |
592 const gfx::Rect& start_bounds) | 592 const gfx::Rect& start_bounds) |
593 : TabAnimation(tabstrip, MINI_MOVE), | 593 : TabAnimation(tabstrip, MINI_MOVE), |
594 tab_(tabstrip->GetTabAt(to_index)), | 594 tab_(tabstrip->GetTabAt(to_index)), |
595 start_bounds_(start_bounds), | 595 start_bounds_(start_bounds), |
596 from_index_(from_index), | 596 from_index_(from_index), |
597 to_index_(to_index) { | 597 to_index_(to_index) { |
598 int tab_count = tabstrip->GetTabCount(); | 598 int tab_count = tabstrip->GetTabCount(); |
599 int start_mini_count = tabstrip->GetMiniTabCount(); | 599 int start_mini_count = tabstrip->GetMiniTabCount(); |
600 int end_mini_count = start_mini_count; | 600 int end_mini_count = start_mini_count; |
601 if (tabstrip->GetTabAt(to_index)->mini()) | 601 if (tabstrip->GetTabAt(to_index)->mini()) |
602 start_mini_count--; | 602 start_mini_count--; |
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2136 | 2136 |
2137 // Let the middle mouse button initiate clicks as well. | 2137 // Let the middle mouse button initiate clicks as well. |
2138 gtk_util::SetButtonTriggersNavigation(button->widget()); | 2138 gtk_util::SetButtonTriggersNavigation(button->widget()); |
2139 g_signal_connect(button->widget(), "clicked", | 2139 g_signal_connect(button->widget(), "clicked", |
2140 G_CALLBACK(OnNewTabClickedThunk), this); | 2140 G_CALLBACK(OnNewTabClickedThunk), this); |
2141 gtk_widget_set_can_focus(button->widget(), FALSE); | 2141 gtk_widget_set_can_focus(button->widget(), FALSE); |
2142 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), button->widget(), 0, 0); | 2142 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), button->widget(), 0, 0); |
2143 | 2143 |
2144 return button; | 2144 return button; |
2145 } | 2145 } |
OLD | NEW |