Replace wxTextCtrl::MSWWindowProc() with MSWHandleMessage()
Override newer and more flexible virtual method: this doesn't change anything yet but will allow to provide default handling for some messages in a single overridden method in the future commits, when it would have required to also override MSWDefWindowProc() with the old method.
This commit is contained in:
@@ -181,7 +181,10 @@ public:
|
|||||||
void OnSetFocus(wxFocusEvent& event);
|
void OnSetFocus(wxFocusEvent& event);
|
||||||
|
|
||||||
// intercept WM_GETDLGCODE
|
// intercept WM_GETDLGCODE
|
||||||
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
virtual bool MSWHandleMessage(WXLRESULT *result,
|
||||||
|
WXUINT message,
|
||||||
|
WXWPARAM wParam,
|
||||||
|
WXLPARAM lParam);
|
||||||
|
|
||||||
virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg);
|
virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg);
|
||||||
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
|
||||||
|
@@ -2058,14 +2058,27 @@ void wxTextCtrl::OnKeyDown(wxKeyEvent& event)
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
WXLRESULT wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
bool
|
||||||
|
wxTextCtrl::MSWHandleMessage(WXLRESULT *rc,
|
||||||
|
WXUINT nMsg,
|
||||||
|
WXWPARAM wParam,
|
||||||
|
WXLPARAM lParam)
|
||||||
{
|
{
|
||||||
WXLRESULT lRc = wxTextCtrlBase::MSWWindowProc(nMsg, wParam, lParam);
|
bool processed = wxTextCtrlBase::MSWHandleMessage(rc, nMsg, wParam, lParam);
|
||||||
|
|
||||||
switch ( nMsg )
|
switch ( nMsg )
|
||||||
{
|
{
|
||||||
case WM_GETDLGCODE:
|
case WM_GETDLGCODE:
|
||||||
{
|
{
|
||||||
|
// Ensure that the result value is initialized even if the base
|
||||||
|
// class didn't handle WM_GETDLGCODE but just update the value
|
||||||
|
// returned by it if it did handle it.
|
||||||
|
if ( !processed )
|
||||||
|
{
|
||||||
|
*rc = MSWDefWindowProc(nMsg, wParam, lParam);
|
||||||
|
processed = true;
|
||||||
|
}
|
||||||
|
|
||||||
// we always want the chars and the arrows: the arrows for
|
// we always want the chars and the arrows: the arrows for
|
||||||
// navigation and the chars because we want Ctrl-C to work even
|
// navigation and the chars because we want Ctrl-C to work even
|
||||||
// in a read only control
|
// in a read only control
|
||||||
@@ -2089,7 +2102,7 @@ WXLRESULT wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara
|
|||||||
if ( HasFlag(wxTE_PROCESS_TAB) )
|
if ( HasFlag(wxTE_PROCESS_TAB) )
|
||||||
lDlgCode |= DLGC_WANTTAB;
|
lDlgCode |= DLGC_WANTTAB;
|
||||||
|
|
||||||
lRc |= lDlgCode;
|
*rc |= lDlgCode;
|
||||||
}
|
}
|
||||||
else // !editable
|
else // !editable
|
||||||
{
|
{
|
||||||
@@ -2098,11 +2111,11 @@ WXLRESULT wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara
|
|||||||
// including DLGC_WANTMESSAGE). This is strange (how
|
// including DLGC_WANTMESSAGE). This is strange (how
|
||||||
// does it work in the native Win32 apps?) but for now
|
// does it work in the native Win32 apps?) but for now
|
||||||
// live with it.
|
// live with it.
|
||||||
lRc = lDlgCode;
|
*rc = lDlgCode;
|
||||||
}
|
}
|
||||||
if (IsMultiLine())
|
if (IsMultiLine())
|
||||||
// Clear the DLGC_HASSETSEL bit from the return value
|
// Clear the DLGC_HASSETSEL bit from the return value
|
||||||
lRc &= ~DLGC_HASSETSEL;
|
*rc &= ~DLGC_HASSETSEL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -2122,7 +2135,7 @@ WXLRESULT wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara
|
|||||||
#endif // wxUSE_MENUS
|
#endif // wxUSE_MENUS
|
||||||
}
|
}
|
||||||
|
|
||||||
return lRc;
|
return processed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user