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

Side by Side Diff: views/widget/widget_win.cc

Issue 160474: Status bubble limping in TOOLKIT_VIEWS.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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
« no previous file with comments | « views/widget/widget_win.h ('k') | views/window/window_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "views/widget/widget_win.h" 5 #include "views/widget/widget_win.h"
6 6
7 #include "app/gfx/canvas.h" 7 #include "app/gfx/canvas.h"
8 #include "app/gfx/path.h" 8 #include "app/gfx/path.h"
9 #include "app/l10n_util_win.h"
9 #include "app/win_util.h" 10 #include "app/win_util.h"
10 #include "base/gfx/native_theme.h" 11 #include "base/gfx/native_theme.h"
11 #include "base/string_util.h" 12 #include "base/string_util.h"
12 #include "base/win_util.h" 13 #include "base/win_util.h"
13 #include "views/accessibility/view_accessibility.h" 14 #include "views/accessibility/view_accessibility.h"
14 #include "views/controls/native_control_win.h" 15 #include "views/controls/native_control_win.h"
15 #include "views/fill_layout.h"
16 #include "views/focus/focus_util_win.h" 16 #include "views/focus/focus_util_win.h"
17 #include "views/views_delegate.h" 17 #include "views/views_delegate.h"
18 #include "views/widget/aero_tooltip_manager.h" 18 #include "views/widget/aero_tooltip_manager.h"
19 #include "views/widget/default_theme_provider.h" 19 #include "views/widget/default_theme_provider.h"
20 #include "views/widget/root_view.h" 20 #include "views/widget/root_view.h"
21 #include "views/window/window_win.h" 21 #include "views/window/window_win.h"
22 22
23 namespace views { 23 namespace views {
24 24
25 static const DWORD kWindowDefaultChildStyle = 25 static const DWORD kWindowDefaultChildStyle =
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 is_mouse_down_(false), 147 is_mouse_down_(false),
148 is_window_(false), 148 is_window_(false),
149 class_style_(CS_DBLCLKS), 149 class_style_(CS_DBLCLKS),
150 hwnd_(NULL) { 150 hwnd_(NULL) {
151 } 151 }
152 152
153 WidgetWin::~WidgetWin() { 153 WidgetWin::~WidgetWin() {
154 MessageLoopForUI::current()->RemoveObserver(this); 154 MessageLoopForUI::current()->RemoveObserver(this);
155 } 155 }
156 156
157 void WidgetWin::Init(HWND parent, const gfx::Rect& bounds) { 157 ///////////////////////////////////////////////////////////////////////////////
158 // Widget implementation:
159
160 void WidgetWin::Init(gfx::NativeView parent, const gfx::Rect& bounds) {
158 if (window_style_ == 0) 161 if (window_style_ == 0)
159 window_style_ = parent ? kWindowDefaultChildStyle : kWindowDefaultStyle; 162 window_style_ = parent ? kWindowDefaultChildStyle : kWindowDefaultStyle;
160 163
161 // See if the style has been overridden. 164 // See if the style has been overridden.
162 opaque_ = !(window_ex_style_ & WS_EX_TRANSPARENT); 165 opaque_ = !(window_ex_style_ & WS_EX_TRANSPARENT);
163 use_layered_buffer_ = (use_layered_buffer_ && 166 use_layered_buffer_ = (use_layered_buffer_ &&
164 !!(window_ex_style_ & WS_EX_LAYERED)); 167 !!(window_ex_style_ & WS_EX_LAYERED));
165 168
166 // Force creation of the RootView if it hasn't been created yet. 169 // Force creation of the RootView if it hasn't been created yet.
167 GetRootView(); 170 GetRootView();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 WM_CHANGEUISTATE, 214 WM_CHANGEUISTATE,
212 MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 215 MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS),
213 0); 216 0);
214 217
215 // Bug 964884: detach the IME attached to this window. 218 // Bug 964884: detach the IME attached to this window.
216 // We should attach IMEs only when we need to input CJK strings. 219 // We should attach IMEs only when we need to input CJK strings.
217 ::ImmAssociateContextEx(GetNativeView(), NULL, 0); 220 ::ImmAssociateContextEx(GetNativeView(), NULL, 0);
218 } 221 }
219 222
220 void WidgetWin::SetContentsView(View* view) { 223 void WidgetWin::SetContentsView(View* view) {
221 DCHECK(view && hwnd_) << "Can't be called until after the HWND is created!"; 224 root_view_->SetContentsView(view);
222 // The ContentsView must be set up _after_ the window is created so that its
223 // Widget pointer is valid.
224 root_view_->SetLayoutManager(new FillLayout);
225 if (root_view_->GetChildViewCount() != 0)
226 root_view_->RemoveAllChildViews(true);
227 root_view_->AddChildView(view);
228
229 // Force a layout now, since the attached hierarchy won't be ready for the
230 // containing window's bounds. Note that we call Layout directly rather than
231 // calling ChangeSize, since the RootView's bounds may not have changed, which
232 // will cause the Layout not to be done otherwise.
233 root_view_->Layout();
234 } 225 }
235 226
236 ///////////////////////////////////////////////////////////////////////////////
237 // Widget implementation:
238
239 void WidgetWin::GetBounds(gfx::Rect* out, bool including_frame) const { 227 void WidgetWin::GetBounds(gfx::Rect* out, bool including_frame) const {
240 CRect crect; 228 CRect crect;
241 if (including_frame) { 229 if (including_frame) {
242 GetWindowRect(&crect); 230 GetWindowRect(&crect);
243 *out = gfx::Rect(crect); 231 *out = gfx::Rect(crect);
244 return; 232 return;
245 } 233 }
246 234
247 GetClientRect(&crect); 235 GetClientRect(&crect);
248 POINT p = {0, 0}; 236 POINT p = {0, 0};
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 return; 1069 return;
1082 } 1070 }
1083 if (WA_INACTIVE == activation_state) { 1071 if (WA_INACTIVE == activation_state) {
1084 widget->focus_manager_->StoreFocusedView(); 1072 widget->focus_manager_->StoreFocusedView();
1085 } else { 1073 } else {
1086 // We must restore the focus after the message has been DefProc'ed as it 1074 // We must restore the focus after the message has been DefProc'ed as it
1087 // does set the focus to the last focused HWND. 1075 // does set the focus to the last focused HWND.
1088 widget->focus_manager_->RestoreFocusedView(); 1076 widget->focus_manager_->RestoreFocusedView();
1089 } 1077 }
1090 } 1078 }
1079
1080 ////////////////////////////////////////////////////////////////////////////////
1081 // Widget, public:
1082
1083 // static
1084 Widget* Widget::CreateTransparentPopupWidget(bool delete_on_destroy) {
1085 WidgetWin* popup = new WidgetWin;
1086 popup->set_window_style(WS_POPUP);
1087 popup->set_window_ex_style(WS_EX_LAYERED | WS_EX_TOOLWINDOW |
1088 WS_EX_TRANSPARENT |
1089 l10n_util::GetExtendedTooltipStyles());
1090 popup->set_delete_on_destroy(delete_on_destroy);
1091 return popup;
1092 }
1093
1091 } // namespace views 1094 } // namespace views
1095
OLDNEW
« no previous file with comments | « views/widget/widget_win.h ('k') | views/window/window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698