got rid of wxWindow::m_lDlgCode - now wxWANTS_CHARS style should work for all windows, even the native controls
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14022 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -71,6 +71,12 @@ protected:
|
|||||||
// wxScrollHelperEvtHandler::ProcessEvent()
|
// wxScrollHelperEvtHandler::ProcessEvent()
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
|
|
||||||
|
// we need to return a special WM_GETDLGCODE value to process just the
|
||||||
|
// arrows but let the other navigation characters through
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
|
#endif // __WXMSW__
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_ABSTRACT_CLASS(wxGenericScrolledWindow)
|
DECLARE_ABSTRACT_CLASS(wxGenericScrolledWindow)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
@@ -171,6 +171,9 @@ protected:
|
|||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
// intercept WM_GETDLGCODE
|
||||||
|
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
|
|
||||||
// call this to increase the size limit (will do nothing if the current
|
// call this to increase the size limit (will do nothing if the current
|
||||||
// limit is big enough)
|
// limit is big enough)
|
||||||
//
|
//
|
||||||
|
@@ -422,9 +422,6 @@ protected:
|
|||||||
|
|
||||||
WXHMENU m_hMenu; // Menu, if any
|
WXHMENU m_hMenu; // Menu, if any
|
||||||
|
|
||||||
// the return value of WM_GETDLGCODE handler
|
|
||||||
long m_lDlgCode;
|
|
||||||
|
|
||||||
// implement the base class pure virtuals
|
// implement the base class pure virtuals
|
||||||
virtual void DoClientToScreen( int *x, int *y ) const;
|
virtual void DoClientToScreen( int *x, int *y ) const;
|
||||||
virtual void DoScreenToClient( int *x, int *y ) const;
|
virtual void DoScreenToClient( int *x, int *y ) const;
|
||||||
|
@@ -1102,11 +1102,6 @@ bool wxGenericScrolledWindow::Create(wxWindow *parent,
|
|||||||
|
|
||||||
bool ok = wxPanel::Create(parent, id, pos, size, style, name);
|
bool ok = wxPanel::Create(parent, id, pos, size, style, name);
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
|
||||||
// we need to process arrows ourselves for scrolling
|
|
||||||
m_lDlgCode |= DLGC_WANTARROWS;
|
|
||||||
#endif // __WXMSW__
|
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1123,6 +1118,25 @@ void wxGenericScrolledWindow::OnPaint(wxPaintEvent& event)
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
long
|
||||||
|
wxGenericScrolledWindow::MSWWindowProc(WXUINT nMsg,
|
||||||
|
WXWPARAM wParam,
|
||||||
|
WXLPARAM lParam)
|
||||||
|
{
|
||||||
|
long rc = wxPanel::MSWWindowProc(nMsg, wParam, lParam);
|
||||||
|
|
||||||
|
// we need to process arrows ourselves for scrolling
|
||||||
|
if ( nMsg == WM_GETDLGCODE )
|
||||||
|
{
|
||||||
|
rc |= DLGC_WANTARROWS;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __WXMSW__
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY
|
#if WXWIN_COMPATIBILITY
|
||||||
|
|
||||||
void wxGenericScrolledWindow::GetScrollUnitsPerPage (int *x_page, int *y_page) const
|
void wxGenericScrolledWindow::GetScrollUnitsPerPage (int *x_page, int *y_page) const
|
||||||
|
@@ -1501,7 +1501,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
|||||||
// if your compiler is as broken as this, you should really change it: this
|
// if your compiler is as broken as this, you should really change it: this
|
||||||
// code is needed for normal operation! #ifdef below is only useful for
|
// code is needed for normal operation! #ifdef below is only useful for
|
||||||
// automatic rebuilds which are done with a very old compiler version
|
// automatic rebuilds which are done with a very old compiler version
|
||||||
#ifdef LVM_FIRST
|
#ifdef HDN_BEGINTRACKA
|
||||||
|
|
||||||
// check for messages from the header (in report view)
|
// check for messages from the header (in report view)
|
||||||
HWND hwndHdr = ListView_GetHeader(GetHwnd());
|
HWND hwndHdr = ListView_GetHeader(GetHwnd());
|
||||||
@@ -1509,11 +1509,8 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
|||||||
// is it a message from the header?
|
// is it a message from the header?
|
||||||
if ( nmhdr->hwndFrom == hwndHdr )
|
if ( nmhdr->hwndFrom == hwndHdr )
|
||||||
{
|
{
|
||||||
#ifdef __WATCOMC__
|
|
||||||
HD_NOTIFY *nmHDR = (HD_NOTIFY *)nmhdr;
|
HD_NOTIFY *nmHDR = (HD_NOTIFY *)nmhdr;
|
||||||
#else
|
|
||||||
NMHEADER *nmHDR = (NMHEADER *)nmhdr;
|
|
||||||
#endif
|
|
||||||
event.m_itemIndex = -1;
|
event.m_itemIndex = -1;
|
||||||
|
|
||||||
switch ( nmhdr->code )
|
switch ( nmhdr->code )
|
||||||
@@ -1589,7 +1586,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif // defined(LVM_FIRST)
|
#endif // defined(HDN_BEGINTRACKA)
|
||||||
if ( nmhdr->hwndFrom == GetHwnd() )
|
if ( nmhdr->hwndFrom == GetHwnd() )
|
||||||
{
|
{
|
||||||
// almost all messages use NM_LISTVIEW
|
// almost all messages use NM_LISTVIEW
|
||||||
|
@@ -234,21 +234,6 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
|||||||
if ( m_windowStyle & wxTE_NOHIDESEL )
|
if ( m_windowStyle & wxTE_NOHIDESEL )
|
||||||
msStyle |= ES_NOHIDESEL;
|
msStyle |= ES_NOHIDESEL;
|
||||||
|
|
||||||
// we always want the characters and the arrows
|
|
||||||
m_lDlgCode = DLGC_WANTCHARS | DLGC_WANTARROWS;
|
|
||||||
|
|
||||||
// we may have several different cases:
|
|
||||||
// 1. normal case: both TAB and ENTER are used for dialog navigation
|
|
||||||
// 2. ctrl which wants TAB for itself: ENTER is used to pass to the next
|
|
||||||
// control in the dialog
|
|
||||||
// 3. ctrl which wants ENTER for itself: TAB is used for dialog navigation
|
|
||||||
// 4. ctrl which wants both TAB and ENTER: Ctrl-ENTER is used to pass to
|
|
||||||
// the next control
|
|
||||||
if ( m_windowStyle & wxTE_PROCESS_ENTER )
|
|
||||||
m_lDlgCode |= DLGC_WANTMESSAGE;
|
|
||||||
if ( m_windowStyle & wxTE_PROCESS_TAB )
|
|
||||||
m_lDlgCode |= DLGC_WANTTAB;
|
|
||||||
|
|
||||||
// do create the control - either an EDIT or RICHEDIT
|
// do create the control - either an EDIT or RICHEDIT
|
||||||
wxString windowClass = wxT("EDIT");
|
wxString windowClass = wxT("EDIT");
|
||||||
|
|
||||||
@@ -1173,6 +1158,32 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
||||||
|
{
|
||||||
|
// we always want the characters and the arrows
|
||||||
|
if ( nMsg == WM_GETDLGCODE )
|
||||||
|
{
|
||||||
|
// we always want the chars and the arrows
|
||||||
|
long lDlgCode = DLGC_WANTCHARS | DLGC_WANTARROWS;
|
||||||
|
|
||||||
|
// we may have several different cases:
|
||||||
|
// 1. normal case: both TAB and ENTER are used for dialog navigation
|
||||||
|
// 2. ctrl which wants TAB for itself: ENTER is used to pass to the next
|
||||||
|
// control in the dialog
|
||||||
|
// 3. ctrl which wants ENTER for itself: TAB is used for dialog navigation
|
||||||
|
// 4. ctrl which wants both TAB and ENTER: Ctrl-ENTER is used to pass to
|
||||||
|
// the next control
|
||||||
|
if ( m_windowStyle & wxTE_PROCESS_ENTER )
|
||||||
|
lDlgCode |= DLGC_WANTMESSAGE;
|
||||||
|
if ( m_windowStyle & wxTE_PROCESS_TAB )
|
||||||
|
lDlgCode |= DLGC_WANTTAB;
|
||||||
|
|
||||||
|
return lDlgCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return wxTextCtrlBase::MSWWindowProc(nMsg, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
||||||
{
|
{
|
||||||
switch (param)
|
switch (param)
|
||||||
|
@@ -303,9 +303,6 @@ void wxWindowMSW::Init()
|
|||||||
|
|
||||||
m_hWnd = 0;
|
m_hWnd = 0;
|
||||||
|
|
||||||
// pass WM_GETDLGCODE to DefWindowProc()
|
|
||||||
m_lDlgCode = 0;
|
|
||||||
|
|
||||||
m_xThumbSize = 0;
|
m_xThumbSize = 0;
|
||||||
m_yThumbSize = 0;
|
m_yThumbSize = 0;
|
||||||
m_backgroundTransparent = FALSE;
|
m_backgroundTransparent = FALSE;
|
||||||
@@ -415,14 +412,6 @@ bool wxWindowMSW::Create(wxWindow *parent,
|
|||||||
{
|
{
|
||||||
msflags |= WS_BORDER;
|
msflags |= WS_BORDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate the value to return from WM_GETDLGCODE handler
|
|
||||||
if ( GetWindowStyleFlag() & wxWANTS_CHARS )
|
|
||||||
{
|
|
||||||
// want everything: i.e. all keys and WM_CHAR message
|
|
||||||
m_lDlgCode = DLGC_WANTARROWS | DLGC_WANTCHARS |
|
|
||||||
DLGC_WANTTAB | DLGC_WANTMESSAGE;
|
|
||||||
}
|
|
||||||
#endif // wxUniversal/!wxUniversal
|
#endif // wxUniversal/!wxUniversal
|
||||||
|
|
||||||
if ( style & wxPOPUP_WINDOW )
|
if ( style & wxPOPUP_WINDOW )
|
||||||
@@ -2369,9 +2358,11 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
|
|||||||
#endif // defined(WM_DRAWITEM)
|
#endif // defined(WM_DRAWITEM)
|
||||||
|
|
||||||
case WM_GETDLGCODE:
|
case WM_GETDLGCODE:
|
||||||
if ( m_lDlgCode )
|
if ( GetWindowStyleFlag() & wxWANTS_CHARS )
|
||||||
{
|
{
|
||||||
rc.result = m_lDlgCode;
|
// want everything: i.e. all keys and WM_CHAR message
|
||||||
|
rc.result = DLGC_WANTARROWS | DLGC_WANTCHARS |
|
||||||
|
DLGC_WANTTAB | DLGC_WANTMESSAGE;
|
||||||
processed = TRUE;
|
processed = TRUE;
|
||||||
}
|
}
|
||||||
//else: get the dlg code from the DefWindowProc()
|
//else: get the dlg code from the DefWindowProc()
|
||||||
|
Reference in New Issue
Block a user