| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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_gtk.h" | 5 #include "views/widget/widget_gtk.h" |
| 6 | 6 |
| 7 #include "app/gfx/path.h" | 7 #include "app/gfx/path.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "views/fill_layout.h" | 9 #include "views/fill_layout.h" |
| 10 #include "views/widget/default_theme_provider.h" | 10 #include "views/widget/default_theme_provider.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 << "Can't be called until after the HWND is created!"; | 229 << "Can't be called until after the HWND is created!"; |
| 230 // The ContentsView must be set up _after_ the window is created so that its | 230 // The ContentsView must be set up _after_ the window is created so that its |
| 231 // Widget pointer is valid. | 231 // Widget pointer is valid. |
| 232 root_view_->SetLayoutManager(new FillLayout); | 232 root_view_->SetLayoutManager(new FillLayout); |
| 233 if (root_view_->GetChildViewCount() != 0) | 233 if (root_view_->GetChildViewCount() != 0) |
| 234 root_view_->RemoveAllChildViews(true); | 234 root_view_->RemoveAllChildViews(true); |
| 235 root_view_->AddChildView(view); | 235 root_view_->AddChildView(view); |
| 236 | 236 |
| 237 DCHECK(widget_); // Widget must have been created by now. | 237 DCHECK(widget_); // Widget must have been created by now. |
| 238 | 238 |
| 239 OnSizeAllocate(widget_, &(widget_->allocation)); | 239 // Force a layout now, since the attached hierarchy won't be ready for the |
| 240 // containing window's bounds. Note that we call Layout directly rather than |
| 241 // calling OnSizeAllocate, since the RootView's bounds may not have changed, |
| 242 // which will cause the Layout not to be done otherwise. |
| 243 root_view_->Layout(); |
| 240 } | 244 } |
| 241 | 245 |
| 242 //////////////////////////////////////////////////////////////////////////////// | 246 //////////////////////////////////////////////////////////////////////////////// |
| 243 // WidgetGtk, Widget implementation: | 247 // WidgetGtk, Widget implementation: |
| 244 | 248 |
| 245 void WidgetGtk::GetBounds(gfx::Rect* out, bool including_frame) const { | 249 void WidgetGtk::GetBounds(gfx::Rect* out, bool including_frame) const { |
| 246 DCHECK(widget_); | 250 DCHECK(widget_); |
| 247 | 251 |
| 248 int x = 0, y = 0, w, h; | 252 int x = 0, y = 0, w, h; |
| 249 if (GTK_IS_WINDOW(widget_)) { | 253 if (GTK_IS_WINDOW(widget_)) { |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 void WidgetGtk::HandleGrabBroke() { | 814 void WidgetGtk::HandleGrabBroke() { |
| 811 if (has_capture_) { | 815 if (has_capture_) { |
| 812 if (is_mouse_down_) | 816 if (is_mouse_down_) |
| 813 root_view_->ProcessMouseDragCanceled(); | 817 root_view_->ProcessMouseDragCanceled(); |
| 814 is_mouse_down_ = false; | 818 is_mouse_down_ = false; |
| 815 has_capture_ = false; | 819 has_capture_ = false; |
| 816 } | 820 } |
| 817 } | 821 } |
| 818 | 822 |
| 819 } // namespace views | 823 } // namespace views |
| OLD | NEW |