| 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_WINDOW_CLIENT_VIEW_H_ | 5 #ifndef UI_VIEWS_WINDOW_CLIENT_VIEW_H_ |
| 6 #define UI_VIEWS_WINDOW_CLIENT_VIEW_H_ | 6 #define UI_VIEWS_WINDOW_CLIENT_VIEW_H_ |
| 7 | 7 |
| 8 #include "ui/views/view.h" | 8 #include "ui/views/view.h" |
| 9 | 9 |
| 10 namespace views { | 10 namespace views { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class VIEWS_EXPORT ClientView : public View { | 23 class VIEWS_EXPORT ClientView : public View { |
| 24 public: | 24 public: |
| 25 // Internal class name | 25 // Internal class name |
| 26 static const char kViewClassName[]; | 26 static const char kViewClassName[]; |
| 27 | 27 |
| 28 // Constructs a ClientView object for the specified widget with the specified | 28 // Constructs a ClientView object for the specified widget with the specified |
| 29 // contents. Since this object is created during the process of creating | 29 // contents. Since this object is created during the process of creating |
| 30 // |widget|, |contents_view| must be valid if you want the initial size of | 30 // |widget|, |contents_view| must be valid if you want the initial size of |
| 31 // the widget to be based on |contents_view|'s preferred size. | 31 // the widget to be based on |contents_view|'s preferred size. |
| 32 ClientView(Widget* widget, View* contents_view); | 32 ClientView(Widget* widget, View* contents_view); |
| 33 virtual ~ClientView() {} | 33 ~ClientView() override {} |
| 34 | 34 |
| 35 // Manual RTTI ftw. | 35 // Manual RTTI ftw. |
| 36 virtual DialogClientView* AsDialogClientView(); | 36 virtual DialogClientView* AsDialogClientView(); |
| 37 virtual const DialogClientView* AsDialogClientView() const; | 37 virtual const DialogClientView* AsDialogClientView() const; |
| 38 | 38 |
| 39 // Returns true to signal that the Widget can be closed. Specialized | 39 // Returns true to signal that the Widget can be closed. Specialized |
| 40 // ClientView subclasses can override this default behavior to allow the | 40 // ClientView subclasses can override this default behavior to allow the |
| 41 // close to be blocked until the user corrects mistakes, accepts a warning | 41 // close to be blocked until the user corrects mistakes, accepts a warning |
| 42 // dialog, etc. | 42 // dialog, etc. |
| 43 virtual bool CanClose(); | 43 virtual bool CanClose(); |
| 44 | 44 |
| 45 // Notification that the widget is closing. | 45 // Notification that the widget is closing. |
| 46 virtual void WidgetClosing(); | 46 virtual void WidgetClosing(); |
| 47 | 47 |
| 48 // Tests to see if the specified point (in view coordinates) is within the | 48 // Tests to see if the specified point (in view coordinates) is within the |
| 49 // bounds of this view. If so, it returns HTCLIENT in this default | 49 // bounds of this view. If so, it returns HTCLIENT in this default |
| 50 // implementation. If it is outside the bounds of this view, this must return | 50 // implementation. If it is outside the bounds of this view, this must return |
| 51 // HTNOWHERE to tell the caller to do further processing to determine where | 51 // HTNOWHERE to tell the caller to do further processing to determine where |
| 52 // in the non-client area it is (if it is). | 52 // in the non-client area it is (if it is). |
| 53 // Subclasses of ClientView can extend this logic by overriding this method | 53 // Subclasses of ClientView can extend this logic by overriding this method |
| 54 // to detect if regions within the client area count as parts of the "non- | 54 // to detect if regions within the client area count as parts of the "non- |
| 55 // client" area. A good example of this is the size box at the bottom right | 55 // client" area. A good example of this is the size box at the bottom right |
| 56 // corner of resizable dialog boxes. | 56 // corner of resizable dialog boxes. |
| 57 virtual int NonClientHitTest(const gfx::Point& point); | 57 virtual int NonClientHitTest(const gfx::Point& point); |
| 58 | 58 |
| 59 // Overridden from View: | 59 // Overridden from View: |
| 60 virtual gfx::Size GetPreferredSize() const override; | 60 gfx::Size GetPreferredSize() const override; |
| 61 virtual gfx::Size GetMinimumSize() const override; | 61 gfx::Size GetMinimumSize() const override; |
| 62 virtual gfx::Size GetMaximumSize() const override; | 62 gfx::Size GetMaximumSize() const override; |
| 63 virtual void Layout() override; | 63 void Layout() override; |
| 64 virtual const char* GetClassName() const override; | 64 const char* GetClassName() const override; |
| 65 | 65 |
| 66 protected: | 66 protected: |
| 67 // Overridden from View: | 67 // Overridden from View: |
| 68 virtual void GetAccessibleState(ui::AXViewState* state) override; | 68 void GetAccessibleState(ui::AXViewState* state) override; |
| 69 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; | 69 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; |
| 70 virtual void ViewHierarchyChanged( | 70 void ViewHierarchyChanged( |
| 71 const ViewHierarchyChangedDetails& details) override; | 71 const ViewHierarchyChangedDetails& details) override; |
| 72 | 72 |
| 73 // Accessors for private data members. | 73 // Accessors for private data members. |
| 74 View* contents_view() const { return contents_view_; } | 74 View* contents_view() const { return contents_view_; } |
| 75 void set_contents_view(View* contents_view) { | 75 void set_contents_view(View* contents_view) { |
| 76 contents_view_ = contents_view; | 76 contents_view_ = contents_view; |
| 77 } | 77 } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 // The View that this ClientView contains. | 80 // The View that this ClientView contains. |
| 81 View* contents_view_; | 81 View* contents_view_; |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 } // namespace views | 84 } // namespace views |
| 85 | 85 |
| 86 #endif // UI_VIEWS_WINDOW_CLIENT_VIEW_H_ | 86 #endif // UI_VIEWS_WINDOW_CLIENT_VIEW_H_ |
| OLD | NEW |