Chromium Code Reviews| Index: ui/views/window/custom_frame_view.h |
| diff --git a/ui/views/window/custom_frame_view.h b/ui/views/window/custom_frame_view.h |
| index 96dbd225c19307a819ce6b140318f39a13b83f4b..78ca7a32c9a2f81f7725a2934ef8e526ce7e913e 100644 |
| --- a/ui/views/window/custom_frame_view.h |
| +++ b/ui/views/window/custom_frame_view.h |
| @@ -9,6 +9,8 @@ |
| #include "base/compiler_specific.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "ui/views/controls/button/button.h" |
| +#include "ui/views/linux_ui/window_button_order_observer.h" |
|
flackr
2014/04/22 18:36:45
Including ui/views/linux_ui/ from all views platfo
jonross
2014/04/23 18:53:53
Done.
|
| +#include "ui/views/window/frame_buttons.h" |
| #include "ui/views/window/non_client_view.h" |
| namespace gfx { |
| @@ -29,15 +31,16 @@ class Widget; |
| // rendering the non-standard window caption, border, and controls. |
| // |
| //////////////////////////////////////////////////////////////////////////////// |
| -class CustomFrameView : public NonClientFrameView, |
| - public ButtonListener { |
| +class VIEWS_EXPORT CustomFrameView : public NonClientFrameView, |
| + public ButtonListener, |
| + public WindowButtonOrderObserver { |
|
flackr
2014/04/22 18:36:45
nit: align public, which probably means wrapping t
jonross
2014/04/23 18:53:53
Done.
|
| public: |
| CustomFrameView(); |
| virtual ~CustomFrameView(); |
| void Init(Widget* frame); |
| - // Overridden from NonClientFrameView: |
| + // NonClientFrameView: |
| virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; |
| virtual gfx::Rect GetWindowBoundsForClientBounds( |
| const gfx::Rect& client_bounds) const OVERRIDE; |
| @@ -48,17 +51,24 @@ class CustomFrameView : public NonClientFrameView, |
| virtual void UpdateWindowIcon() OVERRIDE; |
| virtual void UpdateWindowTitle() OVERRIDE; |
| - // Overridden from View: |
| + // View: |
| virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| virtual void Layout() OVERRIDE; |
| virtual gfx::Size GetPreferredSize() OVERRIDE; |
| virtual gfx::Size GetMinimumSize() OVERRIDE; |
| virtual gfx::Size GetMaximumSize() OVERRIDE; |
| - // Overridden from ButtonListener: |
| + // ButtonListener: |
| virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE; |
| + // WindowButtonOrderObserver: |
| + virtual void OnWindowButtonOrderingChange( |
| + const std::vector<views::FrameButton>& leading_buttons, |
| + const std::vector<views::FrameButton>& trailing_buttons) OVERRIDE; |
| + |
| private: |
| + friend class CustomFrameViewTest; |
| + |
| // Returns the thickness of the border that makes up the window frame edges. |
| // This does not include any client edge. |
| int FrameBorderThickness() const; |
| @@ -105,6 +115,7 @@ class CustomFrameView : public NonClientFrameView, |
| const gfx::ImageSkia* GetFrameImage() const; |
| // Layout various sub-components of this view. |
| + void LayoutButton(ImageButton* button, int x, int y, bool leading); |
|
flackr
2014/04/22 18:36:45
I think it would be worth documenting this functio
jonross
2014/04/23 18:53:53
Removed the need for leading. Added comments.
|
| void LayoutWindowControls(); |
| void LayoutTitleBar(); |
| void LayoutClientView(); |
| @@ -140,6 +151,17 @@ class CustomFrameView : public NonClientFrameView, |
| // Background painter for the window frame. |
| scoped_ptr<FrameBackground> frame_background_; |
| + // Layout arrangement of the window caption buttons. On linux these will be |
| + // set via OnWindowButtonOrderingChange. On other platforms a default |
| + // arrangement of a trailing minimize, maximize, close, will be set. |
| + std::vector<views::FrameButton> leading_buttons_; |
| + std::vector<views::FrameButton> trailing_buttons_; |
| + |
| + // The horizontal boundaries for the title bar to layout within. Restricted |
| + // by the space used by the leading and trailing buttons. |
| + int minimum_title_bar_x_; |
| + int maximum_title_bar_x_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(CustomFrameView); |
| }; |