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_VIEWS_WIDGET_WIDGET_DELEGATE_H_ | 5 #ifndef UI_VIEWS_WIDGET_WIDGET_DELEGATE_H_ |
6 #define UI_VIEWS_WIDGET_WIDGET_DELEGATE_H_ | 6 #define UI_VIEWS_WIDGET_WIDGET_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... | |
23 class DialogDelegate; | 23 class DialogDelegate; |
24 class NonClientFrameView; | 24 class NonClientFrameView; |
25 class View; | 25 class View; |
26 class Widget; | 26 class Widget; |
27 | 27 |
28 // Handles events on Widgets in context-specific ways. | 28 // Handles events on Widgets in context-specific ways. |
29 class VIEWS_EXPORT WidgetDelegate { | 29 class VIEWS_EXPORT WidgetDelegate { |
30 public: | 30 public: |
31 WidgetDelegate(); | 31 WidgetDelegate(); |
32 | 32 |
33 // Sets whether the widget is activatable. | |
sky
2014/05/20 17:43:20
Sets the return value of CanActivate. Default is t
| |
34 void set_can_activate(bool can_activate) { | |
35 can_activate_ = can_activate; | |
36 } | |
37 | |
33 // Called whenever the widget's position changes. | 38 // Called whenever the widget's position changes. |
34 virtual void OnWidgetMove(); | 39 virtual void OnWidgetMove(); |
35 | 40 |
36 // Called with the display changes (color depth or resolution). | 41 // Called with the display changes (color depth or resolution). |
37 virtual void OnDisplayChanged(); | 42 virtual void OnDisplayChanged(); |
38 | 43 |
39 // Called when the work area (the desktop area minus task bars, | 44 // Called when the work area (the desktop area minus task bars, |
40 // menu bars, etc.) changes in size. | 45 // menu bars, etc.) changes in size. |
41 virtual void OnWorkAreaChanged(); | 46 virtual void OnWorkAreaChanged(); |
42 | 47 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 // Populates |panes| with accessible panes in this window that can | 179 // Populates |panes| with accessible panes in this window that can |
175 // be cycled through with keyboard focus. | 180 // be cycled through with keyboard focus. |
176 virtual void GetAccessiblePanes(std::vector<View*>* panes) {} | 181 virtual void GetAccessiblePanes(std::vector<View*>* panes) {} |
177 | 182 |
178 protected: | 183 protected: |
179 virtual ~WidgetDelegate() {} | 184 virtual ~WidgetDelegate() {} |
180 | 185 |
181 private: | 186 private: |
182 View* default_contents_view_; | 187 View* default_contents_view_; |
183 | 188 |
189 bool can_activate_; | |
190 | |
184 DISALLOW_COPY_AND_ASSIGN(WidgetDelegate); | 191 DISALLOW_COPY_AND_ASSIGN(WidgetDelegate); |
185 }; | 192 }; |
186 | 193 |
187 // A WidgetDelegate implementation that is-a View. Used to override GetWidget() | 194 // A WidgetDelegate implementation that is-a View. Used to override GetWidget() |
188 // to call View's GetWidget() for the common case where a WidgetDelegate | 195 // to call View's GetWidget() for the common case where a WidgetDelegate |
189 // implementation is-a View. Note that WidgetDelegateView is not owned by | 196 // implementation is-a View. Note that WidgetDelegateView is not owned by |
190 // view's hierarchy and is expected to be deleted on DeleteDelegate call. | 197 // view's hierarchy and is expected to be deleted on DeleteDelegate call. |
191 class VIEWS_EXPORT WidgetDelegateView : public WidgetDelegate, public View { | 198 class VIEWS_EXPORT WidgetDelegateView : public WidgetDelegate, public View { |
192 public: | 199 public: |
193 WidgetDelegateView(); | 200 WidgetDelegateView(); |
194 virtual ~WidgetDelegateView(); | 201 virtual ~WidgetDelegateView(); |
195 | 202 |
196 // Overridden from WidgetDelegate: | 203 // Overridden from WidgetDelegate: |
197 virtual void DeleteDelegate() OVERRIDE; | 204 virtual void DeleteDelegate() OVERRIDE; |
198 virtual Widget* GetWidget() OVERRIDE; | 205 virtual Widget* GetWidget() OVERRIDE; |
199 virtual const Widget* GetWidget() const OVERRIDE; | 206 virtual const Widget* GetWidget() const OVERRIDE; |
200 | 207 |
201 private: | 208 private: |
202 DISALLOW_COPY_AND_ASSIGN(WidgetDelegateView); | 209 DISALLOW_COPY_AND_ASSIGN(WidgetDelegateView); |
203 }; | 210 }; |
204 | 211 |
205 } // namespace views | 212 } // namespace views |
206 | 213 |
207 #endif // UI_VIEWS_WIDGET_WIDGET_DELEGATE_H_ | 214 #endif // UI_VIEWS_WIDGET_WIDGET_DELEGATE_H_ |
OLD | NEW |