diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-27 22:02:17 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-27 22:02:17 +0000 |
commit | cb9bb1317104cc8a7f219fdaeec45723a9e59e0e (patch) | |
tree | 13b96d3041e7a7e0f8f162239e915e4c22055a03 /chrome/views/non_client_view.h | |
parent | 29e75de051f2dfb32e896b359e605e869f9db04e (diff) | |
download | chromium_src-cb9bb1317104cc8a7f219fdaeec45723a9e59e0e.zip chromium_src-cb9bb1317104cc8a7f219fdaeec45723a9e59e0e.tar.gz chromium_src-cb9bb1317104cc8a7f219fdaeec45723a9e59e0e.tar.bz2 |
All views::Window objects must have a NonClientView, regardless of whether or not they fully render their own frame. This simplifies things a bit on the way to unification of Window and CustomFrameWindow.
Review URL: http://codereview.chromium.org/27286
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10632 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/non_client_view.h')
-rw-r--r-- | chrome/views/non_client_view.h | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/chrome/views/non_client_view.h b/chrome/views/non_client_view.h index 2900f98..d4c4a2d 100644 --- a/chrome/views/non_client_view.h +++ b/chrome/views/non_client_view.h @@ -6,6 +6,7 @@ #define CHROME_VIEWS_NON_CLIENT_VIEW_H_ #include "chrome/views/view.h" +#include "chrome/views/client_view.h" namespace gfx { class Path; @@ -13,8 +14,6 @@ class Path; namespace views { -class ClientView; - /////////////////////////////////////////////////////////////////////////////// // NonClientView // @@ -27,6 +26,9 @@ class ClientView; // class NonClientView : public View { public: + NonClientView(); + virtual ~NonClientView(); + // Various edges of the frame border have a 1 px shadow along their edges; in // a few cases we shift elements based on this amount for visual appeal. static const int kFrameShadowThickness; @@ -34,39 +36,45 @@ class NonClientView : public View { // frame border. static const int kClientEdgeThickness; + // Returns true if the ClientView determines that the containing window can be + // closed, false otherwise. + bool CanClose() const; + + // Called by the containing Window when it is closed. + void WindowClosing(); + // Calculates the bounds of the client area of the window assuming the // window is sized to |width| and |height|. - virtual gfx::Rect CalculateClientAreaBounds(int width, - int height) const = 0; + virtual gfx::Rect CalculateClientAreaBounds(int width, int height) const; // Calculates the size of window required to display a client area of the // specified width and height. virtual gfx::Size CalculateWindowSizeForClientSize(int width, - int height) const = 0; + int height) const; // Returns the point, in screen coordinates, where the system menu should // be shown so it shows up anchored to the system menu icon. - virtual gfx::Point GetSystemMenuPoint() const = 0; + virtual gfx::Point GetSystemMenuPoint() const; // Determines the windows HT* code when the mouse cursor is at the // specified point, in window coordinates. - virtual int NonClientHitTest(const gfx::Point& point) = 0; + virtual int NonClientHitTest(const gfx::Point& point); // Returns a mask to be used to clip the top level window for the given // size. This is used to create the non-rectangular window shape. virtual void GetWindowMask(const gfx::Size& size, - gfx::Path* window_mask) = 0; + gfx::Path* window_mask); // Toggles the enable state for the Close button (and the Close menu item in // the system menu). - virtual void EnableClose(bool enable) = 0; + virtual void EnableClose(bool enable); // Tells the window controls as rendered by the NonClientView to reset // themselves to a normal state. This happens in situations where the // containing window does not receive a normal sequences of messages that // would lead to the controls returning to this normal state naturally, e.g. // when the window is maximized, minimized or restored. - virtual void ResetWindowControls() = 0; + virtual void ResetWindowControls(); // Prevents the non-client view from rendering as inactive when called with // |disable| true, until called with false. @@ -74,8 +82,19 @@ class NonClientView : public View { paint_as_active_ = paint_as_active; } + // Get/Set client_view property. + ClientView* client_view() const { return client_view_; } + void set_client_view(ClientView* client_view) { + client_view_ = client_view; + } + + // NonClientView, View overrides: + virtual gfx::Size GetPreferredSize(); + virtual void Layout(); + protected: - NonClientView() : paint_as_active_(false) {} + // NonClientView, View overrides: + virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); // Helper for non-client view implementations to determine which area of the // window border the specified |point| falls within. The other parameters are @@ -92,6 +111,11 @@ class NonClientView : public View { bool paint_as_active() const { return paint_as_active_; } private: + // A ClientView object or subclass, responsible for sizing the contents view + // of the window, hit testing and perhaps other tasks depending on the + // implementation. + ClientView* client_view_; + // True when the non-client view should always be rendered as if the window // were active, regardless of whether or not the top level window actually // is active. |