#include "wx/button.h"
#include "wx/msgdlg.h"
#include "wx/settings.h"
-
- #include <stdio.h>
+ #include "wx/statbox.h"
#endif
#if wxUSE_OWNER_DRAWN
wxWindow *wxWindowMSW::FindItem(long id) const
{
#if wxUSE_CONTROLS
- wxControl *item = wxDynamicThisCast(this, wxControl);
+ wxControl *item = wxDynamicCastThis(wxControl);
if ( item )
{
// is it we or one of our "internal" children?
{
wxCHECK_MSG( parent, FALSE, wxT("can't create wxWindow without parent") );
+#if wxUSE_STATBOX
+ // wxGTK doesn't allow to create controls with static box as the parent so
+ // this will result in a crash when the program is ported to wxGTK - warn
+ // about it
+ //
+ // the correct solution is to create the controls as siblings of the
+ // static box
+ wxASSERT_MSG( !wxDynamicCastThis(wxStaticBox),
+ _T("wxStaticBox can't be used as a window parent!") );
+#endif // wxUSE_STATBOX
+
if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) )
return FALSE;
#ifndef __WXMICROWIN__
::SetLastError(0);
#endif
-
+
if ( !::SetFocus(hWnd) )
{
// was there really an error?
if ( show )
{
#ifdef __WXMICROWIN__
- // It seems that MicroWindows brings the _parent_ of the
- // window to the top, which can be the wrong one.
-
- /* activate (set focus to) specified window*/
- ::SetFocus(hWnd);
-
- /* raise top level parent to top of z order*/
- ::SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0,
- SWP_NOMOVE|SWP_NOSIZE);
+ // It seems that MicroWindows brings the _parent_ of the
+ // window to the top, which can be the wrong one.
+
+ // activate (set focus to) specified window
+ ::SetFocus(hWnd);
+
+ // raise top level parent to top of z order
+ ::SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0,
+ SWP_NOMOVE|SWP_NOSIZE);
#else
BringWindowToTop(hWnd);
#endif
::BringWindowToTop(GetHwnd());
#else // Win32
#ifdef __WXMICROWIN__
- // It seems that MicroWindows brings the _parent_ of the
- // window to the top, which can be the wrong one.
-
- /* activate (set focus to) specified window*/
- ::SetFocus(GetHwnd());
-
- /* raise top level parent to top of z order*/
- ::SetWindowPos(GetHwnd(), HWND_TOP, 0, 0, 0, 0,
- SWP_NOMOVE|SWP_NOSIZE);
+ // It seems that MicroWindows brings the _parent_ of the
+ // window to the top, which can be the wrong one.
+
+ // activate (set focus to) specified window
+ ::SetFocus(GetHwnd());
+
+ // raise top level parent to top of z order
+ ::SetWindowPos(GetHwnd(), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
#else
::SetForegroundWindow(GetHwnd());
#endif
m_oldWndProc = (WXFARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
wxASSERT( (WXFARPROC) m_oldWndProc != (WXFARPROC) wxWndProc );
-
+
SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc);
}
#if wxUSE_BUTTON
else
{
- wxPanel *panel = wxDynamicThisCast(this, wxPanel);
+ wxPanel *panel = wxDynamicCastThis(wxPanel);
wxButton *btn = NULL;
if ( panel )
{
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
case WM_MBUTTONDBLCLK:
- {
- processed = FALSE;
+ {
+ processed = FALSE;
#ifdef __WXMICROWIN__
- // MicroWindows seems to ignore the fact that a window
- // is disabled. So catch mouse events and throw them away if necessary.
- wxWindowMSW* win = this;
- while (win)
- {
- if (!win->IsEnabled())
- {
- processed = TRUE;
- break;
- }
- win = win->GetParent();
- if (win && win->IsTopLevel())
- break;
- }
-#endif
- if (!processed)
- {
+ // MicroWindows seems to ignore the fact that a window is
+ // disabled. So catch mouse events and throw them away if
+ // necessary.
+ wxWindowMSW* win = this;
+ while (win)
+ {
+ if (!win->IsEnabled())
+ {
+ processed = TRUE;
+ break;
+ }
+ win = win->GetParent();
+ if (win && win->IsTopLevel())
+ break;
+ }
+#endif // __WXMICROWIN__
+ if (!processed)
+ {
if (message == WM_LBUTTONDOWN && AcceptsFocus())
SetFocus();
processed = HandleMouseEvent(message,
GET_X_LPARAM(lParam),
GET_Y_LPARAM(lParam),
- wParam);
- }
+ wParam);
+ }
break;
- }
+ }
#ifdef __WXMICROWIN__
case WM_NCLBUTTONDOWN:
case WM_NCMBUTTONDOWN:
case WM_NCMBUTTONUP:
case WM_NCMBUTTONDBLCLK:
- #endif
- {
- // MicroWindows seems to ignore the fact that a window
- // is disabled. So catch mouse events and throw them away if necessary.
- processed = FALSE;
- wxWindowMSW* win = this;
- while (win)
- {
- if (!win->IsEnabled())
- {
- processed = TRUE;
- break;
- }
- win = win->GetParent();
- if (win && win->IsTopLevel())
- break;
- }
- break;
-
- }
#endif
-
-#ifdef MM_JOY1MOVE // __WXMICROWIN__
+ {
+ // MicroWindows seems to ignore the fact that a window
+ // is disabled. So catch mouse events and throw them away if necessary.
+ processed = FALSE;
+ wxWindowMSW* win = this;
+ while (win)
+ {
+ if (!win->IsEnabled())
+ {
+ processed = TRUE;
+ break;
+ }
+ win = win->GetParent();
+ if (win && win->IsTopLevel())
+ break;
+ }
+ break;
+ }
+#endif // __WXMICROWIN__
+
+#ifdef MM_JOY1MOVE
case MM_JOY1MOVE:
case MM_JOY2MOVE:
case MM_JOY1ZMOVE:
GET_Y_LPARAM(lParam),
wParam);
break;
-#endif
+#endif // __WXMICROWIN__
case WM_SYSCOMMAND:
processed = HandleSysCommand(wParam, lParam);
#endif // Win95
// for these messages we must return TRUE if process the message
-#ifdef WM_DRAWITEM // __WXMICROWIN__
+#ifdef WM_DRAWITEM
case WM_DRAWITEM:
case WM_MEASUREITEM:
{
rc.result = TRUE;
}
break;
-#endif
+#endif // defined(WM_DRAWITEM)
+
case WM_GETDLGCODE:
if ( m_lDlgCode )
{
lParam);
}
break;
-#endif
+#endif // !__WXMICROWIN__
// the return value for this message is ignored
case WM_SYSCOLORCHANGE:
}
else // creating a normal window, not a dialog
-#endif
- // __WXMICROWIN__
+#endif // !__WXMICROWIN__
{
int controlId = 0;
if ( style & WS_CHILD )
// finally try this window too (catches toolbar case)
return MSWOnNotify(idCtrl, lParam, result);
-#else
+#else // __WXMICROWIN__
return FALSE;
#endif
}
delete[] files;
return rc;
-#else
+#else // __WXMICROWIN__
return FALSE;
#endif
}
// cursor set, stop here
return TRUE;
}
-#endif
+#endif // __WXMICROWIN__
+
// pass up the window chain
return FALSE;
}
*brush = hBrush;
return hBrush != 0;
-#else
+#else // __WXMICROWIN__
return FALSE;
#endif
}
case VK_NUMPAD7: id = WXK_NUMPAD7; break;
case VK_NUMPAD8: id = WXK_NUMPAD8; break;
case VK_NUMPAD9: id = WXK_NUMPAD9; break;
- case VK_MULTIPLY: id = WXK_MULTIPLY; break;
- case 0xBB: // VK_OEM_PLUS
- case VK_ADD: id = WXK_ADD; break;
- case 0xBD: // VK_OEM_MINUS
- case VK_SUBTRACT: id = WXK_SUBTRACT; break;
- case 0xBE: // VK_OEM_PERIOD
- case VK_DECIMAL: id = WXK_DECIMAL; break;
- case VK_DIVIDE: id = WXK_DIVIDE; break;
+ case VK_MULTIPLY: id = WXK_NUMPAD_MULTIPLY; break;
+ case 0xBB: id = WXK_NUMPAD_ADD; break; // VK_OEM_PLUS
+ case VK_ADD: id = WXK_NUMPAD_ADD; break;
+ case 0xBD: id = WXK_NUMPAD_SUBTRACT; break; // VK_OEM_MINUS
+ case VK_SUBTRACT: id = WXK_NUMPAD_SUBTRACT; break;
+ case 0xBE: id = WXK_NUMPAD_DECIMAL; break; // VK_OEM_PERIOD
+ case VK_DECIMAL: id = WXK_NUMPAD_DECIMAL; break;
+ case VK_DIVIDE: id = WXK_NUMPAD_DIVIDE; break;
case VK_F1: id = WXK_F1; break;
case VK_F2: id = WXK_F2; break;
case VK_F3: id = WXK_F3; break;
case WXK_NUMPAD7: keySym = VK_NUMPAD7; break;
case WXK_NUMPAD8: keySym = VK_NUMPAD8; break;
case WXK_NUMPAD9: keySym = VK_NUMPAD9; break;
- case WXK_MULTIPLY: keySym = VK_MULTIPLY; break;
- case WXK_ADD: keySym = VK_ADD; break;
- case WXK_SUBTRACT: keySym = VK_SUBTRACT; break;
- case WXK_DECIMAL: keySym = VK_DECIMAL; break;
- case WXK_DIVIDE: keySym = VK_DIVIDE; break;
+ case WXK_NUMPAD_MULTIPLY: keySym = VK_MULTIPLY; break;
+ case WXK_NUMPAD_ADD: keySym = VK_ADD; break;
+ case WXK_NUMPAD_SUBTRACT: keySym = VK_SUBTRACT; break;
+ case WXK_NUMPAD_DECIMAL: keySym = VK_DECIMAL; break;
+ case WXK_NUMPAD_DIVIDE: keySym = VK_DIVIDE; break;
case WXK_F1: keySym = VK_F1; break;
case WXK_F2: keySym = VK_F2; break;
case WXK_F3: keySym = VK_F3; break;
return (int)CallNextHookEx(wxTheKeyboardHook, nCode, wParam, lParam);
}
-#endif
+
+#endif // !__WXMICROWIN__
#ifdef __WXDEBUG__
const char *wxGetMessageName(int message)