diff options
author | kbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-28 23:44:41 +0000 |
---|---|---|
committer | kbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-28 23:44:41 +0000 |
commit | b0c6bcddbc2dacbbcd8c53f20df488aa6ba7dedb (patch) | |
tree | 8fae1db547a35721f86b02906a6e343658878861 /views | |
parent | 971c16885e6dca38e4f3d5d5ba5b73214e3526e7 (diff) | |
download | chromium_src-b0c6bcddbc2dacbbcd8c53f20df488aa6ba7dedb.zip chromium_src-b0c6bcddbc2dacbbcd8c53f20df488aa6ba7dedb.tar.gz chromium_src-b0c6bcddbc2dacbbcd8c53f20df488aa6ba7dedb.tar.bz2 |
Refactored event handler method bodies from widget_win.h to
widget_win.cc. This significantly reduces build times when modifying
the code of these event handlers during debugging.
BUG=http://code.google.com/p/chromium/issues/detail?id=23274
TEST=none
Review URL: http://codereview.chromium.org/254003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27435 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/widget/widget_win.cc | 165 | ||||
-rw-r--r-- | views/widget/widget_win.h | 137 |
2 files changed, 203 insertions, 99 deletions
diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index 13df3ad..d975ef9 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -423,9 +423,35 @@ void WidgetWin::SetFocusTraversableParentView(View* parent_view) { root_view_->SetFocusTraversableParentView(parent_view); } +bool WidgetWin::AcceleratorPressed(const Accelerator& accelerator) { + return false; +} + +bool WidgetWin::GetAccelerator(int cmd_id, Accelerator* accelerator) { + return false; +} + + /////////////////////////////////////////////////////////////////////////////// // Message handlers +void WidgetWin::OnActivate(UINT action, BOOL minimized, HWND window) { + SetMsgHandled(FALSE); +} + +void WidgetWin::OnActivateApp(BOOL active, DWORD thread_id) { + SetMsgHandled(FALSE); +} + +LRESULT WidgetWin::OnAppCommand(HWND window, short app_command, WORD device, + int keystate) { + SetMsgHandled(FALSE); + return 0; +} + +void WidgetWin::OnCancelMode() { +} + void WidgetWin::OnCaptureChanged(HWND hwnd) { if (has_capture_) { if (is_mouse_down_) @@ -439,6 +465,14 @@ void WidgetWin::OnClose() { Close(); } +void WidgetWin::OnCommand(UINT notification_code, int command_id, HWND window) { + SetMsgHandled(FALSE); +} + +LRESULT WidgetWin::OnCreate(CREATESTRUCT* create_struct) { + return 0; +} + void WidgetWin::OnDestroy() { if (drop_target_.get()) { RevokeDragDrop(hwnd()); @@ -448,11 +482,34 @@ void WidgetWin::OnDestroy() { RemoveProp(hwnd(), kRootViewWindowProperty); } +LRESULT WidgetWin::OnDwmCompositionChanged(UINT msg, + WPARAM w_param, + LPARAM l_param) { + SetMsgHandled(FALSE); + return 0; +} + +void WidgetWin::OnEndSession(BOOL ending, UINT logoff) { + SetMsgHandled(FALSE); +} + +void WidgetWin::OnEnterSizeMove() { + SetMsgHandled(FALSE); +} + LRESULT WidgetWin::OnEraseBkgnd(HDC dc) { // This is needed for magical win32 flicker ju-ju return 1; } +void WidgetWin::OnExitMenuLoop(BOOL is_track_popup_menu) { + SetMsgHandled(FALSE); +} + +void WidgetWin::OnExitSizeMove() { + SetMsgHandled(FALSE); +} + LRESULT WidgetWin::OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param) { LRESULT reference_result = static_cast<LRESULT>(0L); @@ -495,6 +552,24 @@ LRESULT WidgetWin::OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param) { return reference_result; } +void WidgetWin::OnGetMinMaxInfo(MINMAXINFO* minmax_info) { + SetMsgHandled(FALSE); +} + +void WidgetWin::OnHScroll(int scroll_type, short position, HWND scrollbar) { + SetMsgHandled(FALSE); +} + +void WidgetWin::OnInitMenu(HMENU menu) { + SetMsgHandled(FALSE); +} + +void WidgetWin::OnInitMenuPopup(HMENU menu, + UINT position, + BOOL is_system_menu) { + SetMsgHandled(FALSE); +} + void WidgetWin::OnKeyDown(TCHAR c, UINT rep_cnt, UINT flags) { KeyEvent event(Event::ET_KEY_PRESSED, c, rep_cnt, flags); SetMsgHandled(root_view_->ProcessKeyEvent(event)); @@ -567,12 +642,34 @@ LRESULT WidgetWin::OnMouseWheel(UINT message, WPARAM w_param, LPARAM l_param) { return root_view_->ProcessMouseWheelEvent(e) ? 0 : 1; } +void WidgetWin::OnMove(const CPoint& point) { + SetMsgHandled(FALSE); +} + +void WidgetWin::OnMoving(UINT param, const LPRECT new_bounds) { +} + LRESULT WidgetWin::OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param) { tooltip_manager_->OnMouse(msg, w_param, l_param); SetMsgHandled(FALSE); return 0; } +LRESULT WidgetWin::OnNCActivate(BOOL active) { + SetMsgHandled(FALSE); + return 0; +} + +LRESULT WidgetWin::OnNCCalcSize(BOOL w_param, LPARAM l_param) { + SetMsgHandled(FALSE); + return 0; +} + +LRESULT WidgetWin::OnNCHitTest(const CPoint& pt) { + SetMsgHandled(FALSE); + return 0; +} + void WidgetWin::OnNCLButtonDblClk(UINT flags, const CPoint& point) { SetMsgHandled(ProcessMousePressed(point, flags | MK_LBUTTON, true, true)); } @@ -614,6 +711,10 @@ LRESULT WidgetWin::OnNCMouseMove(UINT flags, const CPoint& point) { return 0; } +void WidgetWin::OnNCPaint(HRGN rgn) { + SetMsgHandled(FALSE); +} + void WidgetWin::OnNCRButtonDblClk(UINT flags, const CPoint& point) { SetMsgHandled(ProcessMousePressed(point, flags | MK_RBUTTON, true, true)); } @@ -626,6 +727,18 @@ void WidgetWin::OnNCRButtonUp(UINT flags, const CPoint& point) { SetMsgHandled(FALSE); } +LRESULT WidgetWin::OnNCUAHDrawCaption(UINT msg, + WPARAM w_param, + LPARAM l_param) { + SetMsgHandled(FALSE); + return 0; +} + +LRESULT WidgetWin::OnNCUAHDrawFrame(UINT msg, WPARAM w_param, LPARAM l_param) { + SetMsgHandled(FALSE); + return 0; +} + LRESULT WidgetWin::OnNotify(int w_param, NMHDR* l_param) { // We can be sent this message before the tooltip manager is created, if a // subclass overrides OnCreate and creates some kind of Windows control there @@ -644,6 +757,14 @@ void WidgetWin::OnPaint(HDC dc) { root_view_->OnPaint(hwnd()); } +LRESULT WidgetWin::OnPowerBroadcast(DWORD power_event, DWORD data) { + base::SystemMonitor* monitor = base::SystemMonitor::Get(); + if (monitor) + monitor->ProcessWmPowerBroadcastMessage(power_event); + SetMsgHandled(FALSE); + return 0; +} + void WidgetWin::OnRButtonDown(UINT flags, const CPoint& point) { ProcessMousePressed(point, flags | MK_RBUTTON, false, false); } @@ -656,10 +777,38 @@ void WidgetWin::OnRButtonDblClk(UINT flags, const CPoint& point) { ProcessMousePressed(point, flags | MK_RBUTTON, true, false); } +LRESULT WidgetWin::OnReflectedMessage(UINT msg, + WPARAM w_param, + LPARAM l_param) { + SetMsgHandled(FALSE); + return 0; +} + +void WidgetWin::OnSetFocus(HWND focused_window) { + SetMsgHandled(FALSE); +} + +LRESULT WidgetWin::OnSetIcon(UINT size_type, HICON new_icon) { + SetMsgHandled(FALSE); + return 0; +} + +LRESULT WidgetWin::OnSetText(const wchar_t* text) { + SetMsgHandled(FALSE); + return 0; +} + +void WidgetWin::OnSettingChange(UINT flags, const wchar_t* section) { + SetMsgHandled(FALSE); +} + void WidgetWin::OnSize(UINT param, const CSize& size) { ChangeSize(param, size); } +void WidgetWin::OnSysCommand(UINT notification_code, CPoint click) { +} + void WidgetWin::OnThemeChanged() { // Notify NativeTheme. gfx::NativeTheme::instance()->CloseHandles(); @@ -670,6 +819,18 @@ void WidgetWin::OnFinalMessage(HWND window) { delete this; } +void WidgetWin::OnVScroll(int scroll_type, short position, HWND scrollbar) { + SetMsgHandled(FALSE); +} + +void WidgetWin::OnWindowPosChanging(WINDOWPOS* window_pos) { + SetMsgHandled(FALSE); +} + +void WidgetWin::OnWindowPosChanged(WINDOWPOS* window_pos) { + SetMsgHandled(FALSE); +} + /////////////////////////////////////////////////////////////////////////////// // WidgetWin, protected: @@ -803,6 +964,10 @@ void WidgetWin::ChangeSize(UINT size_param, const CSize& size) { PaintNow(gfx::Rect(rect)); } +bool WidgetWin::ReleaseCaptureOnMouseReleased() { + return true; +} + RootView* WidgetWin::CreateRootView() { return new RootView(this); } diff --git a/views/widget/widget_win.h b/views/widget/widget_win.h index cea4a64..c6f0359 100644 --- a/views/widget/widget_win.h +++ b/views/widget/widget_win.h @@ -220,17 +220,13 @@ class WidgetWin : public base::WindowImpl, virtual FocusTraversable* GetFocusTraversableParent(); virtual View* GetFocusTraversableParentView(); - // Overridden from AcceleratorTarget: - virtual bool AcceleratorPressed(const Accelerator& accelerator) { - return false; - } - void SetFocusTraversableParent(FocusTraversable* parent); void SetFocusTraversableParentView(View* parent_view); - virtual bool GetAccelerator(int cmd_id, Accelerator* accelerator) { - return false; - } + // Overridden from AcceleratorTarget: + virtual bool AcceleratorPressed(const Accelerator& accelerator); + + virtual bool GetAccelerator(int cmd_id, Accelerator* accelerator); BOOL IsWindow() const { return ::IsWindow(GetNativeView()); @@ -315,51 +311,31 @@ class WidgetWin : public base::WindowImpl, // handling to the appropriate Process* function. This is so that // subclasses can easily override these methods to do different things // and have a convenient function to call to get the default behavior. - virtual void OnActivate(UINT action, BOOL minimized, HWND window) { - SetMsgHandled(FALSE); - } - virtual void OnActivateApp(BOOL active, DWORD thread_id) { - SetMsgHandled(FALSE); - } + virtual void OnActivate(UINT action, BOOL minimized, HWND window); + virtual void OnActivateApp(BOOL active, DWORD thread_id); virtual LRESULT OnAppCommand(HWND window, short app_command, WORD device, - int keystate) { - SetMsgHandled(FALSE); - return 0; - } - virtual void OnCancelMode() {} + int keystate); + virtual void OnCancelMode(); virtual void OnCaptureChanged(HWND hwnd); virtual void OnClose(); - virtual void OnCommand(UINT notification_code, int command_id, HWND window) { - SetMsgHandled(FALSE); - } - virtual LRESULT OnCreate(LPCREATESTRUCT create_struct) { return 0; } + virtual void OnCommand(UINT notification_code, int command_id, HWND window); + virtual LRESULT OnCreate(CREATESTRUCT* create_struct); // WARNING: If you override this be sure and invoke super, otherwise we'll // leak a few things. virtual void OnDestroy(); virtual LRESULT OnDwmCompositionChanged(UINT msg, WPARAM w_param, - LPARAM l_param) { - SetMsgHandled(FALSE); - return 0; - } - virtual void OnEndSession(BOOL ending, UINT logoff) { SetMsgHandled(FALSE); } - virtual void OnEnterSizeMove() { SetMsgHandled(FALSE); } + LPARAM l_param); + virtual void OnEndSession(BOOL ending, UINT logoff); + virtual void OnEnterSizeMove(); virtual LRESULT OnEraseBkgnd(HDC dc); - virtual void OnExitMenuLoop(BOOL is_track_popup_menu) { - SetMsgHandled(FALSE); - } - virtual void OnExitSizeMove() { SetMsgHandled(FALSE); } + virtual void OnExitMenuLoop(BOOL is_track_popup_menu); + virtual void OnExitSizeMove(); virtual LRESULT OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param); - virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info) { - SetMsgHandled(FALSE); - } - virtual void OnHScroll(int scroll_type, short position, HWND scrollbar) { - SetMsgHandled(FALSE); - } - virtual void OnInitMenu(HMENU menu) { SetMsgHandled(FALSE); } - virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu) { - SetMsgHandled(FALSE); - } + virtual void OnGetMinMaxInfo(MINMAXINFO* minmax_info); + virtual void OnHScroll(int scroll_type, short position, HWND scrollbar); + virtual void OnInitMenu(HMENU menu); + virtual void OnInitMenuPopup(HMENU menu, UINT position, BOOL is_system_menu); virtual void OnKeyDown(TCHAR c, UINT rep_cnt, UINT flags); virtual void OnKeyUp(TCHAR c, UINT rep_cnt, UINT flags); virtual void OnLButtonDblClk(UINT flags, const CPoint& point); @@ -372,18 +348,12 @@ class WidgetWin : public base::WindowImpl, virtual void OnMouseMove(UINT flags, const CPoint& point); virtual LRESULT OnMouseLeave(UINT message, WPARAM w_param, LPARAM l_param); virtual LRESULT OnMouseWheel(UINT message, WPARAM w_param, LPARAM l_param); - virtual void OnMove(const CPoint& point) { SetMsgHandled(FALSE); } - virtual void OnMoving(UINT param, LPRECT new_bounds) { } + virtual void OnMove(const CPoint& point); + virtual void OnMoving(UINT param, LPRECT new_bounds); virtual LRESULT OnMouseRange(UINT msg, WPARAM w_param, LPARAM l_param); - virtual LRESULT OnNCActivate(BOOL active) { SetMsgHandled(FALSE); return 0; } - virtual LRESULT OnNCCalcSize(BOOL w_param, LPARAM l_param) { - SetMsgHandled(FALSE); - return 0; - } - virtual LRESULT OnNCHitTest(const CPoint& pt) { - SetMsgHandled(FALSE); - return 0; - } + virtual LRESULT OnNCActivate(BOOL active); + virtual LRESULT OnNCCalcSize(BOOL w_param, LPARAM l_param); + virtual LRESULT OnNCHitTest(const CPoint& pt); virtual void OnNCLButtonDblClk(UINT flags, const CPoint& point); virtual void OnNCLButtonDown(UINT flags, const CPoint& point); virtual void OnNCLButtonUp(UINT flags, const CPoint& point); @@ -392,62 +362,31 @@ class WidgetWin : public base::WindowImpl, virtual void OnNCMButtonUp(UINT flags, const CPoint& point); virtual LRESULT OnNCMouseLeave(UINT uMsg, WPARAM w_param, LPARAM l_param); virtual LRESULT OnNCMouseMove(UINT flags, const CPoint& point); - virtual void OnNCPaint(HRGN rgn) { SetMsgHandled(FALSE); } + virtual void OnNCPaint(HRGN rgn); virtual void OnNCRButtonDblClk(UINT flags, const CPoint& point); virtual void OnNCRButtonDown(UINT flags, const CPoint& point); virtual void OnNCRButtonUp(UINT flags, const CPoint& point); virtual LRESULT OnNCUAHDrawCaption(UINT msg, WPARAM w_param, - LPARAM l_param) { - SetMsgHandled(FALSE); - return 0; - } - virtual LRESULT OnNCUAHDrawFrame(UINT msg, WPARAM w_param, LPARAM l_param) { - SetMsgHandled(FALSE); - return 0; - } + LPARAM l_param); + virtual LRESULT OnNCUAHDrawFrame(UINT msg, WPARAM w_param, LPARAM l_param); virtual LRESULT OnNotify(int w_param, NMHDR* l_param); virtual void OnPaint(HDC dc); - virtual LRESULT OnPowerBroadcast(DWORD power_event, DWORD data) { - base::SystemMonitor* monitor = base::SystemMonitor::Get(); - if (monitor) - monitor->ProcessWmPowerBroadcastMessage(power_event); - SetMsgHandled(FALSE); - return 0; - } + virtual LRESULT OnPowerBroadcast(DWORD power_event, DWORD data); virtual void OnRButtonDblClk(UINT flags, const CPoint& point); virtual void OnRButtonDown(UINT flags, const CPoint& point); virtual void OnRButtonUp(UINT flags, const CPoint& point); - virtual LRESULT OnReflectedMessage(UINT msg, WPARAM w_param, LPARAM l_param) { - SetMsgHandled(FALSE); - return 0; - } - virtual void OnSetFocus(HWND focused_window) { - SetMsgHandled(FALSE); - } - virtual LRESULT OnSetIcon(UINT size_type, HICON new_icon) { - SetMsgHandled(FALSE); - return 0; - } - virtual LRESULT OnSetText(const wchar_t* text) { - SetMsgHandled(FALSE); - return 0; - } - virtual void OnSettingChange(UINT flags, const wchar_t* section) { - SetMsgHandled(FALSE); - } + virtual LRESULT OnReflectedMessage(UINT msg, WPARAM w_param, LPARAM l_param); + virtual void OnSetFocus(HWND focused_window); + virtual LRESULT OnSetIcon(UINT size_type, HICON new_icon); + virtual LRESULT OnSetText(const wchar_t* text); + virtual void OnSettingChange(UINT flags, const wchar_t* section); virtual void OnSize(UINT param, const CSize& size); - virtual void OnSysCommand(UINT notification_code, CPoint click) { } + virtual void OnSysCommand(UINT notification_code, CPoint click); virtual void OnThemeChanged(); - virtual void OnVScroll(int scroll_type, short position, HWND scrollbar) { - SetMsgHandled(FALSE); - } - virtual void OnWindowPosChanging(WINDOWPOS* window_pos) { - SetMsgHandled(FALSE); - } - virtual void OnWindowPosChanged(WINDOWPOS* window_pos) { - SetMsgHandled(FALSE); - } + virtual void OnVScroll(int scroll_type, short position, HWND scrollbar); + virtual void OnWindowPosChanging(WINDOWPOS* window_pos); + virtual void OnWindowPosChanged(WINDOWPOS* window_pos); // deletes this window as it is destroyed, override to provide different // behavior. @@ -474,7 +413,7 @@ class WidgetWin : public base::WindowImpl, // Returns whether capture should be released on mouse release. The default // is true. - virtual bool ReleaseCaptureOnMouseReleased() { return true; } + virtual bool ReleaseCaptureOnMouseReleased(); // Creates the RootView to be used within this Widget. Can be overridden to // create specialized RootView implementations. |