diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-01 00:07:00 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-01 00:07:00 +0000 |
commit | a2920638f52df5d5e0e3ea86c1802d4a7416abe5 (patch) | |
tree | 635245f5d524df6ce6a10ec75db72f81639a4156 /views/widget/widget_win.cc | |
parent | fb3ef9384cc76c4237f98e5aa38d2689cc7b60cd (diff) | |
download | chromium_src-a2920638f52df5d5e0e3ea86c1802d4a7416abe5.zip chromium_src-a2920638f52df5d5e0e3ea86c1802d4a7416abe5.tar.gz chromium_src-a2920638f52df5d5e0e3ea86c1802d4a7416abe5.tar.bz2 |
Status bubble limping in TOOLKIT_VIEWS.
Add CreateTransparentFloatingWidget method to Widget and add Init/SetContentsView methods.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/160474
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22229 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget/widget_win.cc')
-rw-r--r-- | views/widget/widget_win.cc | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index ed58ae9..1f49d1d 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -6,13 +6,13 @@ #include "app/gfx/canvas.h" #include "app/gfx/path.h" +#include "app/l10n_util_win.h" #include "app/win_util.h" #include "base/gfx/native_theme.h" #include "base/string_util.h" #include "base/win_util.h" #include "views/accessibility/view_accessibility.h" #include "views/controls/native_control_win.h" -#include "views/fill_layout.h" #include "views/focus/focus_util_win.h" #include "views/views_delegate.h" #include "views/widget/aero_tooltip_manager.h" @@ -154,7 +154,10 @@ WidgetWin::~WidgetWin() { MessageLoopForUI::current()->RemoveObserver(this); } -void WidgetWin::Init(HWND parent, const gfx::Rect& bounds) { +/////////////////////////////////////////////////////////////////////////////// +// Widget implementation: + +void WidgetWin::Init(gfx::NativeView parent, const gfx::Rect& bounds) { if (window_style_ == 0) window_style_ = parent ? kWindowDefaultChildStyle : kWindowDefaultStyle; @@ -218,24 +221,9 @@ void WidgetWin::Init(HWND parent, const gfx::Rect& bounds) { } void WidgetWin::SetContentsView(View* view) { - DCHECK(view && hwnd_) << "Can't be called until after the HWND is created!"; - // The ContentsView must be set up _after_ the window is created so that its - // Widget pointer is valid. - root_view_->SetLayoutManager(new FillLayout); - if (root_view_->GetChildViewCount() != 0) - root_view_->RemoveAllChildViews(true); - root_view_->AddChildView(view); - - // Force a layout now, since the attached hierarchy won't be ready for the - // containing window's bounds. Note that we call Layout directly rather than - // calling ChangeSize, since the RootView's bounds may not have changed, which - // will cause the Layout not to be done otherwise. - root_view_->Layout(); + root_view_->SetContentsView(view); } -/////////////////////////////////////////////////////////////////////////////// -// Widget implementation: - void WidgetWin::GetBounds(gfx::Rect* out, bool including_frame) const { CRect crect; if (including_frame) { @@ -1088,4 +1076,20 @@ void WidgetWin::PostProcessActivateMessage(WidgetWin* widget, widget->focus_manager_->RestoreFocusedView(); } } + +//////////////////////////////////////////////////////////////////////////////// +// Widget, public: + +// static +Widget* Widget::CreateTransparentPopupWidget(bool delete_on_destroy) { + WidgetWin* popup = new WidgetWin; + popup->set_window_style(WS_POPUP); + popup->set_window_ex_style(WS_EX_LAYERED | WS_EX_TOOLWINDOW | + WS_EX_TRANSPARENT | + l10n_util::GetExtendedTooltipStyles()); + popup->set_delete_on_destroy(delete_on_destroy); + return popup; +} + } // namespace views + |