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..51556df2d353babbcf8141f14f718336302cbc3c 100644 |
--- a/ui/views/window/custom_frame_view.h |
+++ b/ui/views/window/custom_frame_view.h |
@@ -5,12 +5,19 @@ |
#ifndef UI_VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ |
#define UI_VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ |
+#include <vector> |
+ |
#include "base/basictypes.h" |
#include "base/compiler_specific.h" |
#include "base/memory/scoped_ptr.h" |
#include "ui/views/controls/button/button.h" |
+#include "ui/views/window/frame_buttons.h" |
#include "ui/views/window/non_client_view.h" |
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
+#include "ui/views/linux_ui/window_button_order_observer.h" |
+#endif |
+ |
namespace gfx { |
class ImageSkia; |
} |
@@ -29,15 +36,18 @@ class Widget; |
// rendering the non-standard window caption, border, and controls. |
// |
//////////////////////////////////////////////////////////////////////////////// |
-class CustomFrameView : public NonClientFrameView, |
- public ButtonListener { |
+class VIEWS_EXPORT CustomFrameView : public NonClientFrameView, |
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
+ public WindowButtonOrderObserver, |
sadrul
2014/04/30 15:46:54
Instead of making the CustomFrameView a WindowButt
|
+#endif |
+ public ButtonListener { |
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 +58,26 @@ 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: |
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
+ // WindowButtonOrderObserver: |
+ virtual void OnWindowButtonOrderingChange( |
+ const std::vector<views::FrameButton>& leading_buttons, |
+ const std::vector<views::FrameButton>& trailing_buttons) OVERRIDE; |
+#endif |
+ |
+ // ButtonListener: |
virtual void ButtonPressed(Button* sender, const ui::Event& event) 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; |
@@ -104,8 +123,18 @@ class CustomFrameView : public NonClientFrameView, |
SkColor GetFrameColor() const; |
const gfx::ImageSkia* GetFrameImage() const; |
- // Layout various sub-components of this view. |
+ // Sets visibility, sizing, and position of an individual button. The value |
+ // of |x| and |y| will be the origin for the button. |
+ void LayoutButton(ImageButton* button, int x, int y); |
+ |
+ // Performs the layout for the window control buttons based on the |
+ // configuration specified in |leading_buttons_| and |trailing_buttons_|. |
+ // The sizing and positions of the buttons affects LayoutTitleBar, call |
+ // this beforehand. |
void LayoutWindowControls(); |
+ |
+ // Calculations depend on the positions of the window controls. Always call |
+ // LayoutWindowControls beforehand. |
void LayoutTitleBar(); |
void LayoutClientView(); |
@@ -116,6 +145,10 @@ class CustomFrameView : public NonClientFrameView, |
int hot_image_id, |
int pushed_image_id); |
+ // Returns the window caption button for the given FrameButton type, if it |
+ // should be visible. Otherwise NULL. |
+ ImageButton* GetImageButton(views::FrameButton button); |
+ |
// The bounds of the client view, in this view's coordinates. |
gfx::Rect client_view_bounds_; |
@@ -140,6 +173,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_; |
flackr
2014/04/29 15:58:28
It's unfortunate to have a copy of these button or
jonross
2014/04/30 15:50:51
Added a TODO
On 2014/04/29 15:58:28, flackr wrote
|
+ |
+ // 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); |
}; |