Index: views/widget/widget_win.cc |
=================================================================== |
--- views/widget/widget_win.cc (revision 76963) |
+++ views/widget/widget_win.cc (working copy) |
@@ -211,6 +211,82 @@ |
Init(parent->GetNativeView(), bounds); |
} |
+gfx::NativeView WidgetWin::GetNativeView() const { |
+ return WindowImpl::hwnd(); |
+} |
+ |
+void WidgetWin::GenerateMousePressedForView(View* view, |
+ const gfx::Point& point) { |
+ gfx::Point point_in_widget(point); |
+ View::ConvertPointToWidget(view, &point_in_widget); |
+ GetRootView()->SetMouseHandler(view); |
+ ProcessMousePressed(point_in_widget.ToPOINT(), MK_LBUTTON, false, false); |
+} |
+ |
+bool WidgetWin::GetAccelerator(int cmd_id, ui::Accelerator* accelerator) { |
+ return false; |
+} |
+ |
+Window* WidgetWin::GetWindow() { |
+ return GetWindowImpl(hwnd()); |
+} |
+ |
+const Window* WidgetWin::GetWindow() const { |
+ return GetWindowImpl(hwnd()); |
+} |
+ |
+void WidgetWin::ViewHierarchyChanged(bool is_add, View* parent, |
+ View* child) { |
+ Widget::ViewHierarchyChanged(is_add, parent, child); |
+ if (drop_target_.get()) |
+ drop_target_->ResetTargetViewIfEquals(child); |
+ |
+ if (!is_add) |
+ ClearAccessibilityViewEvent(child); |
+} |
+ |
+//////////////////////////////////////////////////////////////////////////////// |
+// WidgetWin, NativeWidget implementation: |
+ |
+Widget* WidgetWin::GetWidget() { |
+ return this; |
+} |
+ |
+void WidgetWin::SetNativeWindowProperty(const char* name, void* value) { |
+ // Remove the existing property (if any). |
+ for (ViewProps::iterator i = props_.begin(); i != props_.end(); ++i) { |
+ if ((*i)->Key() == name) { |
+ props_.erase(i); |
+ break; |
+ } |
+ } |
+ |
+ if (value) |
+ props_.push_back(new ViewProp(hwnd(), name, value)); |
+} |
+ |
+void* WidgetWin::GetNativeWindowProperty(const char* name) { |
+ return ViewProp::GetValue(hwnd(), name); |
+} |
+ |
+TooltipManager* WidgetWin::GetTooltipManager() const { |
+ return tooltip_manager_.get(); |
+} |
+ |
+gfx::Rect WidgetWin::GetWindowScreenBounds() const { |
+ RECT r; |
+ GetWindowRect(&r); |
+ return gfx::Rect(r); |
+} |
+ |
+gfx::Rect WidgetWin::GetClientAreaScreenBounds() const { |
+ RECT r; |
+ GetClientRect(&r); |
+ POINT point = { r.left, r.top }; |
+ ClientToScreen(hwnd(), &point); |
+ return gfx::Rect(point.x, point.y, r.right - r.left, r.bottom - r.top); |
+} |
+ |
void WidgetWin::SetBounds(const gfx::Rect& bounds) { |
LONG style = GetWindowLong(GWL_STYLE); |
if (style & WS_MAXIMIZE) |
@@ -220,9 +296,8 @@ |
} |
void WidgetWin::MoveAbove(Widget* other) { |
- gfx::Rect bounds = GetClientAreaScreenBounds(); |
- SetWindowPos(other->GetNativeView(), bounds.x(), bounds.y(), |
- bounds.width(), bounds.height(), SWP_NOACTIVATE); |
+ SetWindowPos(other->GetNativeView(), 0, 0, 0, 0, |
+ SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); |
} |
void WidgetWin::SetShape(gfx::NativeRegion region) { |
@@ -273,10 +348,6 @@ |
} |
} |
-gfx::NativeView WidgetWin::GetNativeView() const { |
- return WindowImpl::hwnd(); |
-} |
- |
void WidgetWin::SetOpacity(unsigned char opacity) { |
layered_alpha_ = static_cast<BYTE>(opacity); |
} |
@@ -300,78 +371,6 @@ |
return screen_reader_active_; |
} |
-void WidgetWin::GenerateMousePressedForView(View* view, |
- const gfx::Point& point) { |
- gfx::Point point_in_widget(point); |
- View::ConvertPointToWidget(view, &point_in_widget); |
- GetRootView()->SetMouseHandler(view); |
- ProcessMousePressed(point_in_widget.ToPOINT(), MK_LBUTTON, false, false); |
-} |
- |
-bool WidgetWin::GetAccelerator(int cmd_id, ui::Accelerator* accelerator) { |
- return false; |
-} |
- |
-Window* WidgetWin::GetWindow() { |
- return GetWindowImpl(hwnd()); |
-} |
- |
-const Window* WidgetWin::GetWindow() const { |
- return GetWindowImpl(hwnd()); |
-} |
- |
-void WidgetWin::ViewHierarchyChanged(bool is_add, View* parent, |
- View* child) { |
- Widget::ViewHierarchyChanged(is_add, parent, child); |
- if (drop_target_.get()) |
- drop_target_->ResetTargetViewIfEquals(child); |
- |
- if (!is_add) |
- ClearAccessibilityViewEvent(child); |
-} |
- |
-//////////////////////////////////////////////////////////////////////////////// |
-// WidgetWin, NativeWidget implementation: |
- |
-Widget* WidgetWin::GetWidget() { |
- return this; |
-} |
- |
-void WidgetWin::SetNativeWindowProperty(const char* name, void* value) { |
- // Remove the existing property (if any). |
- for (ViewProps::iterator i = props_.begin(); i != props_.end(); ++i) { |
- if ((*i)->Key() == name) { |
- props_.erase(i); |
- break; |
- } |
- } |
- |
- if (value) |
- props_.push_back(new ViewProp(hwnd(), name, value)); |
-} |
- |
-void* WidgetWin::GetNativeWindowProperty(const char* name) { |
- return ViewProp::GetValue(hwnd(), name); |
-} |
- |
-TooltipManager* WidgetWin::GetTooltipManager() const { |
- return tooltip_manager_.get(); |
-} |
- |
-gfx::Rect WidgetWin::GetWindowScreenBounds() const { |
- RECT r; |
- GetWindowRect(&r); |
- return gfx::Rect(r); |
-} |
- |
-gfx::Rect WidgetWin::GetClientAreaScreenBounds() const { |
- RECT r; |
- GetClientRect(&r); |
- POINT point = { r.left, r.top }; |
- ClientToScreen(hwnd(), &point); |
- return gfx::Rect(point.x, point.y, r.right - r.left, r.bottom - r.top); |
-} |
- |
bool WidgetWin::ContainsNativeView(gfx::NativeView native_view) const { |
if (hwnd() == native_view) |
return true; |