| 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 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_BASE_TAB_STRIP_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_BASE_TAB_STRIP_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_TABS_BASE_TAB_STRIP_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TABS_BASE_TAB_STRIP_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 enum Type { | 26 enum Type { |
| 27 HORIZONTAL_TAB_STRIP, | 27 HORIZONTAL_TAB_STRIP, |
| 28 VERTICAL_TAB_STRIP | 28 VERTICAL_TAB_STRIP |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 BaseTabStrip(TabStripController* controller, Type type); | 31 BaseTabStrip(TabStripController* controller, Type type); |
| 32 virtual ~BaseTabStrip(); | 32 virtual ~BaseTabStrip(); |
| 33 | 33 |
| 34 Type type() const { return type_; } | 34 Type type() const { return type_; } |
| 35 | 35 |
| 36 // Returns true if Tabs in this TabStrip are currently changing size or | |
| 37 // position. | |
| 38 virtual bool IsAnimating() const; | |
| 39 | |
| 40 // Starts highlighting the tab at the specified index. | 36 // Starts highlighting the tab at the specified index. |
| 41 virtual void StartHighlight(int model_index) = 0; | 37 virtual void StartHighlight(int model_index) = 0; |
| 42 | 38 |
| 43 // Stops all tab higlighting. | 39 // Stops all tab higlighting. |
| 44 virtual void StopAllHighlighting() = 0; | 40 virtual void StopAllHighlighting() = 0; |
| 45 | 41 |
| 46 // Retrieves the ideal bounds for the Tab at the specified index. | 42 // Retrieves the ideal bounds for the Tab at the specified index. |
| 47 const gfx::Rect& ideal_bounds(int tab_data_index) { | 43 const gfx::Rect& ideal_bounds(int tab_data_index) { |
| 48 return tab_data_[tab_data_index].ideal_bounds; | 44 return tab_data_[tab_data_index].ideal_bounds; |
| 49 } | 45 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 80 // Returns the tab at the specified model index. | 76 // Returns the tab at the specified model index. |
| 81 virtual BaseTab* GetBaseTabAtModelIndex(int model_index) const; | 77 virtual BaseTab* GetBaseTabAtModelIndex(int model_index) const; |
| 82 | 78 |
| 83 // Returns the tab at the specified tab index. | 79 // Returns the tab at the specified tab index. |
| 84 BaseTab* base_tab_at_tab_index(int tab_index) const { | 80 BaseTab* base_tab_at_tab_index(int tab_index) const { |
| 85 return tab_data_[tab_index].tab; | 81 return tab_data_[tab_index].tab; |
| 86 } | 82 } |
| 87 | 83 |
| 88 // Returns the index of the specified tab in the model coordiate system, or | 84 // Returns the index of the specified tab in the model coordiate system, or |
| 89 // -1 if tab is closing or not valid. | 85 // -1 if tab is closing or not valid. |
| 90 virtual int GetModelIndexOfBaseTab(const BaseTab* tab) const; | 86 int GetModelIndexOfBaseTab(const BaseTab* tab) const; |
| 91 | 87 |
| 92 // Gets the number of Tabs in the tab strip. | 88 // Gets the number of Tabs in the tab strip. |
| 93 // WARNING: this is the number of tabs displayed by the tabstrip, which if | 89 // WARNING: this is the number of tabs displayed by the tabstrip, which if |
| 94 // an animation is ongoing is not necessarily the same as the number of tabs | 90 // an animation is ongoing is not necessarily the same as the number of tabs |
| 95 // in the model. | 91 // in the model. |
| 96 int tab_count() const { return static_cast<int>(tab_data_.size()); } | 92 int tab_count() const { return static_cast<int>(tab_data_.size()); } |
| 97 | 93 |
| 98 // Cover method for TabStripController::GetCount. | 94 // Cover method for TabStripController::GetCount. |
| 99 int GetModelCount() const; | 95 int GetModelCount() const; |
| 100 | 96 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 // Invoked prior to starting a new animation. | 235 // Invoked prior to starting a new animation. |
| 240 virtual void PrepareForAnimation(); | 236 virtual void PrepareForAnimation(); |
| 241 | 237 |
| 242 // Creates an AnimationDelegate that resets state after a remove animation | 238 // Creates an AnimationDelegate that resets state after a remove animation |
| 243 // completes. The caller owns the returned object. | 239 // completes. The caller owns the returned object. |
| 244 ui::AnimationDelegate* CreateRemoveTabDelegate(BaseTab* tab); | 240 ui::AnimationDelegate* CreateRemoveTabDelegate(BaseTab* tab); |
| 245 | 241 |
| 246 // Invoked from Layout if the size changes or layout is really needed. | 242 // Invoked from Layout if the size changes or layout is really needed. |
| 247 virtual void DoLayout(); | 243 virtual void DoLayout(); |
| 248 | 244 |
| 245 // Returns true if Tabs in this TabStrip are currently changing size or |
| 246 // position. |
| 247 bool IsAnimating() const; |
| 248 |
| 249 // Get tab at a point in local view coordinates. | 249 // Get tab at a point in local view coordinates. |
| 250 BaseTab* GetTabAtLocal(const gfx::Point& local_point); | 250 BaseTab* GetTabAtLocal(const gfx::Point& local_point); |
| 251 | 251 |
| 252 private: | 252 private: |
| 253 class RemoveTabDelegate; | 253 class RemoveTabDelegate; |
| 254 | 254 |
| 255 friend class DraggedTabController; | 255 friend class DraggedTabController; |
| 256 | 256 |
| 257 // Invoked from StoppedDraggingTabs to cleanup |tab|. If |tab| is known | 257 // Invoked from StoppedDraggingTabs to cleanup |tab|. If |tab| is known |
| 258 // |is_first_tab| is set to true. | 258 // |is_first_tab| is set to true. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 275 // model. | 275 // model. |
| 276 bool attaching_dragged_tab_; | 276 bool attaching_dragged_tab_; |
| 277 | 277 |
| 278 views::BoundsAnimator bounds_animator_; | 278 views::BoundsAnimator bounds_animator_; |
| 279 | 279 |
| 280 // Size we last layed out at. | 280 // Size we last layed out at. |
| 281 gfx::Size last_layout_size_; | 281 gfx::Size last_layout_size_; |
| 282 }; | 282 }; |
| 283 | 283 |
| 284 #endif // CHROME_BROWSER_UI_VIEWS_TABS_BASE_TAB_STRIP_H_ | 284 #endif // CHROME_BROWSER_UI_VIEWS_TABS_BASE_TAB_STRIP_H_ |
| OLD | NEW |