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

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

Issue 7344: Convert GetPreferredSize from:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 CHROME_VIEWS_HWND_VIEW_H__ 5 #ifndef CHROME_VIEWS_HWND_VIEW_H__
6 #define CHROME_VIEWS_HWND_VIEW_H__ 6 #define CHROME_VIEWS_HWND_VIEW_H__
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "chrome/views/view.h" 10 #include "chrome/views/view.h"
11 11
12 namespace ChromeViews { 12 namespace ChromeViews {
13 13
14 ///////////////////////////////////////////////////////////////////////////// 14 /////////////////////////////////////////////////////////////////////////////
15 // 15 //
16 // HWNDView class 16 // HWNDView class
17 // 17 //
18 // The HWNDView class hosts a native window handle (HWND) sizing it 18 // The HWNDView class hosts a native window handle (HWND) sizing it
19 // according to the bounds of the view. This is useful whenever you need to 19 // according to the bounds of the view. This is useful whenever you need to
20 // show a UI control that has a HWND (e.g. a native windows Edit control) 20 // show a UI control that has a HWND (e.g. a native windows Edit control)
21 // within thew View hierarchy and benefit from the sizing/layout. 21 // within thew View hierarchy and benefit from the sizing/layout.
22 // 22 //
23 ///////////////////////////////////////////////////////////////////////////// 23 /////////////////////////////////////////////////////////////////////////////
24 class HWNDView : public View { 24 class HWNDView : public View {
25 public: 25 public:
26 HWNDView(); 26 HWNDView();
27 virtual ~HWNDView(); 27 virtual ~HWNDView();
28 28
29 virtual void GetPreferredSize(CSize *out); 29 virtual gfx::Size GetPreferredSize();
30 30
31 void SetPreferredSize(const CSize& size); 31 void set_preferred_size(const gfx::Size& size) { preferred_size_ = size; }
32 32
33 // Attach a window handle to this View, making the window it represents 33 // Attach a window handle to this View, making the window it represents
34 // subject to sizing according to this View's parent container's Layout 34 // subject to sizing according to this View's parent container's Layout
35 // Manager's sizing heuristics. 35 // Manager's sizing heuristics.
36 void Attach(HWND hwnd); 36 void Attach(HWND hwnd);
37 37
38 // Detach the attached window handle. It will no longer be updated 38 // Detach the attached window handle. It will no longer be updated
39 void Detach(); 39 void Detach();
40 40
41 virtual void DidChangeBounds(const CRect& previous, const CRect& current); 41 virtual void DidChangeBounds(const CRect& previous, const CRect& current);
(...skipping 25 matching lines...) Expand all
67 67
68 // Notification that our visible bounds relative to the root has changed. 68 // Notification that our visible bounds relative to the root has changed.
69 // This updates the bounds of the HWND. 69 // This updates the bounds of the HWND.
70 virtual void VisibleBoundsInRootChanged(); 70 virtual void VisibleBoundsInRootChanged();
71 71
72 private: 72 private:
73 // The hosted window handle. 73 // The hosted window handle.
74 HWND hwnd_; 74 HWND hwnd_;
75 75
76 // The preferred size of this View 76 // The preferred size of this View
77 CSize preferred_size_; 77 gfx::Size preferred_size_;
78 78
79 // Have we installed a region on the HWND used to clip to only the visible 79 // Have we installed a region on the HWND used to clip to only the visible
80 // portion of the HWND? 80 // portion of the HWND?
81 bool installed_clip_; 81 bool installed_clip_;
82 82
83 // Fast resizing will move the hwnd and clip its window region, this will 83 // Fast resizing will move the hwnd and clip its window region, this will
84 // result in white areas and will not resize the content (so scrollbars 84 // result in white areas and will not resize the content (so scrollbars
85 // will be all wrong and content will flow offscreen). Only use this 85 // will be all wrong and content will flow offscreen). Only use this
86 // when you're doing extremely quick, high-framerate vertical resizes 86 // when you're doing extremely quick, high-framerate vertical resizes
87 // and don't care about accuracy. Make sure you do a real resize at the 87 // and don't care about accuracy. Make sure you do a real resize at the
88 // end. USE WITH CAUTION. 88 // end. USE WITH CAUTION.
89 bool fast_resize_; 89 bool fast_resize_;
90 90
91 // The view that should be given focus when this HWNDView is focused. 91 // The view that should be given focus when this HWNDView is focused.
92 View* focus_view_; 92 View* focus_view_;
93 }; 93 };
94 94
95 } 95 }
96 96
97 #endif // CHROME_VIEWS_HWND_VIEW_H__ 97 #endif // CHROME_VIEWS_HWND_VIEW_H__
98 98
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698