OLD | NEW |
| (Empty) |
1 // Copyright 2013 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 ASH_WM_WORKSPACE_ALTERNATE_FRAME_CAPTION_BUTTON_H_ | |
6 #define ASH_WM_WORKSPACE_ALTERNATE_FRAME_CAPTION_BUTTON_H_ | |
7 | |
8 #include "ash/ash_export.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "ui/views/controls/button/custom_button.h" | |
11 | |
12 namespace ui { | |
13 class SlideAnimation; | |
14 } | |
15 | |
16 namespace ash { | |
17 | |
18 // Base class for buttons using the alternate button style. | |
19 class ASH_EXPORT AlternateFrameCaptionButton : public views::CustomButton { | |
20 public: | |
21 static const char kViewClassName[]; | |
22 | |
23 enum Action { | |
24 ACTION_MINIMIZE, | |
25 ACTION_MAXIMIZE_RESTORE, | |
26 ACTION_CLOSE | |
27 }; | |
28 | |
29 AlternateFrameCaptionButton(views::ButtonListener* listener, Action action); | |
30 virtual ~AlternateFrameCaptionButton(); | |
31 | |
32 // Returns the amount in pixels that the button should overlap with the button | |
33 // on the left and right of it. | |
34 static int GetXOverlap(); | |
35 | |
36 // views::View overrides: | |
37 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
38 virtual const char* GetClassName() const OVERRIDE; | |
39 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; | |
40 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | |
41 | |
42 private: | |
43 // Animates the background bubble for the current views::ButtonState. | |
44 void MaybeStartNewBubbleAnimation(); | |
45 | |
46 // views::CustomButton override: | |
47 virtual void StateChanged() OVERRIDE; | |
48 | |
49 // ui::AnimateDelegate overrides. (views::CustomButton inherits from | |
50 // ui::AnimationDelegate). | |
51 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | |
52 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | |
53 | |
54 Action action_; | |
55 | |
56 // The radius of the background bubble when it is hidden. | |
57 double hidden_bubble_radius_; | |
58 | |
59 // The radius of the background bubble when it is visible. | |
60 double shown_bubble_radius_; | |
61 | |
62 scoped_ptr<ui::SlideAnimation> bubble_animation_; | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(AlternateFrameCaptionButton); | |
65 }; | |
66 | |
67 } // namespace ash | |
68 | |
69 #endif // ASH_WM_WORKSPACE_ALTERNATE_FRAME_CAPTION_BUTTON_H_ | |
OLD | NEW |