OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_MESSAGE_CENTER_MESSAGE_VIEW_H_ | 5 #ifndef UI_MESSAGE_CENTER_MESSAGE_VIEW_H_ |
6 #define UI_MESSAGE_CENTER_MESSAGE_VIEW_H_ | 6 #define UI_MESSAGE_CENTER_MESSAGE_VIEW_H_ |
7 | 7 |
8 #include "ui/message_center/notification.h" | 8 #include "ui/message_center/notification.h" |
9 #include "ui/message_center/notification_list.h" | 9 #include "ui/message_center/notification_list.h" |
10 #include "ui/views/controls/button/button.h" | 10 #include "ui/views/controls/button/button.h" |
11 #include "ui/views/controls/slide_out_view.h" | 11 #include "ui/views/controls/slide_out_view.h" |
12 #include "ui/views/view.h" | |
13 | 12 |
14 namespace views { | 13 namespace views { |
15 class ImageButton; | 14 class ImageButton; |
15 class ImageView; | |
16 class ScrollView; | 16 class ScrollView; |
17 } | 17 } |
18 | 18 |
19 namespace message_center { | 19 namespace message_center { |
20 | 20 |
21 // Individual notifications constants. | 21 // Individual notifications constants. |
22 const int kPaddingBetweenItems = 10; | 22 const int kPaddingBetweenItems = 10; |
23 const int kPaddingHorizontal = 18; | 23 const int kPaddingHorizontal = 18; |
24 const int kWebNotificationButtonWidth = 32; | 24 const int kWebNotificationButtonWidth = 32; |
25 const int kWebNotificationIconSize = 40; | 25 const int kWebNotificationIconSize = 40; |
26 const int kWebNotificationWidth = 300; | 26 const int kWebNotificationWidth = 300; |
27 | 27 |
28 // An abstract class that forms the basis of a view for a notification entry. | 28 // An abstract class that forms the basis of a view for a notification entry. |
29 class MessageView : public views::SlideOutView, | 29 class MessageView : public views::SlideOutView, |
30 public views::ButtonListener { | 30 public views::ButtonListener { |
31 public: | 31 public: |
32 MessageView(NotificationList::Delegate* list_delegate, | 32 MessageView(NotificationList::Delegate* list_delegate, |
33 const Notification& notification); | 33 const Notification& notification); |
34 | 34 |
35 virtual ~MessageView(); | 35 virtual ~MessageView(); |
36 | 36 |
37 // Creates the elements that make up the view layout. Must be called | |
38 // immediately after construction. | |
39 virtual void SetUpView() = 0; | |
40 | |
41 void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; } | 37 void set_scroller(views::ScrollView* scroller) { scroller_ = scroller; } |
42 | 38 |
43 // Overridden from views::View. | 39 // Overridden from views::View. |
44 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 40 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
45 | 41 |
46 // Overridden from ui::EventHandler. | 42 // Overridden from ui::EventHandler. |
47 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 43 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
48 | 44 |
49 // Overridden from ButtonListener. | 45 // Overridden from ButtonListener. |
50 virtual void ButtonPressed(views::Button* sender, | 46 virtual void ButtonPressed(views::Button* sender, |
51 const ui::Event& event) OVERRIDE; | 47 const ui::Event& event) OVERRIDE; |
52 | 48 |
49 virtual bool IsExpanded(); | |
50 virtual void SetExpanded(bool expanded); | |
dharcourt
2013/02/23 04:32:00
These are not is_expanded() and set_expanded() bec
Jun Mukai
2013/02/26 02:23:30
nit: I am not so sure, but probably our style of d
dharcourt
2013/02/26 03:23:30
SGTM. Done.
| |
51 | |
53 protected: | 52 protected: |
54 MessageView(); | 53 MessageView(); |
55 | 54 |
56 // Shows the menu for the notification. | 55 // Shows the menu for the notification. |
57 void ShowMenu(gfx::Point screen_location); | 56 void ShowMenu(gfx::Point screen_location); |
58 | 57 |
59 // Overridden from views::SlideOutView. | 58 // Overridden from views::SlideOutView. |
60 virtual void OnSlideOut() OVERRIDE; | 59 virtual void OnSlideOut() OVERRIDE; |
61 | 60 |
62 NotificationList::Delegate* list_delegate() { return list_delegate_; } | 61 NotificationList::Delegate* list_delegate() { return list_delegate_; } |
63 Notification& notification() { return notification_; } | 62 Notification& notification() { return notification_; } |
64 views::ImageButton* close_button() { return close_button_.get(); } | 63 views::ImageButton* close_button() { return close_button_.get(); } |
64 views::ImageButton* expand_button() { return expand_button_.get(); } | |
65 views::ScrollView* scroller() { return scroller_; } | 65 views::ScrollView* scroller() { return scroller_; } |
66 | 66 |
67 private: | 67 private: |
68 NotificationList::Delegate* list_delegate_; | 68 NotificationList::Delegate* list_delegate_; |
69 Notification notification_; | 69 Notification notification_; |
70 | |
70 scoped_ptr<views::ImageButton> close_button_; | 71 scoped_ptr<views::ImageButton> close_button_; |
72 scoped_ptr<views::ImageButton> expand_button_; | |
73 views::ScrollView* scroller_; | |
71 | 74 |
72 views::ScrollView* scroller_; | 75 bool expanded_; |
73 | 76 |
74 DISALLOW_COPY_AND_ASSIGN(MessageView); | 77 DISALLOW_COPY_AND_ASSIGN(MessageView); |
75 }; | 78 }; |
76 | 79 |
77 } // namespace message_center | 80 } // namespace message_center |
78 | 81 |
79 #endif // UI_MESSAGE_CENTER_MESSAGE_VIEW_H_ | 82 #endif // UI_MESSAGE_CENTER_MESSAGE_VIEW_H_ |
OLD | NEW |