| 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_TOUCH_TABS_TOUCH_TAB_H_ | 5 #ifndef CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_H_ |
| 6 #define CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_H_ | 6 #define CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "chrome/browser/ui/views/tabs/base_tab.h" | 12 #include "chrome/browser/ui/views/tabs/base_tab.h" |
| 13 #include "ui/gfx/point.h" | 13 #include "ui/gfx/point.h" |
| 14 | 14 |
| 15 /////////////////////////////////////////////////////////////////////////////// | 15 /////////////////////////////////////////////////////////////////////////////// |
| 16 // | 16 // |
| 17 // TouchTab | 17 // TouchTab |
| 18 // | 18 // |
| 19 // A View that renders a TouchTab in a TouchTabStrip | 19 // A View that renders a TouchTab in a TouchTabStrip |
| 20 // | 20 // |
| 21 // TODO(wyck): Use transformable views for scrolling. |
| 21 /////////////////////////////////////////////////////////////////////////////// | 22 /////////////////////////////////////////////////////////////////////////////// |
| 22 class TouchTab : public BaseTab { | 23 class TouchTab : public BaseTab { |
| 23 public: | 24 public: |
| 24 // The menu button's class name. | 25 // The menu button's class name. |
| 25 static const char kViewClassName[]; | 26 static const char kViewClassName[]; |
| 26 | 27 |
| 27 explicit TouchTab(TabController* controller); | 28 explicit TouchTab(TabController* controller); |
| 28 virtual ~TouchTab(); | 29 virtual ~TouchTab(); |
| 29 | 30 |
| 30 // Set the background offset used to match the image in the inactive tab | 31 // Set the background offset used to match the image in the inactive tab |
| 31 // to the frame image. | 32 // to the frame image. |
| 32 void set_background_offset(const gfx::Point& offset) { | 33 void set_background_offset(const gfx::Point& offset) { |
| 33 background_offset_ = offset; | 34 background_offset_ = offset; |
| 34 } | 35 } |
| 35 | 36 |
| 36 // Returns the minimum possible size of a single unselected Tab. | 37 // Returns the minimum possible size of a single unselected Tab. |
| 37 static gfx::Size GetMinimumUnselectedSize(); | 38 static gfx::Size GetMinimumUnselectedSize(); |
| 38 | 39 |
| 39 protected: | 40 protected: |
| 40 virtual const gfx::Rect& GetTitleBounds() const; | 41 virtual const gfx::Rect& GetTitleBounds() const; |
| 41 virtual const gfx::Rect& GetIconBounds() const; | 42 virtual const gfx::Rect& GetIconBounds() const; |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 // Overridden from views::View: | 45 // Overridden from views::View: |
| 46 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
| 47 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; |
| 48 virtual void OnMouseReleased(const views::MouseEvent& event, |
| 49 bool canceled) OVERRIDE; |
| 45 virtual void OnPaint(gfx::Canvas* canvas); | 50 virtual void OnPaint(gfx::Canvas* canvas); |
| 46 virtual void Layout(); | 51 virtual void Layout(); |
| 47 virtual bool HasHitTestMask() const; | 52 virtual bool HasHitTestMask() const; |
| 48 virtual void GetHitTestMask(gfx::Path* path) const; | 53 virtual void GetHitTestMask(gfx::Path* path) const; |
| 49 | 54 |
| 50 // Paint various portions of the Tab | 55 // Paint various portions of the Tab |
| 51 void PaintTabBackground(gfx::Canvas* canvas); | 56 void PaintTabBackground(gfx::Canvas* canvas); |
| 52 void PaintIcon(gfx::Canvas* canvas); | 57 void PaintIcon(gfx::Canvas* canvas); |
| 53 void PaintActiveTabBackground(gfx::Canvas* canvas); | 58 void PaintActiveTabBackground(gfx::Canvas* canvas); |
| 54 | 59 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 82 int y_offset; | 87 int y_offset; |
| 83 }; | 88 }; |
| 84 static TouchTabImage tab_active; | 89 static TouchTabImage tab_active; |
| 85 static TouchTabImage tab_inactive; | 90 static TouchTabImage tab_inactive; |
| 86 static TouchTabImage tab_alpha; | 91 static TouchTabImage tab_alpha; |
| 87 | 92 |
| 88 DISALLOW_COPY_AND_ASSIGN(TouchTab); | 93 DISALLOW_COPY_AND_ASSIGN(TouchTab); |
| 89 }; | 94 }; |
| 90 | 95 |
| 91 #endif // CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_H_ | 96 #endif // CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_H_ |
| OLD | NEW |