| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef VIEWS_WIDGET_WIDGET_WIN_H_ | 5 #ifndef VIEWS_WIDGET_WIDGET_WIN_H_ |
| 6 #define VIEWS_WIDGET_WIDGET_WIN_H_ | 6 #define VIEWS_WIDGET_WIDGET_WIN_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <atlbase.h> | 9 #include <atlbase.h> |
| 10 #include <atlapp.h> | 10 #include <atlapp.h> |
| 11 #include <atlcrack.h> | 11 #include <atlcrack.h> |
| 12 #include <atlmisc.h> | 12 #include <atlmisc.h> |
| 13 | 13 |
| 14 #include <string> | 14 #include <string> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/scoped_vector.h" | 18 #include "base/memory/scoped_vector.h" |
| 19 #include "base/message_loop.h" | 19 #include "base/message_loop.h" |
| 20 #include "base/win/scoped_comptr.h" | 20 #include "base/win/scoped_comptr.h" |
| 21 #include "ui/base/win/window_impl.h" | 21 #include "ui/base/win/window_impl.h" |
| 22 #include "views/focus/focus_manager.h" | 22 #include "views/focus/focus_manager.h" |
| 23 #include "views/ime/input_method_delegate.h" | |
| 24 #include "views/layout/layout_manager.h" | 23 #include "views/layout/layout_manager.h" |
| 25 #include "views/widget/native_widget.h" | 24 #include "views/widget/native_widget.h" |
| 26 #include "views/widget/widget.h" | 25 #include "views/widget/widget.h" |
| 27 | 26 |
| 28 namespace ui { | 27 namespace ui { |
| 29 class ViewProp; | 28 class ViewProp; |
| 30 } | 29 } |
| 31 | 30 |
| 32 namespace gfx { | 31 namespace gfx { |
| 33 class CanvasSkia; | 32 class CanvasSkia; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // | 74 // |
| 76 // This Widget contains a RootView which owns the hierarchy of views within it. | 75 // This Widget contains a RootView which owns the hierarchy of views within it. |
| 77 // As long as views are part of this tree, they will be deleted automatically | 76 // As long as views are part of this tree, they will be deleted automatically |
| 78 // when the RootView is destroyed. If you remove a view from the tree, you are | 77 // when the RootView is destroyed. If you remove a view from the tree, you are |
| 79 // then responsible for cleaning up after it. | 78 // then responsible for cleaning up after it. |
| 80 // | 79 // |
| 81 /////////////////////////////////////////////////////////////////////////////// | 80 /////////////////////////////////////////////////////////////////////////////// |
| 82 class WidgetWin : public ui::WindowImpl, | 81 class WidgetWin : public ui::WindowImpl, |
| 83 public Widget, | 82 public Widget, |
| 84 public NativeWidget, | 83 public NativeWidget, |
| 85 public MessageLoopForUI::Observer, | 84 public MessageLoopForUI::Observer { |
| 86 public internal::InputMethodDelegate { | |
| 87 public: | 85 public: |
| 88 WidgetWin(); | 86 WidgetWin(); |
| 89 virtual ~WidgetWin(); | 87 virtual ~WidgetWin(); |
| 90 | 88 |
| 91 // Returns the Widget associated with the specified HWND (if any). | 89 // Returns the Widget associated with the specified HWND (if any). |
| 92 static WidgetWin* GetWidget(HWND hwnd); | 90 static WidgetWin* GetWidget(HWND hwnd); |
| 93 | 91 |
| 94 // Returns true if we are on Windows Vista or greater and composition is | 92 // Returns true if we are on Windows Vista or greater and composition is |
| 95 // enabled. | 93 // enabled. |
| 96 static bool IsAeroGlassEnabled(); | 94 static bool IsAeroGlassEnabled(); |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 // Are a subclass of WindowWin? | 411 // Are a subclass of WindowWin? |
| 414 bool is_window_; | 412 bool is_window_; |
| 415 | 413 |
| 416 private: | 414 private: |
| 417 typedef ScopedVector<ui::ViewProp> ViewProps; | 415 typedef ScopedVector<ui::ViewProp> ViewProps; |
| 418 | 416 |
| 419 // Implementation of GetWindow. Ascends the parents of |hwnd| returning the | 417 // Implementation of GetWindow. Ascends the parents of |hwnd| returning the |
| 420 // first ancestor that is a Window. | 418 // first ancestor that is a Window. |
| 421 static Window* GetWindowImpl(HWND hwnd); | 419 static Window* GetWindowImpl(HWND hwnd); |
| 422 | 420 |
| 423 // Returns the RootView that contains the focused view, or NULL if there is no | |
| 424 // focused view. | |
| 425 RootView* GetFocusedViewRootView(); | |
| 426 | |
| 427 // Called after the WM_ACTIVATE message has been processed by the default | 421 // Called after the WM_ACTIVATE message has been processed by the default |
| 428 // windows procedure. | 422 // windows procedure. |
| 429 static void PostProcessActivateMessage(WidgetWin* widget, | 423 static void PostProcessActivateMessage(WidgetWin* widget, |
| 430 int activation_state); | 424 int activation_state); |
| 431 | 425 |
| 432 // Synchronously paints the invalid contents of the Widget. | 426 // Synchronously paints the invalid contents of the Widget. |
| 433 void RedrawInvalidRect(); | 427 void RedrawInvalidRect(); |
| 434 | 428 |
| 435 // Synchronously updates the invalid contents of the Widget. Valid for | 429 // Synchronously updates the invalid contents of the Widget. Valid for |
| 436 // layered windows only. | 430 // layered windows only. |
| 437 void RedrawLayeredWindowContents(); | 431 void RedrawLayeredWindowContents(); |
| 438 | 432 |
| 439 // Responds to the client area changing size, either at window creation time | 433 // Responds to the client area changing size, either at window creation time |
| 440 // or subsequently. | 434 // or subsequently. |
| 441 void ClientAreaSizeChanged(); | 435 void ClientAreaSizeChanged(); |
| 442 | 436 |
| 443 // Overridden from NativeWidget. | 437 // Overridden from NativeWidget. |
| 444 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 438 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
| 445 | 439 |
| 446 // Overridden from internal::InputMethodDelegate | 440 // Overridden from internal::InputMethodDelegate |
| 447 virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE; | 441 virtual bool DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE; |
| 448 | 442 |
| 449 // A delegate implementation that handles events received here. | 443 // A delegate implementation that handles events received here. |
| 450 internal::NativeWidgetDelegate* delegate_; | 444 internal::NativeWidgetDelegate* delegate_; |
| 451 | 445 |
| 452 // The following factory is used for calls to close the WidgetWin | 446 // The following factory is used for calls to close the WidgetWin |
| 453 // instance. | 447 // instance. |
| 454 ScopedRunnableMethodFactory<WidgetWin> close_widget_factory_; | 448 ScopedRunnableMethodFactory<WidgetWin> close_widget_factory_; |
| 455 | 449 |
| 456 // The flags currently being used with TrackMouseEvent to track mouse | 450 // The flags currently being used with TrackMouseEvent to track mouse |
| 457 // messages. 0 if there is no active tracking. The value of this member is | 451 // messages. 0 if there is no active tracking. The value of this member is |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 | 518 |
| 525 // Indicates if the |input_method_| is an InputMethodWin instance. | 519 // Indicates if the |input_method_| is an InputMethodWin instance. |
| 526 bool is_input_method_win_; | 520 bool is_input_method_win_; |
| 527 | 521 |
| 528 DISALLOW_COPY_AND_ASSIGN(WidgetWin); | 522 DISALLOW_COPY_AND_ASSIGN(WidgetWin); |
| 529 }; | 523 }; |
| 530 | 524 |
| 531 } // namespace views | 525 } // namespace views |
| 532 | 526 |
| 533 #endif // VIEWS_WIDGET_WIDGET_WIN_H_ | 527 #endif // VIEWS_WIDGET_WIDGET_WIN_H_ |
| OLD | NEW |