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

Side by Side Diff: chrome/browser/views/tabs/tab_2.h

Issue 42490: Experiments with a new tabstrip + animator (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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
« no previous file with comments | « chrome/browser/views/tabs/browser_tab_strip.cc ('k') | chrome/browser/views/tabs/tab_2.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file.
4
5 #ifndef CHROME_BROWSER_VIEWS_TABS_TAB_2_H_
6 #define CHROME_BROWSER_VIEWS_TABS_TAB_2_H_
7
8 #include "base/string16.h"
9 #include "views/view.h"
10
11 class Tab2;
12
13 namespace gfx {
14 class Canvas;
15 class Path;
16 };
17
18 namespace views {
19 class AnimationContext;
20 class Animator;
21 class AnimatorDelegate;
22 }
23
24 // An interface implemented by an object that provides data to the Tab2.
25 // The Tab2 sometimes owns the Tab2Model. See |removing_model_| in Tab2.
26 class Tab2Model {
27 public:
28 virtual ~Tab2Model() {}
29
30 // Tab2 presentation state.
31 virtual string16 GetTitle(Tab2* tab) const = 0;
32 virtual bool IsSelected(Tab2* tab) const = 0;
33
34 // The Tab2 has been clicked and should become selected.
35 virtual void SelectTab(Tab2* tab) = 0;
36
37 // The mouse has been pressed down on the Tab2, pertinent information for any
38 // drag that might occur should be captured at this time.
39 virtual void CaptureDragInfo(Tab2* tab,
40 const views::MouseEvent& drag_event) = 0;
41
42 // The mouse has been dragged after a press on the Tab2.
43 virtual bool DragTab(Tab2* tab, const views::MouseEvent& drag_event) = 0;
44
45 // The current drag operation has ended.
46 virtual void DragEnded(Tab2* tab) = 0;
47
48 // TODO(beng): get rid of this once animator is on View.
49 virtual views::AnimatorDelegate* AsAnimatorDelegate() = 0;
50 };
51
52 // A view that represents a Tab in a TabStrip2.
53 class Tab2 : public views::View {
54 public:
55 explicit Tab2(Tab2Model* model);
56 virtual ~Tab2();
57
58 bool dragging() const { return dragging_; }
59
60 bool removing() const { return removing_; }
61 void set_removing(bool removing) { removing_ = removing; }
62
63 // Assigns and takes ownership of a model object to be used when painting this
64 // Tab2 after the underlying data object has been removed from TabStrip2's
65 // model.
66 void SetRemovingModel(Tab2Model* model);
67
68 // Returns true if the Tab2 is being animated.
69 bool IsAnimating() const;
70
71 // Returns the Tab2's animator, creating one if necessary.
72 // TODO(beng): consider moving to views::View.
73 views::Animator* GetAnimator();
74
75 // Returns the ideal size of the Tab2.
76 static gfx::Size GetStandardSize();
77
78 // Adds the shape of the tab to the specified path. Used to create a clipped
79 // window during detached window dragging operations.
80 void AddTabShapeToPath(gfx::Path* path) const;
81
82 // Overridden from views::View:
83 virtual gfx::Size GetPreferredSize();
84 virtual void Layout();
85 virtual void Paint(gfx::Canvas* canvas);
86 virtual bool OnMousePressed(const views::MouseEvent& event);
87 virtual bool OnMouseDragged(const views::MouseEvent& event);
88 virtual void OnMouseReleased(const views::MouseEvent& event,
89 bool canceled);
90 virtual void DidChangeBounds(const gfx::Rect& previous,
91 const gfx::Rect& current);
92
93 private:
94 Tab2Model* model_;
95
96 // True if the Tab2 is being dragged currently.
97 bool dragging_;
98
99 // True if the Tab2 represents an object removed from its containing
100 // TabStrip2's model, and is currently being animated closed.
101 bool removing_;
102
103 // Our animator.
104 scoped_ptr<views::Animator> animator_;
105
106 // A dummy model to use for painting the tab after it's been removed from the
107 // TabStrip2's model but while it's still visible in the presentation (being
108 // animated out of existence).
109 scoped_ptr<Tab2Model> removing_model_;
110
111 DISALLOW_COPY_AND_ASSIGN(Tab2);
112 };
113
114 #endif // #ifndef CHROME_BROWSER_VIEWS_TABS_TAB_2_H_
OLDNEW
« no previous file with comments | « chrome/browser/views/tabs/browser_tab_strip.cc ('k') | chrome/browser/views/tabs/tab_2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698