#include "wx/scrolwin.h"
#include "wx/radiobox.h"
#include "wx/slider.h"
+ #include "wx/statbox.h"
#include "wx/statusbr.h"
#include "wx/toolbar.h"
#include "wx/settings.h"
//
// PM specific
//
- m_bDoubleClickAllowed = 0;
m_bWinCaptured = FALSE;
m_isBeingDeleted = FALSE;
- m_fnOldWndProc = 0;
+ m_fnOldWndProc = NULL;
m_bUseCtl3D = FALSE;
m_bMouseInWindow = FALSE;
m_bLastKeydownProcessed = FALSE;
for (wxWindow* pWin = GetParent(); pWin; pWin = pWin->GetParent())
{
- wxFrame* pFrame = wxDynamicCast(pWin, wxFrame);
+ wxTopLevelWindow* pFrame = wxDynamicCast(pWin, wxTopLevelWindow);
if (pFrame)
{
if (pFrame->GetLastFocus() == this)
- pFrame->SetLastFocus((wxWindow*)NULL);
+ pFrame->SetLastFocus(NULL);
}
}
// Generic OS/2 Windows have no Control Data but other classes
// that call OS2Create may have some.
//
- OS2Create( (PSZ)wxCanvasClassName
- ,rName.c_str()
- ,ulCreateFlags
- ,rPos
- ,rSize
- ,NULL // Control Data
- ,dwExStyle
- ,TRUE // Child
- );
-
- return(TRUE);
+ return(OS2Create( (PSZ)wxCanvasClassName
+ ,rName.c_str()
+ ,ulCreateFlags
+ ,rPos
+ ,rSize
+ ,NULL // Control Data
+ ,dwExStyle
+ ,TRUE // Child
+ ));
} // end of wxWindowOS2::Create
// ---------------------------------------------------------------------------
int nY2 = nY;
wxWindow* pParent = (wxWindow*)GetParent();
- if (pParent && !IsKindOf(CLASSINFO(wxDialog)))
- {
- int nOS2Height = GetOS2ParentHeight(pParent);
-
- nY2 = nOS2Height - (nY2 + nHeight);
- }
- else
- {
- RECTL vRect;
-
- ::WinQueryWindowRect(HWND_DESKTOP, &vRect);
- nY2 = vRect.yTop - (nY2 + nHeight);
- }
if (nX == nCurrentX && nY2 == nCurrentY &&
nWidth == nCurrentWidth && nHeight == nCurrentHeight)
{
, int nHeight
)
{
- wxWindow* pParent = GetParent();
- HWND hWnd = GetHwnd();
- HWND hParentWnd = (HWND)0;
POINTL vPoint;
- RECTL vRect;
- RECTL vRect2;
- RECTL vRect3;
- HWND hClientWnd = (HWND)0;
+ int nActualWidth;
+ int nActualHeight;
+ wxWindow* pParent = (wxWindow*)GetParent();
+ HWND hParentWnd = (HWND)0;
- hClientWnd = ::WinWindowFromID(hWnd, FID_CLIENT);
- ::WinQueryWindowRect(hClientWnd, &vRect2);
- ::WinQueryWindowRect(hWnd, &vRect);
- ::WinQueryWindowRect(hParentWnd, &vRect3);
+ if (pParent)
+ hParentWnd = (HWND)pParent->GetHWND();
+
+ if (IsKindOf(CLASSINFO(wxFrame)))
+ {
+ wxFrame* pFrame = wxDynamicCast(this, wxFrame);
+ HWND hFrame = pFrame->GetFrame();
+ RECTL vRect;
+ RECTL vRect2;
+ RECTL vRect3;
- int nActualWidth = vRect2.xRight - vRect2.xLeft - vRect.xRight + nWidth;
- int nActualHeight = vRect2.yTop - vRect2.yBottom - vRect.yTop + nHeight;
+ ::WinQueryWindowRect(GetHwnd(), &vRect2);
+ ::WinQueryWindowRect(hFrame, &vRect);
+ ::WinQueryWindowRect(hParentWnd, &vRect3);
+ nActualWidth = vRect2.xRight - vRect2.xLeft - vRect.xRight + nWidth;
+ nActualHeight = vRect2.yTop - vRect2.yBottom - vRect.yTop + nHeight;
- vPoint.x = vRect2.xLeft;
- vPoint.y = vRect2.yBottom;
- if (pParent)
+ vPoint.x = vRect2.xLeft;
+ vPoint.y = vRect2.yBottom;
+ if (pParent)
+ {
+ vPoint.x -= vRect3.xLeft;
+ vPoint.y -= vRect3.yBottom;
+ }
+ }
+ else
{
- vPoint.x -= vRect3.xLeft;
- vPoint.y -= vRect3.yBottom;
+ int nX;
+ int nY;
+
+ GetPosition(&nX, &nY);
+ nActualWidth = nWidth;
+ nActualHeight = nHeight;
+
+ vPoint.x = nX;
+ vPoint.y = nY;
}
+ DoMoveWindow( vPoint.x
+ ,vPoint.y
+ ,nActualWidth
+ ,nActualHeight
+ );
- DoMoveWindow(vPoint.x, vPoint.y, nActualWidth, nActualHeight);
+ wxSizeEvent vEvent( wxSize( nWidth
+ ,nHeight
+ )
+ ,m_windowId
+ );
- wxSizeEvent vEvent(wxSize(nWidth, nHeight), m_windowId);
vEvent.SetEventObject(this);
GetEventHandler()->ProcessEvent(vEvent);
} // end of wxWindowOS2::DoSetClientSize
pMsg = pMsg; // just shut up the compiler
#endif // __WXUNIVERSAL__
-#if wxUSE_TOOLTIPS
- if ( m_tooltip )
- {
- // relay mouse move events to the tooltip control
- QMSG* pQMsg = (QMSG*)pMsg;
-
- if (pQMsg->msg == WM_MOUSEMOVE )
- m_tooltip->RelayEvent(pMsg);
- }
-#endif // wxUSE_TOOLTIPS
-
return FALSE;
} // end of wxWindowOS2::OS2ProcessMessage
{
if (pFrame->GetStatusBar())
pFrame->PositionStatusBar();
+ if (pFrame->GetToolBar())
+ pFrame->PositionToolBar();
}
}
}
break;
case WM_QUERYDLGCODE:
- if ( m_lDlgCode )
+ if (!IsOfStandardClass())
{
- mResult = (MRESULT)m_lDlgCode;
- bProcessed = TRUE;
+ if ( m_lDlgCode )
+ {
+ mResult = (MRESULT)m_lDlgCode;
+ bProcessed = TRUE;
+ }
}
//
//else: get the dlg code from the DefWindowProc()
HWND hWnd = ::WinWindowFromID(GetHWND(), SHORT1FROMMP(wParam));
wxWindowOS2* pChild = wxFindWinFromHandle(hWnd);
+ if (!pChild)
+ {
+ bProcessed = FALSE;
+ break;
+ }
if (pChild->IsKindOf(CLASSINFO(wxSlider)))
bProcessed = OS2OnScroll( wxVERTICAL
,(int)SHORT2FROMMP(wParam)
if ( bProcessed )
{
// we never set focus from here
- mResult = FALSE;
+ mResult = (MRESULT)FALSE;
}
break;
) const
{
bool bNonDefault = FALSE;
+ static const int DEFAULT_Y = 200;
+ static const int DEFAULT_H = 250;
if (rPos.x == -1)
{
- //
- // If set x to CW_USEDEFAULT, y parameter is ignored anyhow so we can
- // just as well set it to CW_USEDEFAULT as well
rnX = rnY = CW_USEDEFAULT;
}
else
{
rnX = rPos.x;
- rnY = rPos.y == -1 ? CW_USEDEFAULT : rPos.y;
+ rnY = rPos.y == -1 ? DEFAULT_Y : rPos.y;
bNonDefault = TRUE;
}
if (rSize.x == -1)
{
- //
- // As abobe, h is not used at all in this case anyhow
- //
rnWidth = rnHeight = CW_USEDEFAULT;
}
else
{
rnWidth = rSize.x;
- rnHeight = rSize.y == -1 ? CW_USEDEFAULT : rSize.y;
+ rnHeight = rSize.y == -1 ? DEFAULT_H : rSize.y;
bNonDefault = TRUE;
}
return bNonDefault;
} // end of wxWindowOS2::HandleSetFocus
bool wxWindowOS2::HandleKillFocus(
- WXHWND WXUNUSED(hWnd)
+ WXHWND hWnd
)
{
#if wxUSE_CARET
}
#endif // wxUSE_CARET
+#if wxUSE_TEXTCTRL
+ //
+ // If it's a wxTextCtrl don't send the event as it will be done
+ // after the control gets to process it.
+ //
+ wxTextCtrl* pCtrl = wxDynamicCastThis(wxTextCtrl);
+
+ if (pCtrl)
+ {
+ return FALSE;
+ }
+#endif
+
+ //
+ // Don't send the event when in the process of being deleted. This can
+ // only cause problems if the event handler tries to access the object.
+ //
+ if ( m_isBeingDeleted )
+ {
+ return FALSE;
+ }
+
wxFocusEvent vEvent( wxEVT_KILL_FOCUS
,m_windowId
);
vEvent.SetEventObject(this);
+
+ //
+ // wxFindWinFromHandle() may return NULL, it is ok
+ //
+ vEvent.SetWindow(wxFindWinFromHandle(hWnd));
return GetEventHandler()->ProcessEvent(vEvent);
} // end of wxWindowOS2::HandleKillFocus
, WXUINT uFlags
)
{
+ bool bProcessed = FALSE;
+
//
// The mouse events take consecutive IDs from WM_MOUSEFIRST to
// WM_MOUSELAST, so it's enough to substract WM_MOUSEMOVE == WM_MOUSEFIRST
,uFlags
);
+ bProcessed = GetEventHandler()->ProcessEvent(vEvent);
+ if (!bProcessed)
+ {
+ HPOINTER hPtr = ::WinQuerySysPointer(HWND_DESKTOP, SPTR_WAIT, FALSE);
+ HPOINTER hCursor = (HPOINTER)GetCursor().GetHCURSOR();
+
+ if (hCursor != NULLHANDLE)
+ {
+ ::WinSetPointer(HWND_DESKTOP, hCursor);
+ bProcessed = TRUE;
+ }
+ }
return GetEventHandler()->ProcessEvent(vEvent);
} // end of wxWindowOS2::HandleMouseEvent
if (isASCII)
{
//
- // If 1 -> 26, translate to CTRL plus a letter.
+ // If 1 -> 26, translate to either special keycode or just set
+ // ctrlDown. IOW, Ctrl-C should result in keycode == 3 and
+ // ControlDown() == TRUE.
//
vId = (int)wParam;
if ((vId > 0) && (vId < 27))
default:
bCtrlDown = TRUE;
- vId = vId + 'a' - 1;
+ break;
}
}
}
IsKindOf(CLASSINFO(wxMenuBar)) ||
IsKindOf(CLASSINFO(wxToolBar))
)
- return(pParent->GetSize().y);
+ {
+ if (IsKindOf(CLASSINFO(wxToolBar)))
+ {
+ wxFrame* pFrame = wxDynamicCast(GetParent(), wxFrame);
+
+ if (pFrame->GetToolBar() == this)
+ return(pParent->GetSize().y);
+ else
+ return(pParent->GetClientSize().y);
+ }
+ else
+ return(pParent->GetSize().y);
+ }
else
return(pParent->GetClientSize().y);
}
, short* pnY
)
{
- wxCHECK_MSG( pnX && pnY, pWin, _T("NULL pointer in FindWindowForMouseEvent") );
- POINTL vPoint = { *pnX, *pnY };
HWND hWnd = GetHwndOf(pWin);
HWND hWndUnderMouse;
+ POINTL vPoint;
+ BOOL rcEnabled = FALSE;
+ BOOL rcVisible = FALSE;
+ HWND hWndDesktop = HWND_DESKTOP;
- //
- // First try to find a non transparent child: this allows us to send events
- // to a static text which is inside a static box, for example
- //
-
- hWndUnderMouse = ::WinWindowFromPoint( hWnd
- ,&vPoint
- ,TRUE
- );
- if (!hWndUnderMouse || hWndUnderMouse == hWnd)
+ ::WinQueryPointerPos(HWND_DESKTOP, &vPoint);
+ hWndUnderMouse = ::WinWindowFromPoint(HWND_DESKTOP, &vPoint, TRUE);
+ if (hWndUnderMouse != HWND_DESKTOP)
{
- //
- // Now try any child window at all
- //
- hWndUnderMouse = ::WinWindowFromPoint( HWND_DESKTOP
- ,&vPoint
- ,TRUE
- );
+ wxWindow* pWinUnderMouse = wxFindWinFromHandle((WXHWND)hWndUnderMouse);
+
+ if (pWinUnderMouse)
+ {
+ wxWindowList::Node* pCurrent = pWinUnderMouse->GetChildren().GetFirst();
+ wxWindow* pChild = NULL;
+ wxWindow* pGrandChild = NULL;
+ RECTL vRect;
+ POINTL vPoint2;
+
+ ::WinMapWindowPoints(HWND_DESKTOP, hWndUnderMouse, &vPoint, 1);
+ //
+ // Find a child window mouse might be under
+ //
+ while (pCurrent)
+ {
+ wxWindow* pChild = pCurrent->GetData();
+
+ vPoint2.x = vPoint.x;
+ vPoint2.y = vPoint.y;
+ ::WinMapWindowPoints(hWndUnderMouse, pChild->GetHWND(), &vPoint2, 1);
+ ::WinQueryWindowRect(pChild->GetHWND(), &vRect);
+ if (::WinPtInRect(vHabmain, &vRect, &vPoint2))
+ {
+ if (pChild->IsTopLevel())
+ {
+ POINTL vPoint3;
+ wxWindowList::Node* pCurrent2 =pChild->GetChildren().GetFirst();
+ while (pCurrent2)
+ {
+ wxWindow* pGrandChild = pCurrent2->GetData();
+
+ vPoint3.x = vPoint2.x;
+ vPoint3.y = vPoint2.y;
+ ::WinMapWindowPoints( pChild->GetHWND()
+ ,pGrandChild->GetHWND()
+ ,&vPoint3
+ ,1
+ );
+ ::WinQueryWindowRect(pGrandChild->GetHWND(), &vRect);
+ if (::WinPtInRect(vHabmain, &vRect, &vPoint3))
+ {
+ hWndUnderMouse = GetHwndOf(pGrandChild);
+ pWinUnderMouse = pGrandChild;
+ break;
+ }
+ pCurrent2 = pCurrent2->GetNext();
+ }
+ if (pGrandChild)
+ break;
+ }
+ hWndUnderMouse = GetHwndOf(pChild);
+ pWinUnderMouse = pChild;
+ rcVisible = ::WinIsWindowVisible(hWndUnderMouse);
+ rcEnabled = ::WinIsWindowEnabled(hWndUnderMouse);
+ if (rcVisible && rcEnabled)
+ break;
+ }
+ pCurrent = pCurrent->GetNext();
+ }
+ }
}
+ rcVisible = ::WinIsWindowVisible(hWndUnderMouse);
+ rcEnabled = ::WinIsWindowEnabled(hWndUnderMouse);
+
//
// Check that we have a child window which is susceptible to receive mouse
// events: for this it must be shown and enabled
+ //
if ( hWndUnderMouse &&
hWndUnderMouse != hWnd &&
- ::WinIsWindowVisible(hWndUnderMouse) &&
- ::WinIsWindowEnabled(hWndUnderMouse))
+ rcVisible && rcEnabled)
{
- wxWindow* pWinUnderMouse = wxFindWinFromHandle((WXHWND)hWndUnderMouse);
+ wxWindow* pWinUnderMouse = wxFindWinFromHandle((WXHWND)hWndUnderMouse);
+
if (pWinUnderMouse)
{
- // translate the mouse coords to the other window coords
- pWin->ClientToScreen( (int*)pnX
- ,(int*)pnY
- );
- pWinUnderMouse->ScreenToClient( (int*)pnX
- ,(int*)pnY
- );
+ //
+ // Translate the mouse coords to the other window coords
+ //
pWin = pWinUnderMouse;
}
}