Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: chrome/views/default_non_client_view.h

Issue 27317: Support DWM switching.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/views/custom_frame_window.cc ('k') | chrome/views/default_non_client_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_VIEWS_DEFAULT_NON_CLIENT_VIEW_H_
6 #define CHROME_VIEWS_DEFAULT_NON_CLIENT_VIEW_H_
7
8 #include "chrome/views/button.h"
9 #include "chrome/views/custom_frame_window.h"
10 #include "chrome/views/non_client_view.h"
11 #include "chrome/views/window_resources.h"
12
13 namespace gfx{
14 class Size;
15 class Path;
16 class Point;
17 }
18 class ChromeCanvas;
19
20 namespace views {
21
22 class ClientView;
23
24 ///////////////////////////////////////////////////////////////////////////////
25 //
26 // DefaultNonClientView
27 //
28 // A ChromeView that provides the "frame" for CustomFrameWindows. This means
29 // rendering the non-standard window caption, border, and controls.
30 //
31 ////////////////////////////////////////////////////////////////////////////////
32 class DefaultNonClientView : public NonClientView,
33 public BaseButton::ButtonListener {
34 public:
35 explicit DefaultNonClientView(CustomFrameWindow* container);
36 virtual ~DefaultNonClientView();
37
38 // Overridden from views::NonClientView:
39 virtual gfx::Rect CalculateClientAreaBounds(int width, int height) const;
40 virtual gfx::Size CalculateWindowSizeForClientSize(int width,
41 int height) const;
42 virtual gfx::Point GetSystemMenuPoint() const;
43 virtual int NonClientHitTest(const gfx::Point& point);
44 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask);
45 virtual void EnableClose(bool enable);
46 virtual void ResetWindowControls();
47
48 // View overrides:
49 virtual void Paint(ChromeCanvas* canvas);
50 virtual void Layout();
51 virtual gfx::Size GetPreferredSize();
52 virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
53
54 // BaseButton::ButtonListener implementation:
55 virtual void ButtonPressed(BaseButton* sender);
56
57 private:
58 // Returns the thickness of the border that makes up the window frame edges.
59 // This does not include any client edge.
60 int FrameBorderThickness() const;
61
62 // Returns the thickness of the entire nonclient left, right, and bottom
63 // borders, including both the window frame and any client edge.
64 int NonClientBorderThickness() const;
65
66 // Returns the height of the entire nonclient top border, including the window
67 // frame, any title area, and any connected client edge.
68 int NonClientTopBorderHeight() const;
69
70 // A bottom border, and, in restored mode, a client edge are drawn at the
71 // bottom of the titlebar. This returns the total height drawn.
72 int BottomEdgeThicknessWithinNonClientHeight() const;
73
74 // Calculates multiple values related to title layout. Returns the height of
75 // the entire titlebar including any connected client edge.
76 int TitleCoordinates(int* title_top_spacing,
77 int* title_thickness) const;
78
79 // Paint various sub-components of this view.
80 void PaintRestoredFrameBorder(ChromeCanvas* canvas);
81 void PaintMaximizedFrameBorder(ChromeCanvas* canvas);
82 void PaintTitleBar(ChromeCanvas* canvas);
83 void PaintRestoredClientEdge(ChromeCanvas* canvas);
84
85 // Layout various sub-components of this view.
86 void LayoutWindowControls();
87 void LayoutTitleBar();
88 void LayoutClientView();
89
90 // Returns the resource collection to be used when rendering the window.
91 WindowResources* resources() const {
92 return container_->is_active() || paint_as_active() ? active_resources_
93 : inactive_resources_;
94 }
95
96 // The View that provides the background for the window, and optionally
97 // dialog buttons. Note: the non-client view does _not_ own this view, the
98 // container does.
99 ClientView* client_view_;
100
101 // The layout rect of the title, if visible.
102 gfx::Rect title_bounds_;
103
104 // Window controls.
105 Button* close_button_;
106 Button* restore_button_;
107 Button* maximize_button_;
108 Button* minimize_button_;
109 Button* system_menu_button_; // Uses the window icon if visible.
110 bool should_show_minmax_buttons_;
111
112 // The window that owns this view.
113 CustomFrameWindow* container_;
114
115 // Initialize various static resources.
116 static void InitClass();
117 static WindowResources* active_resources_;
118 static WindowResources* inactive_resources_;
119 static ChromeFont title_font_;
120
121 DISALLOW_EVIL_CONSTRUCTORS(DefaultNonClientView);
122 };
123
124 } // namespace views
125
126 #endif // #ifndef CHROME_VIEWS_DEFAULT_NON_CLIENT_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/views/custom_frame_window.cc ('k') | chrome/views/default_non_client_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698