Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: views/widget/widget_win.h

Issue 146093: Relanding focus manager refactoring (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 7
8 #include <atlbase.h> 8 #include <atlbase.h>
9 #include <atlapp.h> 9 #include <atlapp.h>
10 #include <atlcrack.h> 10 #include <atlcrack.h>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 WidgetWin(); 71 WidgetWin();
72 virtual ~WidgetWin(); 72 virtual ~WidgetWin();
73 73
74 // Initialize the Widget with a parent and an initial desired size. 74 // Initialize the Widget with a parent and an initial desired size.
75 // |contents_view| is the view that will be the single child of RootView 75 // |contents_view| is the view that will be the single child of RootView
76 // within this Widget. As contents_view is inserted into RootView's tree, 76 // within this Widget. As contents_view is inserted into RootView's tree,
77 // RootView assumes ownership of this view and cleaning it up. If you remove 77 // RootView assumes ownership of this view and cleaning it up. If you remove
78 // this view, you are responsible for its destruction. If this value is NULL, 78 // this view, you are responsible for its destruction. If this value is NULL,
79 // the caller is responsible for populating the RootView, and sizing its 79 // the caller is responsible for populating the RootView, and sizing its
80 // contents as the window is sized. 80 // contents as the window is sized.
81 // If |has_own_focus_manager| is true, the focus traversal stay confined to 81 void Init(HWND parent, const gfx::Rect& bounds);
82 // the window.
83 void Init(HWND parent,
84 const gfx::Rect& bounds,
85 bool has_own_focus_manager);
86 82
87 // Sets the specified view as the contents of this Widget. There can only 83 // Sets the specified view as the contents of this Widget. There can only
88 // be one contnets view child of this Widget's RootView. This view is sized to 84 // be one contnets view child of this Widget's RootView. This view is sized to
89 // fit the entire size of the RootView. The RootView takes ownership of this 85 // fit the entire size of the RootView. The RootView takes ownership of this
90 // View, unless it is set as not being parent-owned. 86 // View, unless it is set as not being parent-owned.
91 virtual void SetContentsView(View* view); 87 virtual void SetContentsView(View* view);
92 88
93 // Sets the window styles. This is ONLY used when the window is created. 89 // Sets the window styles. This is ONLY used when the window is created.
94 // In other words, if you invoke this after invoking Init, nothing happens. 90 // In other words, if you invoke this after invoking Init, nothing happens.
95 void set_window_style(DWORD style) { window_style_ = style; } 91 void set_window_style(DWORD style) { window_style_ = style; }
(...skipping 19 matching lines...) Expand all
115 void SetUseLayeredBuffer(bool use_layered_buffer); 111 void SetUseLayeredBuffer(bool use_layered_buffer);
116 112
117 // Disable Layered Window updates by setting to false. 113 // Disable Layered Window updates by setting to false.
118 void set_can_update_layered_window(bool can_update_layered_window) { 114 void set_can_update_layered_window(bool can_update_layered_window) {
119 can_update_layered_window_ = can_update_layered_window; 115 can_update_layered_window_ = can_update_layered_window;
120 } 116 }
121 117
122 // Returns the RootView associated with the specified HWND (if any). 118 // Returns the RootView associated with the specified HWND (if any).
123 static RootView* FindRootView(HWND hwnd); 119 static RootView* FindRootView(HWND hwnd);
124 120
121 // Returns the Widget associated with the specified HWND (if any).
122 static WidgetWin* GetWidget(HWND hwnd);
123
125 // All classes registered by WidgetWin start with this name. 124 // All classes registered by WidgetWin start with this name.
126 static const wchar_t* const kBaseClassName; 125 static const wchar_t* const kBaseClassName;
127 126
128 BEGIN_MSG_MAP_EX(0) 127 BEGIN_MSG_MAP_EX(0)
129 // Range handlers must go first! 128 // Range handlers must go first!
130 MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseRange) 129 MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseRange)
131 MESSAGE_RANGE_HANDLER_EX(WM_NCMOUSEMOVE, WM_NCMOUSEMOVE, OnMouseRange) 130 MESSAGE_RANGE_HANDLER_EX(WM_NCMOUSEMOVE, WM_NCMOUSEMOVE, OnMouseRange)
132 131
133 // Reflected message handler 132 // Reflected message handler
134 MESSAGE_HANDLER_EX(kReflectedMessage, OnReflectedMessage) 133 MESSAGE_HANDLER_EX(kReflectedMessage, OnReflectedMessage)
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 virtual void PaintNow(const gfx::Rect& update_rect); 222 virtual void PaintNow(const gfx::Rect& update_rect);
224 virtual void SetOpacity(unsigned char opacity); 223 virtual void SetOpacity(unsigned char opacity);
225 virtual RootView* GetRootView(); 224 virtual RootView* GetRootView();
226 virtual Widget* GetRootWidget() const; 225 virtual Widget* GetRootWidget() const;
227 virtual bool IsVisible() const; 226 virtual bool IsVisible() const;
228 virtual bool IsActive() const; 227 virtual bool IsActive() const;
229 virtual TooltipManager* GetTooltipManager(); 228 virtual TooltipManager* GetTooltipManager();
230 virtual ThemeProvider* GetThemeProvider() const; 229 virtual ThemeProvider* GetThemeProvider() const;
231 virtual Window* GetWindow(); 230 virtual Window* GetWindow();
232 virtual const Window* GetWindow() const; 231 virtual const Window* GetWindow() const;
232 virtual FocusManager* GetFocusManager();
233 233
234 // Overridden from MessageLoop::Observer: 234 // Overridden from MessageLoop::Observer:
235 void WillProcessMessage(const MSG& msg); 235 void WillProcessMessage(const MSG& msg);
236 virtual void DidProcessMessage(const MSG& msg); 236 virtual void DidProcessMessage(const MSG& msg);
237 237
238 // Overridden from FocusTraversable: 238 // Overridden from FocusTraversable:
239 virtual View* FindNextFocusableView(View* starting_view, 239 virtual View* FindNextFocusableView(View* starting_view,
240 bool reverse, 240 bool reverse,
241 Direction direction, 241 Direction direction,
242 bool check_starting_view, 242 bool check_starting_view,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 320
321 // Resets the last move flag so that we can go around the optimization 321 // Resets the last move flag so that we can go around the optimization
322 // that disregards duplicate mouse moves when ending animation requires 322 // that disregards duplicate mouse moves when ending animation requires
323 // a new hit-test to do some highlighting as in TabStrip::RemoveTabAnimation 323 // a new hit-test to do some highlighting as in TabStrip::RemoveTabAnimation
324 // to cause the close button to highlight. 324 // to cause the close button to highlight.
325 void ResetLastMouseMoveFlag() { 325 void ResetLastMouseMoveFlag() {
326 last_mouse_event_was_move_ = false; 326 last_mouse_event_was_move_ = false;
327 } 327 }
328 328
329 protected: 329 protected:
330
331 // Call close instead of this to Destroy the window. 330 // Call close instead of this to Destroy the window.
332 BOOL DestroyWindow() { 331 BOOL DestroyWindow() {
333 DCHECK(::IsWindow(GetNativeView())); 332 DCHECK(::IsWindow(GetNativeView()));
334 return ::DestroyWindow(GetNativeView()); 333 return ::DestroyWindow(GetNativeView());
335 } 334 }
336 335
337 // Message Handlers 336 // Message Handlers
338 // These are all virtual so that specialized Widgets can modify or augment 337 // These are all virtual so that specialized Widgets can modify or augment
339 // processing. 338 // processing.
340 // This list is in _ALPHABETICAL_ order! 339 // This list is in _ALPHABETICAL_ order!
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 bool opaque() const { return opaque_; } 515 bool opaque() const { return opaque_; }
517 516
518 // The TooltipManager. 517 // The TooltipManager.
519 // WARNING: RootView's destructor calls into the TooltipManager. As such, this 518 // WARNING: RootView's destructor calls into the TooltipManager. As such, this
520 // must be destroyed AFTER root_view_. This really only matters during 519 // must be destroyed AFTER root_view_. This really only matters during
521 // WM_SESSIONEND, as normally the hwnd is destroyed which tiggers unsetting 520 // WM_SESSIONEND, as normally the hwnd is destroyed which tiggers unsetting
522 // the widget in the RootView so that RootView's destructor doesn't call into 521 // the widget in the RootView so that RootView's destructor doesn't call into
523 // the TooltipManager. 522 // the TooltipManager.
524 scoped_ptr<TooltipManagerWin> tooltip_manager_; 523 scoped_ptr<TooltipManagerWin> tooltip_manager_;
525 524
525 // The focus manager keeping track of focus for this Widget and any of its
526 // children. NULL for non top-level widgets.
527 // WARNING: RootView's destructor calls into the FocusManager. As such, this
528 // must be destroyed AFTER root_view_.
529 scoped_ptr<FocusManager> focus_manager_;
530
526 // The root of the View hierarchy attached to this window. 531 // The root of the View hierarchy attached to this window.
527 // WARNING: see warning in tooltip_manager_ for ordering dependencies with 532 // WARNING: see warning in tooltip_manager_ for ordering dependencies with
528 // this and tooltip_manager_. 533 // this and tooltip_manager_.
529 scoped_ptr<RootView> root_view_; 534 scoped_ptr<RootView> root_view_;
530 535
531 // Whether or not we have capture the mouse. 536 // Whether or not we have capture the mouse.
532 bool has_capture_; 537 bool has_capture_;
533 538
534 // If true, the mouse is currently down. 539 // If true, the mouse is currently down.
535 bool is_mouse_down_; 540 bool is_mouse_down_;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 642
638 scoped_ptr<DefaultThemeProvider> default_theme_provider_; 643 scoped_ptr<DefaultThemeProvider> default_theme_provider_;
639 644
640 // Our hwnd. 645 // Our hwnd.
641 HWND hwnd_; 646 HWND hwnd_;
642 }; 647 };
643 648
644 } // namespace views 649 } // namespace views
645 650
646 #endif // #ifndef VIEWS_WIDGET_WIDGET_WIN_H_ 651 #endif // #ifndef VIEWS_WIDGET_WIDGET_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698