| OLD | NEW |
| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // Overridden from FocusTraversable: | 213 // Overridden from FocusTraversable: |
| 214 virtual View* FindNextFocusableView(View* starting_view, | 214 virtual View* FindNextFocusableView(View* starting_view, |
| 215 bool reverse, | 215 bool reverse, |
| 216 Direction direction, | 216 Direction direction, |
| 217 bool check_starting_view, | 217 bool check_starting_view, |
| 218 FocusTraversable** focus_traversable, | 218 FocusTraversable** focus_traversable, |
| 219 View** focus_traversable_view); | 219 View** focus_traversable_view); |
| 220 virtual FocusTraversable* GetFocusTraversableParent(); | 220 virtual FocusTraversable* GetFocusTraversableParent(); |
| 221 virtual View* GetFocusTraversableParentView(); | 221 virtual View* GetFocusTraversableParentView(); |
| 222 | 222 |
| 223 // Overridden from AcceleratorTarget: | |
| 224 virtual bool AcceleratorPressed(const Accelerator& accelerator) { | |
| 225 return false; | |
| 226 } | |
| 227 | |
| 228 void SetFocusTraversableParent(FocusTraversable* parent); | 223 void SetFocusTraversableParent(FocusTraversable* parent); |
| 229 void SetFocusTraversableParentView(View* parent_view); | 224 void SetFocusTraversableParentView(View* parent_view); |
| 230 | 225 |
| 231 virtual bool GetAccelerator(int cmd_id, Accelerator* accelerator) { | 226 // Overridden from AcceleratorTarget: |
| 232 return false; | 227 virtual bool AcceleratorPressed(const Accelerator& accelerator); |
| 233 } | 228 |
| 229 virtual bool GetAccelerator(int cmd_id, Accelerator* accelerator); |
| 234 | 230 |
| 235 BOOL IsWindow() const { | 231 BOOL IsWindow() const { |
| 236 return ::IsWindow(GetNativeView()); | 232 return ::IsWindow(GetNativeView()); |
| 237 } | 233 } |
| 238 | 234 |
| 239 BOOL ShowWindow(int command) { | 235 BOOL ShowWindow(int command) { |
| 240 DCHECK(::IsWindow(GetNativeView())); | 236 DCHECK(::IsWindow(GetNativeView())); |
| 241 return ::ShowWindow(GetNativeView(), command); | 237 return ::ShowWindow(GetNativeView(), command); |
| 242 } | 238 } |
| 243 | 239 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 304 |
| 309 // Message Handlers | 305 // Message Handlers |
| 310 // These are all virtual so that specialized Widgets can modify or augment | 306 // These are all virtual so that specialized Widgets can modify or augment |
| 311 // processing. | 307 // processing. |
| 312 // This list is in _ALPHABETICAL_ order! | 308 // This list is in _ALPHABETICAL_ order! |
| 313 // Note: in the base class these functions must do nothing but convert point | 309 // Note: in the base class these functions must do nothing but convert point |
| 314 // coordinates to client coordinates (if necessary) and forward the | 310 // coordinates to client coordinates (if necessary) and forward the |
| 315 // handling to the appropriate Process* function. This is so that | 311 // handling to the appropriate Process* function. This is so that |
| 316 // subclasses can easily override these methods to do different things | 312 // subclasses can easily override these methods to do different things |
| 317 // and have a convenient function to call to get the default behavior. | 313 // and have a convenient function to call to get the default behavior. |
| 318 virtual void OnActivate(UINT action, BOOL minimized, HWND window) { | 314 virtual void OnActivate(UINT action, BOOL minimized, HWND window); |
| 319 SetMsgHandled(FALSE); | 315 virtual void OnActivateApp(BOOL active, DWORD thread_id); |
| 320 } | |
| 321 virtual void OnActivateApp(BOOL active, DWORD thread_id) { | |
| 322 SetMsgHandled(FALSE); | |
| 323 } | |
| 324 virtual LRESULT OnAppCommand(HWND window, short app_command, WORD device, | 316 virtual LRESULT OnAppCommand(HWND window, short app_command, WORD device, |
| 325 int keystate) { | 317 int keystate); |
| 326 SetMsgHandled(FALSE); | 318 virtual void OnCancelMode(); |
| 327 return 0; | |
| 328 } | |
| 329 virtual void OnCancelMode() {} | |
| 330 virtual void OnCaptureChanged(HWND hwnd); | 319 virtual void OnCaptureChanged(HWND hwnd); |
| 331 virtual void OnClose(); | 320 virtual void OnClose(); |
| 332 virtual void OnCommand(UINT notification_code, int command_id, HWND window) { | 321 virtual void OnCommand(UINT notification_code, int command_id, HWND window); |
| 333 SetMsgHandled(FALSE); | 322 virtual LRESULT OnCreate(CREATESTRUCT* create_struct); |
| 334 } | |
| 335 virtual LRESULT OnCreate(LPCREATESTRUCT create_struct) { return 0; } | |
| 336 // WARNING: If you override this be sure and invoke super, otherwise we'll | 323 // WARNING: If you override this be sure and invoke super, otherwise we'll |
| 337 // leak a few things. | 324 // leak a few things. |
| 338 virtual void OnDestroy(); | 325 virtual void OnDestroy(); |
| 339 virtual LRESULT OnDwmCompositionChanged(UINT msg, | 326 virtual LRESULT OnDwmCompositionChanged(UINT msg, |
| 340 WPARAM w_param, | 327 WPARAM w_param, |
| 341 LPARAM l_param) { | 328 LPARAM l_param); |
| 342 SetMsgHandled(FALSE); | 329 virtual void OnEndSession(BOOL ending, UINT logoff); |
| 343 return 0; | 330 virtual void OnEnterSizeMove(); |
| 344 } | |
| 345 virtual void OnEndSession(BOOL ending, UINT logoff) { SetMsgHandled(FALSE); } | |
| 346 virtual void OnEnterSizeMove() { SetMsgHandled(FALSE); } | |
| 347 virtual LRESULT OnEraseBkgnd(HDC dc); | 331 virtual LRESULT OnEraseBkgnd(HDC dc); |
| 348 virtual void OnExitMenuLoop(BOOL is_track_popup_menu) { | 332 virtual void OnExitMenuLoop(BOOL is_track_popup_menu); |
| 349 SetMsgHandled(FALSE); | 333 virtual void OnExitSizeMove(); |
| 350 } | |
| 351 virtual void OnExitSizeMove() { SetMsgHandled(FALSE); } | |
| 352 virtual LRESULT OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param); | 334 virtual LRESULT OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param); |
| 353 virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info) { | 335 virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info); |
| 354 SetMsgHandled(FALSE); | 336 virtual void OnHScroll(int scroll_type, short position, HWND scrollbar); |
| 355 } | 337 virtual void OnInitMenu(HMENU menu); |
| 356 virtual void OnHScroll(int scroll_type, short position, HWND scrollbar) { | 338 virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu); |
| 357 SetMsgHandled(FALSE); | |
| 358 } | |
| 359 virtual void OnInitMenu(HMENU menu) { SetMsgHandled(FALSE); } | |
| 360 virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu) { | |
| 361 SetMsgHandled(FALSE); | |
| 362 } | |
| 363 virtual void OnKeyDown(TCHAR c, UINT rep_cnt, UINT flags); | 339 virtual void OnKeyDown(TCHAR c, UINT rep_cnt, UINT flags); |
| 364 virtual void OnKeyUp(TCHAR c, UINT rep_cnt, UINT flags); | 340 virtual void OnKeyUp(TCHAR c, UINT rep_cnt, UINT flags); |
| 365 virtual void OnLButtonDblClk(UINT flags, const CPoint& point); | 341 virtual void OnLButtonDblClk(UINT flags, const CPoint& point); |
| 366 virtual void OnLButtonDown(UINT flags, const CPoint& point); | 342 virtual void OnLButtonDown(UINT flags, const CPoint& point); |
| 367 virtual void OnLButtonUp(UINT flags, const CPoint& point); | 343 virtual void OnLButtonUp(UINT flags, const CPoint& point); |
| 368 virtual void OnMButtonDblClk(UINT flags, const CPoint& point); | 344 virtual void OnMButtonDblClk(UINT flags, const CPoint& point); |
| 369 virtual void OnMButtonDown(UINT flags, const CPoint& point); | 345 virtual void OnMButtonDown(UINT flags, const CPoint& point); |
| 370 virtual void OnMButtonUp(UINT flags, const CPoint& point); | 346 virtual void OnMButtonUp(UINT flags, const CPoint& point); |
| 371 virtual LRESULT OnMouseActivate(HWND window, UINT hittest_code, UINT message); | 347 virtual LRESULT OnMouseActivate(HWND window, UINT hittest_code, UINT message); |
| 372 virtual void OnMouseMove(UINT flags, const CPoint& point); | 348 virtual void OnMouseMove(UINT flags, const CPoint& point); |
| 373 virtual LRESULT OnMouseLeave(UINT message, WPARAM w_param, LPARAM l_param); | 349 virtual LRESULT OnMouseLeave(UINT message, WPARAM w_param, LPARAM l_param); |
| 374 virtual LRESULT OnMouseWheel(UINT message, WPARAM w_param, LPARAM l_param); | 350 virtual LRESULT OnMouseWheel(UINT message, WPARAM w_param, LPARAM l_param); |
| 375 virtual void OnMove(const CPoint& point) { SetMsgHandled(FALSE); } | 351 virtual void OnMove(const CPoint& point); |
| 376 virtual void OnMoving(UINT param, LPRECT new_bounds) { } | 352 virtual void OnMoving(UINT param, LPRECT new_bounds); |
| 377 virtual LRESULT OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param); | 353 virtual LRESULT OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param); |
| 378 virtual LRESULT OnNCActivate(BOOL active) { SetMsgHandled(FALSE); return 0; } | 354 virtual LRESULT OnNCActivate(BOOL active); |
| 379 virtual LRESULT OnNCCalcSize(BOOL w_param, LPARAM l_param) { | 355 virtual LRESULT OnNCCalcSize(BOOL w_param, LPARAM l_param); |
| 380 SetMsgHandled(FALSE); | 356 virtual LRESULT OnNCHitTest(const CPoint& pt); |
| 381 return 0; | |
| 382 } | |
| 383 virtual LRESULT OnNCHitTest(const CPoint& pt) { | |
| 384 SetMsgHandled(FALSE); | |
| 385 return 0; | |
| 386 } | |
| 387 virtual void OnNCLButtonDblClk(UINT flags, const CPoint& point); | 357 virtual void OnNCLButtonDblClk(UINT flags, const CPoint& point); |
| 388 virtual void OnNCLButtonDown(UINT flags, const CPoint& point); | 358 virtual void OnNCLButtonDown(UINT flags, const CPoint& point); |
| 389 virtual void OnNCLButtonUp(UINT flags, const CPoint& point); | 359 virtual void OnNCLButtonUp(UINT flags, const CPoint& point); |
| 390 virtual void OnNCMButtonDblClk(UINT flags, const CPoint& point); | 360 virtual void OnNCMButtonDblClk(UINT flags, const CPoint& point); |
| 391 virtual void OnNCMButtonDown(UINT flags, const CPoint& point); | 361 virtual void OnNCMButtonDown(UINT flags, const CPoint& point); |
| 392 virtual void OnNCMButtonUp(UINT flags, const CPoint& point); | 362 virtual void OnNCMButtonUp(UINT flags, const CPoint& point); |
| 393 virtual LRESULT OnNCMouseLeave(UINT uMsg, WPARAM w_param, LPARAM l_param); | 363 virtual LRESULT OnNCMouseLeave(UINT uMsg, WPARAM w_param, LPARAM l_param); |
| 394 virtual LRESULT OnNCMouseMove(UINT flags, const CPoint& point); | 364 virtual LRESULT OnNCMouseMove(UINT flags, const CPoint& point); |
| 395 virtual void OnNCPaint(HRGN rgn) { SetMsgHandled(FALSE); } | 365 virtual void OnNCPaint(HRGN rgn); |
| 396 virtual void OnNCRButtonDblClk(UINT flags, const CPoint& point); | 366 virtual void OnNCRButtonDblClk(UINT flags, const CPoint& point); |
| 397 virtual void OnNCRButtonDown(UINT flags, const CPoint& point); | 367 virtual void OnNCRButtonDown(UINT flags, const CPoint& point); |
| 398 virtual void OnNCRButtonUp(UINT flags, const CPoint& point); | 368 virtual void OnNCRButtonUp(UINT flags, const CPoint& point); |
| 399 virtual LRESULT OnNCUAHDrawCaption(UINT msg, | 369 virtual LRESULT OnNCUAHDrawCaption(UINT msg, |
| 400 WPARAM w_param, | 370 WPARAM w_param, |
| 401 LPARAM l_param) { | 371 LPARAM l_param); |
| 402 SetMsgHandled(FALSE); | 372 virtual LRESULT OnNCUAHDrawFrame(UINT msg, WPARAM w_param, LPARAM l_param); |
| 403 return 0; | |
| 404 } | |
| 405 virtual LRESULT OnNCUAHDrawFrame(UINT msg, WPARAM w_param, LPARAM l_param) { | |
| 406 SetMsgHandled(FALSE); | |
| 407 return 0; | |
| 408 } | |
| 409 virtual LRESULT OnNotify(int w_param, NMHDR* l_param); | 373 virtual LRESULT OnNotify(int w_param, NMHDR* l_param); |
| 410 virtual void OnPaint(HDC dc); | 374 virtual void OnPaint(HDC dc); |
| 411 virtual LRESULT OnPowerBroadcast(DWORD power_event, DWORD data) { | 375 virtual LRESULT OnPowerBroadcast(DWORD power_event, DWORD data); |
| 412 base::SystemMonitor* monitor = base::SystemMonitor::Get(); | |
| 413 if (monitor) | |
| 414 monitor->ProcessWmPowerBroadcastMessage(power_event); | |
| 415 SetMsgHandled(FALSE); | |
| 416 return 0; | |
| 417 } | |
| 418 virtual void OnRButtonDblClk(UINT flags, const CPoint& point); | 376 virtual void OnRButtonDblClk(UINT flags, const CPoint& point); |
| 419 virtual void OnRButtonDown(UINT flags, const CPoint& point); | 377 virtual void OnRButtonDown(UINT flags, const CPoint& point); |
| 420 virtual void OnRButtonUp(UINT flags, const CPoint& point); | 378 virtual void OnRButtonUp(UINT flags, const CPoint& point); |
| 421 virtual LRESULT OnReflectedMessage(UINT msg, WPARAM w_param, LPARAM l_param) { | 379 virtual LRESULT OnReflectedMessage(UINT msg, WPARAM w_param, LPARAM l_param); |
| 422 SetMsgHandled(FALSE); | 380 virtual void OnSetFocus(HWND focused_window); |
| 423 return 0; | 381 virtual LRESULT OnSetIcon(UINT size_type, HICON new_icon); |
| 424 } | 382 virtual LRESULT OnSetText(const wchar_t* text); |
| 425 virtual void OnSetFocus(HWND focused_window) { | 383 virtual void OnSettingChange(UINT flags, const wchar_t* section); |
| 426 SetMsgHandled(FALSE); | |
| 427 } | |
| 428 virtual LRESULT OnSetIcon(UINT size_type, HICON new_icon) { | |
| 429 SetMsgHandled(FALSE); | |
| 430 return 0; | |
| 431 } | |
| 432 virtual LRESULT OnSetText(const wchar_t* text) { | |
| 433 SetMsgHandled(FALSE); | |
| 434 return 0; | |
| 435 } | |
| 436 virtual void OnSettingChange(UINT flags, const wchar_t* section) { | |
| 437 SetMsgHandled(FALSE); | |
| 438 } | |
| 439 virtual void OnSize(UINT param, const CSize& size); | 384 virtual void OnSize(UINT param, const CSize& size); |
| 440 virtual void OnSysCommand(UINT notification_code, CPoint click) { } | 385 virtual void OnSysCommand(UINT notification_code, CPoint click); |
| 441 virtual void OnThemeChanged(); | 386 virtual void OnThemeChanged(); |
| 442 virtual void OnVScroll(int scroll_type, short position, HWND scrollbar) { | 387 virtual void OnVScroll(int scroll_type, short position, HWND scrollbar); |
| 443 SetMsgHandled(FALSE); | 388 virtual void OnWindowPosChanging(WINDOWPOS* window_pos); |
| 444 } | 389 virtual void OnWindowPosChanged(WINDOWPOS* window_pos); |
| 445 virtual void OnWindowPosChanging(WINDOWPOS* window_pos) { | |
| 446 SetMsgHandled(FALSE); | |
| 447 } | |
| 448 virtual void OnWindowPosChanged(WINDOWPOS* window_pos) { | |
| 449 SetMsgHandled(FALSE); | |
| 450 } | |
| 451 | 390 |
| 452 // deletes this window as it is destroyed, override to provide different | 391 // deletes this window as it is destroyed, override to provide different |
| 453 // behavior. | 392 // behavior. |
| 454 virtual void OnFinalMessage(HWND window); | 393 virtual void OnFinalMessage(HWND window); |
| 455 | 394 |
| 456 // Start tracking all mouse events so that this window gets sent mouse leave | 395 // Start tracking all mouse events so that this window gets sent mouse leave |
| 457 // messages too. | 396 // messages too. |
| 458 void TrackMouseEvents(DWORD mouse_tracking_flags); | 397 void TrackMouseEvents(DWORD mouse_tracking_flags); |
| 459 | 398 |
| 460 // Actually handle mouse events. These functions are called by subclasses who | 399 // Actually handle mouse events. These functions are called by subclasses who |
| 461 // override the message handlers above to do the actual real work of handling | 400 // override the message handlers above to do the actual real work of handling |
| 462 // the event in the View system. | 401 // the event in the View system. |
| 463 bool ProcessMousePressed(const CPoint& point, | 402 bool ProcessMousePressed(const CPoint& point, |
| 464 UINT flags, | 403 UINT flags, |
| 465 bool dbl_click, | 404 bool dbl_click, |
| 466 bool non_client); | 405 bool non_client); |
| 467 void ProcessMouseDragged(const CPoint& point, UINT flags); | 406 void ProcessMouseDragged(const CPoint& point, UINT flags); |
| 468 void ProcessMouseReleased(const CPoint& point, UINT flags); | 407 void ProcessMouseReleased(const CPoint& point, UINT flags); |
| 469 void ProcessMouseMoved(const CPoint& point, UINT flags, bool is_nonclient); | 408 void ProcessMouseMoved(const CPoint& point, UINT flags, bool is_nonclient); |
| 470 void ProcessMouseExited(); | 409 void ProcessMouseExited(); |
| 471 | 410 |
| 472 // Handles re-laying out content in response to a window size change. | 411 // Handles re-laying out content in response to a window size change. |
| 473 virtual void ChangeSize(UINT size_param, const CSize& size); | 412 virtual void ChangeSize(UINT size_param, const CSize& size); |
| 474 | 413 |
| 475 // Returns whether capture should be released on mouse release. The default | 414 // Returns whether capture should be released on mouse release. The default |
| 476 // is true. | 415 // is true. |
| 477 virtual bool ReleaseCaptureOnMouseReleased() { return true; } | 416 virtual bool ReleaseCaptureOnMouseReleased(); |
| 478 | 417 |
| 479 // Creates the RootView to be used within this Widget. Can be overridden to | 418 // Creates the RootView to be used within this Widget. Can be overridden to |
| 480 // create specialized RootView implementations. | 419 // create specialized RootView implementations. |
| 481 virtual RootView* CreateRootView(); | 420 virtual RootView* CreateRootView(); |
| 482 | 421 |
| 483 // Returns true if this WidgetWin is opaque. | 422 // Returns true if this WidgetWin is opaque. |
| 484 bool opaque() const { return opaque_; } | 423 bool opaque() const { return opaque_; } |
| 485 | 424 |
| 486 // The TooltipManager. | 425 // The TooltipManager. |
| 487 // WARNING: RootView's destructor calls into the TooltipManager. As such, this | 426 // WARNING: RootView's destructor calls into the TooltipManager. As such, this |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 | 531 |
| 593 // Instance of accessibility information and handling for MSAA root | 532 // Instance of accessibility information and handling for MSAA root |
| 594 ScopedComPtr<IAccessible> accessibility_root_; | 533 ScopedComPtr<IAccessible> accessibility_root_; |
| 595 | 534 |
| 596 scoped_ptr<DefaultThemeProvider> default_theme_provider_; | 535 scoped_ptr<DefaultThemeProvider> default_theme_provider_; |
| 597 }; | 536 }; |
| 598 | 537 |
| 599 } // namespace views | 538 } // namespace views |
| 600 | 539 |
| 601 #endif // VIEWS_WIDGET_WIDGET_WIN_H_ | 540 #endif // VIEWS_WIDGET_WIDGET_WIN_H_ |
| OLD | NEW |