From 0b609eee74dc548e3f63aa328b037ca0c1bef2da Mon Sep 17 00:00:00 2001 From: "ben@chromium.org" Date: Fri, 4 Mar 2011 23:31:59 +0000 Subject: Make more methods on Widget non-virtual and move to NativeWidget BUG=72040 TEST=none Review URL: http://codereview.chromium.org/6623025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76997 0039d316-1c4b-4281-b951-d872f2087c98 --- views/widget/widget.cc | 87 +++++++++++++++++++++++++++++--------------------- 1 file changed, 50 insertions(+), 37 deletions(-) (limited to 'views/widget/widget.cc') diff --git a/views/widget/widget.cc b/views/widget/widget.cc index b805983..c34eb09 100644 --- a/views/widget/widget.cc +++ b/views/widget/widget.cc @@ -25,6 +25,8 @@ Widget::Widget() Widget::~Widget() { } +// Unconverted methods (see header) -------------------------------------------- + void Widget::Init(gfx::NativeView parent, const gfx::Rect& bounds) { GetRootView(); default_theme_provider_.reset(new DefaultThemeProvider); @@ -33,6 +35,42 @@ void Widget::Init(gfx::NativeView parent, const gfx::Rect& bounds) { void Widget::InitWithWidget(Widget* parent, const gfx::Rect& bounds) { } +gfx::NativeView Widget::GetNativeView() const { + return NULL; +} + +void Widget::GenerateMousePressedForView(View* view, const gfx::Point& point) { +} + +bool Widget::GetAccelerator(int cmd_id, ui::Accelerator* accelerator) { + return false; +} + +Window* Widget::GetWindow() { + return NULL; +} + +const Window* Widget::GetWindow() const { + return NULL; +} + +void Widget::ViewHierarchyChanged(bool is_add, View* parent, View* child) { + if (!is_add) { + if (child == dragged_view_) + dragged_view_ = NULL; + + FocusManager* focus_manager = GetFocusManager(); + if (focus_manager) { + if (focus_manager->GetFocusedView() == child) + focus_manager->SetFocusedView(NULL); + focus_manager->ViewRemoved(parent, child); + } + ViewStorage::GetInstance()->ViewRemoved(parent, child); + } +} + +// Converted methods (see header) ---------------------------------------------- + Widget* Widget::GetTopLevelWidget() { return const_cast( const_cast(this)->GetTopLevelWidget()); @@ -57,34 +95,39 @@ gfx::Rect Widget::GetClientAreaScreenBounds() const { } void Widget::SetBounds(const gfx::Rect& bounds) { + native_widget_->SetBounds(bounds); } void Widget::MoveAbove(Widget* widget) { + native_widget_->MoveAbove(widget); } void Widget::SetShape(gfx::NativeRegion shape) { + native_widget_->SetShape(shape); } void Widget::Close() { + native_widget_->Close(); } void Widget::CloseNow() { + native_widget_->CloseNow(); } void Widget::Show() { + native_widget_->Show(); } void Widget::Hide() { -} - -gfx::NativeView Widget::GetNativeView() const { - return NULL; + native_widget_->Hide(); } void Widget::SetOpacity(unsigned char opacity) { + native_widget_->SetOpacity(opacity); } void Widget::SetAlwaysOnTop(bool on_top) { + native_widget_->SetAlwaysOnTop(on_top); } RootView* Widget::GetRootView() { @@ -96,30 +139,15 @@ RootView* Widget::GetRootView() { } bool Widget::IsVisible() const { - return false; + return native_widget_->IsVisible(); } bool Widget::IsActive() const { - return false; + return native_widget_->IsActive(); } bool Widget::IsAccessibleWidget() const { - return false; -} - -void Widget::GenerateMousePressedForView(View* view, const gfx::Point& point) { -} - -bool Widget::GetAccelerator(int cmd_id, ui::Accelerator* accelerator) { - return false; -} - -Window* Widget::GetWindow() { - return NULL; -} - -const Window* Widget::GetWindow() const { - return NULL; + return native_widget_->IsAccessibleWidget(); } ThemeProvider* Widget::GetThemeProvider() const { @@ -146,21 +174,6 @@ FocusManager* Widget::GetFocusManager() { return focus_manager_.get(); } -void Widget::ViewHierarchyChanged(bool is_add, View* parent, View* child) { - if (!is_add) { - if (child == dragged_view_) - dragged_view_ = NULL; - - FocusManager* focus_manager = GetFocusManager(); - if (focus_manager) { - if (focus_manager->GetFocusedView() == child) - focus_manager->SetFocusedView(NULL); - focus_manager->ViewRemoved(parent, child); - } - ViewStorage::GetInstance()->ViewRemoved(parent, child); - } -} - bool Widget::ContainsNativeView(gfx::NativeView native_view) { if (native_widget_->ContainsNativeView(native_view)) return true; -- cgit v1.1