touch_tab_strip.h revision 72a454cd3513ac24fbdd0e0cb9ad70b86a99b801
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 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_STRIP_H_ 6#define CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_STRIP_H_ 7#pragma once 8 9#include "chrome/browser/ui/views/tabs/base_tab_strip.h" 10 11class TouchTab; 12 13/////////////////////////////////////////////////////////////////////////////// 14// 15// TouchTabStrip 16// 17// A View that represents the TabStripModel. The TouchTabStrip has the 18// following responsibilities: 19// - It implements the TabStripModelObserver interface, and acts as a 20// container for Tabs, and is also responsible for creating them. 21// 22/////////////////////////////////////////////////////////////////////////////// 23class TouchTabStrip : public BaseTabStrip { 24 public: 25 explicit TouchTabStrip(TabStripController* controller); 26 virtual ~TouchTabStrip(); 27 28 // BaseTabStrip implementation: 29 virtual void SetBackgroundOffset(const gfx::Point& offset); 30 virtual bool IsPositionInWindowCaption(const gfx::Point& point); 31 virtual void PrepareForCloseAt(int model_index); 32 virtual void StartHighlight(int model_index); 33 virtual void StopAllHighlighting(); 34 virtual BaseTab* CreateTabForDragging(); 35 virtual void RemoveTabAt(int model_index); 36 virtual void SelectTabAt(int old_model_index, int new_model_index); 37 virtual void TabTitleChangedNotLoading(int model_index); 38 virtual BaseTab* CreateTab(); 39 virtual void StartInsertTabAnimation(int model_index, bool foreground); 40 virtual void AnimateToIdealBounds(); 41 virtual bool ShouldHighlightCloseButtonAfterRemove(); 42 virtual void GenerateIdealBounds(); 43 44 // views::View overrides 45 virtual gfx::Size GetPreferredSize(); 46 virtual void PaintChildren(gfx::Canvas* canvas); 47 48 // Retrieves the Tab at the specified index. Remember, the specified index 49 // is in terms of tab_data, *not* the model. 50 TouchTab* GetTabAtTabDataIndex(int tab_data_index) const; 51 52 private: 53 void Init(); 54 55 // True if PrepareForCloseAt has been invoked. When true remove animations 56 // preserve current tab bounds. 57 bool in_tab_close_; 58 59 DISALLOW_COPY_AND_ASSIGN(TouchTabStrip); 60}; 61 62#endif // CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_STRIP_H_ 63