#include "wx/listbox.h"
#include "wx/button.h"
#include "wx/msgdlg.h"
+ #include "wx/scrolwin.h"
#include <stdio.h>
#endif
// ---------------------------------------------------------------------------
//
-// The last Windows message we got (MT-UNSAFE)
+// The last PM message we got (MT-UNSAFE)
//
QMSG s_currentMsg;
+#if wxUSE_MENUS_NATIVE
wxMenu* wxCurrentPopupMenu = NULL;
-extern wxList WXDLLEXPORT wxPendingDelete;
+#endif // wxUSE_MENUS_NATIVE
+
#if !defined(__VISAGECPP__) || (__IBMCPP__ < 400)
extern wxChar wxCanvasClassName[];
#endif
const char *wxGetMessageName(int message);
#endif //__WXDEBUG__
-void wxRemoveHandleAssociation(wxWindow* pWin);
-void wxAssociateWinWithHandle( HWND hWnd
- ,wxWindow* pWin
+void wxRemoveHandleAssociation(wxWindowOS2* pWin);
+void wxAssociateWinWithHandle( HWND hWnd
+ ,wxWindowOS2* pWin
);
wxWindow* wxFindWinFromHandle(WXHWND hWnd);
// This magical function is used to translate VK_APPS key presses to right
// mouse clicks
//
+// Unused?
+#if 0
static void TranslateKbdEventToMouse( wxWindow* pWin
,int* pX
,int* pY
,MPARAM* pFlags
);
-
+#endif
//
// get the current state of SHIFT/CTRL keys
//
// event tables
// ---------------------------------------------------------------------------
+// in wxUniv-OS/2 this class is abstract because it doesn't have DoPopupMenu()
+// method
+#ifdef __WXUNIVERSAL__
+ IMPLEMENT_ABSTRACT_CLASS(wxWindowOS2, wxWindowBase)
+#else // __WXPM__
IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
+#endif // __WXUNIVERSAL__/__WXPM__
-BEGIN_EVENT_TABLE(wxWindow, wxWindowBase)
+BEGIN_EVENT_TABLE(wxWindowOS2, wxWindowBase)
EVT_ERASE_BACKGROUND(wxWindowOS2::OnEraseBackground)
EVT_SYS_COLOUR_CHANGED(wxWindowOS2::OnSysColourChanged)
EVT_INIT_DIALOG(wxWindowOS2::OnInitDialog)
// implementation
// ===========================================================================
+// ---------------------------------------------------------------------------
+// wxWindow utility functions
+// ---------------------------------------------------------------------------
+
//
// Find an item given the PM Window id
//
long lId
) const
{
- wxControl* pItem = wxDynamicCast( this
- ,wxControl
- );
+#if wxUSE_CONTROLS
+ wxControl* pItem = wxDynamicCast(this, wxControl);
if (pItem)
{
//
// I it we or one of our "internal" children?
//
- if (pItem->GetId() == lId ||
- (pItem->GetSubcontrols().Index(lId) != wxNOT_FOUND))
+ if (pItem->GetId() == lId
+#ifndef __WXUNIVERSAL__
+ || (pItem->GetSubcontrols().Index(lId) != wxNOT_FOUND)
+#endif
+ )
{
return pItem;
}
}
+#endif // wxUSE_CONTROLS
wxWindowList::Node* pCurrent = GetChildren().GetFirst();
if (pWnd)
return(pWnd);
- if (!bControlOnly || pParent->IsKindOf(CLASSINFO(wxControl)))
+ if (!bControlOnly
+#if wxUSE_CONTROLS
+ || pParent->IsKindOf(CLASSINFO(wxControl))
+#endif // wxUSE_CONTROLS
+ )
{
wxWindow* pItem = pCurrent->GetData();
pFrame->SetLastFocus((wxWindow*)NULL);
}
}
+
+ DestroyChildren();
+
if (m_parent)
m_parent->RemoveChild(this);
- DestroyChildren();
if (m_hWnd)
{
}
} // end of wxWindowOS2::~wxWindowOS2
+// real construction (Init() must have been called before!)
bool wxWindowOS2::Create(
wxWindow* pParent
, wxWindowID vId
{
HWND hParent = NULLHANDLE;
wxPoint vPos = rPos; // The OS/2 position
- ULONG ulCreateFlags = 0L;
+ ULONG ulCreateFlags = 0;
+ WXDWORD dwExStyle = 0;
wxCHECK_MSG(pParent, FALSE, wxT("can't create wxWindow without parent"));
ulCreateFlags |= WS_VISIBLE;
+#ifdef __WXUNIVERSAL__
+ // no 3d effects, we draw them ourselves
+ WXDWORD exStyle = 0;
+#else // !wxUniversal
if (lStyle & wxCLIP_SIBLINGS)
ulCreateFlags |= WS_CLIPSIBLINGS;
//
//
bool bWant3D;
- WXDWORD dwExStyle = Determine3DEffects( WS_EX_CLIENTEDGE
- ,&bWant3D
- );
+ dwExStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &bWant3D);
+
+#endif
//
// Add the simple border style as we'll use this to draw borders
if (lStyle & wxSIMPLE_BORDER)
dwExStyle |= wxSIMPLE_BORDER;
+ if (lStyle & wxPOPUP_WINDOW)
+ {
+ // a popup window floats on top of everything
+//TODO: fix this...
+// exStyle |= WS_EX_TOPMOST | WS_EX_TOOLWINDOW;
+
+ // it is also created hidden as other top level windows
+ ulCreateFlags &= ~WS_VISIBLE;
+ m_isShown = FALSE;
+ }
+
//
// Generic OS/2 Windows are created with no owner, no Z Order, no Control data,
// and no presentation parameters
void wxWindowOS2::SetFocus()
{
HWND hWnd = GetHwnd();
+ wxCHECK_RET( hWnd, _T("can't set focus to invalid window") );
if (hWnd)
::WinSetFocus(HWND_DESKTOP, hWnd);
pChild->Enable(bEnable);
pNode = pNode->GetNext();
}
- return(TRUE);
+ return TRUE;
} // end of wxWindowOS2::Enable
bool wxWindowOS2::Show(
{
::WinSetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE | SWP_ZORDER);
}
- return(TRUE);
+ return TRUE;
} // end of wxWindowOS2::Show
void wxWindowOS2::Raise()
wxChar zFont[128];
sprintf(zFont, "%d.%s", rFont.GetPointSize(), rFont.GetFaceName().c_str());
- return(::WinSetPresParam(hWnd, PP_FONTNAMESIZE, strlen(zFont), (PVOID)zFont));
+ return (bool)::WinSetPresParam(hWnd, PP_FONTNAMESIZE, strlen(zFont), (PVOID)zFont);
}
return(TRUE);
}
return FALSE;
}
- wxASSERT_MSG( m_cursor.Ok(),
- wxT("cursor must be valid after call to the base version"));
-
- HWND hWnd = GetHwnd();
- POINTL vPoint;
- RECTL vRect;
- HPS hPS;
- HRGN hRGN;
-
- hPS = ::WinGetPS(hWnd);
-
- ::WinQueryPointerPos(HWND_DESKTOP, &vPoint);
- ::WinQueryWindowRect(hWnd, &vRect);
+ if ( m_cursor.Ok() ) {
+ HWND hWnd = GetHwnd();
+ POINTL vPoint;
+ RECTL vRect;
- hRGN = ::GpiCreateRegion(hPS, 1L, &vRect);
+ ::WinQueryPointerPos(HWND_DESKTOP, &vPoint);
+ ::WinQueryWindowRect(hWnd, &vRect);
- if ((::GpiPtInRegion(hPS, hRGN, &vPoint) == PRGN_INSIDE) && !wxIsBusy())
- {
- ::WinSetPointer(HWND_DESKTOP, (HPOINTER)m_cursor.GetHCURSOR());
+ if (::WinPtInRect(vHabmain, &vRect, &vPoint) && !wxIsBusy())
+ {
+ ::WinSetPointer(HWND_DESKTOP, (HPOINTER)m_cursor.GetHCURSOR());
+ }
}
return TRUE;
} // end of wxWindowOS2::SetCursor
void wxWindowOS2::SetScrollPos(
int nOrient
, int nPos
-, bool bRefresh
+, bool WXUNUSED(bRefresh)
)
{
if (nOrient == wxHORIZONTAL )
::WinSendMsg(m_hWndScrollBarHorz, SBM_SETPOS, (MPARAM)nPos, (MPARAM)NULL);
else
::WinSendMsg(m_hWndScrollBarVert, SBM_SETPOS, (MPARAM)nPos, (MPARAM)NULL);
-} // end of wxWindowOS2::SetScrollPos(
+} // end of wxWindowOS2::SetScrollPos
void wxWindowOS2::SetScrollbar(
int nOrient
, int nPos
, int nThumbVisible
, int nRange
-, bool bRefresh
+, bool WXUNUSED(bRefresh)
)
{
int nOldRange = nRange - nThumbVisible;
} // end of wxWindowOS2::SetupColours
void wxWindowOS2::OnIdle(
- wxIdleEvent& rEvent
+ wxIdleEvent& WXUNUSED(rEvent)
)
{
//
void wxWindowOS2::Clear()
{
- wxClientDC vDc(this);
+ wxClientDC vDc((wxWindow*)this);
wxBrush vBrush( GetBackgroundColour()
,wxSOLID
);
// We may be faking the client origin. So a window that's really at (0,
// 30) may appear (to wxWin apps) to be at (0, 0).
//
- wxPoint vPt(pParent->GetClientAreaOrigin());
+ if (pParent) {
+ wxPoint vPt(pParent->GetClientAreaOrigin());
- vPoint.x -= vPt.x;
- vPoint.y -= vPt.y;
+ vPoint.x -= vPt.x;
+ vPoint.y -= vPt.y;
+ }
}
if (pX)
) const
{
HWND hWnd = GetHwnd();
- SWP vSwp;
+ POINTL ptl;
+
+ ptl.x = pX ? *pX : 0;
+ ptl.y = pY ? *pY : 0;
- ::WinQueryWindowPos(hWnd, &vSwp);
+ ::WinMapWindowPoints(HWND_DESKTOP, hWnd, &ptl, 1);
if (pX)
- *pX -= vSwp.x;
+ *pX = ptl.x;
if (pY)
- *pY -= vSwp.y;
+ *pY = ptl.y;
+
} // end of wxWindowOS2::DoScreenToClient
void wxWindowOS2::DoClientToScreen(
) const
{
HWND hWnd = GetHwnd();
- SWP vSwp;
+ POINTL ptl;
+
+ ptl.x = pX ? *pX : 0;
+ ptl.y = pY ? *pY : 0;
- ::WinQueryWindowPos(hWnd, &vSwp);
+ ::WinMapWindowPoints(hWnd, HWND_DESKTOP, &ptl, 1);
if (pX)
- *pX += vSwp.x;
+ *pX = ptl.x;
if (pY)
- *pY += vSwp.y;
+ *pY = ptl.y;
} // end of wxWindowOS2::DoClientToScreen
//
, int nHeight
)
{
+#if 0 // x and y coords should already be in os2 coordinates
RECTL vRect;
HWND hParent;
wxWindow* pParent = GetParent();
hParent = HWND_DESKTOP;
::WinQueryWindowRect(hParent, &vRect);
nY = vRect.yTop - (nY + nHeight);
-
+#endif
if ( !::WinSetWindowPos( GetHwnd()
,HWND_TOP
,(LONG)nX
int nCurrentHeight;
wxSize vSize(-1, -1);
- GetPosition( &nCurrentX
- ,&nCurrentY
- );
- GetSize( &nCurrentWidth
- ,&nCurrentHeight
- );
+ GetPosition(&nCurrentX, &nCurrentY);
+ GetSize(&nCurrentWidth, &nCurrentHeight);
- //
// ... and don't do anything (avoiding flicker) if it's already ok
- //
- if ( nX == nCurrentX &&
- nY == nCurrentY &&
- nWidth == nCurrentWidth &&
- nHeight == nCurrentHeight
- )
+ if (nX == nCurrentX && nY == nCurrentY &&
+ nWidth == nCurrentWidth && nHeight == nCurrentHeight)
{
return;
}
if (nY == -1 && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE))
nY = nCurrentY;
- AdjustForParentClientOrigin( nX
- ,nY
- ,nSizeFlags
- );
+ AdjustForParentClientOrigin(nX, nY, nSizeFlags);
if (nWidth == -1)
{
{
wxWindow* pParent = GetParent();
HWND hWnd = GetHwnd();
+#if 0
HWND hParentWnd = (HWND)0;
HWND hClientWnd = (HWND)0;
RECTL vRect;
vPoint.x = vRect2.xLeft;
vPoint.y = vRect2.yBottom;
if (pParent)
- {
+ { x
vPoint.x -= vRect3.xLeft;
vPoint.y -= vRect3.yBottom;
}
+#else
+ HWND hParentWnd = (HWND)0;
+ HWND hClientWnd = (HWND)0;
+ RECTL vRect;
+ RECT vRect2;
- DoMoveWindow( vPoint.x
- ,vPoint.y
- ,nActualWidth
- ,nActualHeight
- );
+ hClientWnd = ::WinWindowFromID(GetHwnd(), FID_CLIENT);
+ ::WinQueryWindowRect(hClientWnd, &vRect2);
+ ::WinQueryWindowRect(hWnd, &vRect2);
- wxSizeEvent vEvent( wxSize( nWidth
- ,nHeight
- )
- ,m_windowId
- );
+ if (pParent)
+ hParentWnd = (HWND) pParent->GetHWND();
+
+ ::WinQueryWindowRect(hWnd, &vRect);
+ //
+ // Find the difference between the entire window (title bar and all)
+ // and the client area; add this to the new client size to move the
+ // window. OS/2 is backward from windows on height
+ //
+ int nActualWidth = vRect2.xRight - vRect2.xLeft - vRect.xRight + nWidth;
+ int nActualHeight = vRect2.yTop - vRect2.yBottom - vRect.yTop + nHeight;
+
+ nActualWidth = nWidth;
+ nActualHeight = nHeight;
+ //
+ // If there's a parent, must subtract the parent's bottom left corner
+ // since MoveWindow moves relative to the parent
+ //
+ POINTL vPoint;
+
+ vPoint.x = vRect2.xLeft;
+ vPoint.y = vRect2.yBottom;
+ if (pParent)
+ {
+ ::WinMapWindowPoints(hWnd, hParentWnd, &vPoint, 1);
+ }
+#endif
+
+ DoMoveWindow(vPoint.x, vPoint.y, nActualWidth, nActualHeight);
+ wxSizeEvent vEvent(wxSize(nWidth, nHeight), m_windowId);
vEvent.SetEventObject(this);
GetEventHandler()->ProcessEvent(vEvent);
} // end of wxWindowOS2::DoSetClientSize
return wxPoint(0, 0);
} // end of wxWindowOS2::GetClientAreaOrigin
-void wxWindowOS2::AdjustForParentClientOrigin(
- int& rX
-, int& rY
-, int nSizeFlags
-)
-{
- //
- // Don't do it for the dialogs/frames - they float independently of their
- // parent
- //
- if (!IsTopLevel())
- {
- wxWindow* pParent = GetParent();
-
- if (!(nSizeFlags & wxSIZE_NO_ADJUSTMENTS) && pParent)
- {
- wxPoint vPoint(pParent->GetClientAreaOrigin());
- rX += vPoint.x;
- rY += vPoint.y;
- }
- }
-} // end of wxWindowOS2::AdjustForParentClientOrigin
-
// ---------------------------------------------------------------------------
// text metrics
// ---------------------------------------------------------------------------
{
HPS hPs;
FONTMETRICS vFontMetrics;
- BOOL bRc;
hPs = ::WinGetPS(GetHwnd());
HPS hPs;
hPs = ::WinGetPS(GetHwnd());
+
+ // Just prevent compiler warnings
+ wxString dummy = rString;
+ pX = pX;
+ pY = pY;
+ pDescent = pDescent;
+ pExternalLeading = pExternalLeading;
/*
// TODO: Will have to play with fonts later
// ---------------------------------------------------------------------------
// popup menu
// ---------------------------------------------------------------------------
-
+//
+#if wxUSE_MENUS_NATIVE
static void wxYieldForCommandsOnly()
{
//
//
QMSG vMsg;
- while (::WinPeekMsg( vHabmain
- ,&vMsg
- ,(HWND)0
- ,WM_COMMAND
- ,WM_COMMAND
- ,PM_REMOVE
- ) && vMsg.msg != WM_QUIT)
+ while (::WinPeekMsg(vHabmain, &vMsg, (HWND)0, WM_COMMAND,
+ WM_COMMAND,PM_REMOVE) && vMsg.msg != WM_QUIT)
{
wxTheApp->DoMessage((WXMSG*)&vMsg);
}
}
+#endif // wxUSE_MENUS_NATIVE
+#if wxUSE_MENUS_NATIVE
bool wxWindowOS2::DoPopupMenu(
wxMenu* pMenu
, int nX
,PU_MOUSEBUTTON2DOWN | PU_MOUSEBUTTON2 | PU_KEYBOARD
);
// we need to do it righ now as otherwise the events are never going to be
- // sent to wxCurrentPopupMenu from HandleCommand()
+ // sent to wxCurrentPopupMenu from ;()
//
// note that even eliminating (ugly) wxCurrentPopupMenu global wouldn't
// help and we'd still need wxYieldForCommandsOnly() as the menu may be
pMenu->SetInvokingWindow(NULL);
return TRUE;
} // end of wxWindowOS2::DoPopupMenu
+#endif // wxUSE_MENUS_NATIVE
// ===========================================================================
// pre/post message processing
)
{
if (m_fnOldWndProc)
- return (MRESULT)m_fnOldWndProc(GetHWND(), (ULONG)uMsg, (MPARAM)wParam, (MPARAM)lParam);
+ return (MRESULT)m_fnOldWndProc(GetHWND(), uMsg, (MPARAM)wParam, (MPARAM)lParam);
else
- return ::WinDefWindowProc(GetHWND(), (ULONG)uMsg, (MPARAM)wParam, (MPARAM)lParam);
+ return ::WinDefWindowProc(GetHWND(), uMsg, (MPARAM)wParam, (MPARAM)lParam);
} // end of wxWindowOS2::OS2DefWindowProc
bool wxWindowOS2::OS2ProcessMessage(
WXMSG* pMsg
)
{
+// wxUniversal implements tab traversal itself
+#ifndef __WXUNIVERSAL__
QMSG* pQMsg = (QMSG*)pMsg;
if (m_hWnd != 0 && (GetWindowStyleFlag() & wxTAB_TRAVERSAL))
}
else
{
- wxPanel* pPanel = wxDynamicCast(this, wxPanel);
- wxButton* pBtn = NULL;
-
- if (pPanel)
- {
- //
- // Panel may have a default button which should
- // be activated by Enter
- //
- pBtn = pPanel->GetDefaultItem();
- }
+ wxButton* pBtn = wxDynamicCast( GetDefaultItem()
+ ,wxButton
+ );
if (pBtn && pBtn->IsEnabled())
{
if (::WinSendMsg(pQMsg->hwnd, WM_QUERYDLGCODE, pQMsg, 0));
return TRUE;
}
+#else
+ pMsg = pMsg; // just shut up the compiler
+#endif // __WXUNIVERSAL__
#if wxUSE_TOOLTIPS
if ( m_tooltip )
WXMSG* pMsg
)
{
-#if wxUSE_ACCEL
+#if wxUSE_ACCEL && !defined(__WXUNIVERSAL__)
return m_acceleratorTable.Translate(m_hWnd, pMsg);
#else
+ pMsg = pMsg;
return FALSE;
#endif //wxUSE_ACCEL
} // end of wxWindowOS2::OS2TranslateMessage
// Hook for new window just as it's being created, when the window isn't yet
// associated with the handle
//
-wxWindow* wxWndHook = NULL;
+wxWindowOS2* wxWndHook = NULL;
//
// Main window proc
wxGetMessageName(ulMsg), wParam, lParam);
#endif // __WXDEBUG__
- wxWindow* pWnd = wxFindWinFromHandle((WXHWND)hWnd);
+ wxWindowOS2* pWnd = wxFindWinFromHandle((WXHWND)hWnd);
//
// When we get the first message for the HWND we just created, we associate
// Did we process the uMsg?
//
bool bProcessed = FALSE;
- bool bAllow;
MRESULT mResult;
- WXHICON hIcon;
- WXHBRUSH hBrush;
//
// For most messages we should return 0 when we do process the message
if (uKeyFlags & KC_KEYUP)
{
- bProcessed = HandleKeyUp((WXDWORD)wParam, lParam);
+ //TODO: check if the cast to WXWORD isn't causing trouble
+ bProcessed = HandleKeyUp((WXWORD)wParam, lParam);
break;
}
else // keydown event
// return 0 now (we've handled it). DON't RETURN
// we still need to process further
//
- HandleKeyDown((WXDWORD)wParam, lParam);
+ HandleKeyDown((WXWORD)wParam, lParam);
if (uKeyFlags & KC_VIRTUALKEY)
{
USHORT uVk = SHORT2FROMMP((MPARAM)lParam);
case VK_DOWN:
case VK_UP:
default:
- bProcessed = HandleChar((WXDWORD)wParam, lParam);
+ bProcessed = HandleChar((WXWORD)wParam, lParam);
}
break;
}
else // WM_CHAR -- Always an ASCII character
{
- bProcessed = HandleChar((WXDWORD)wParam, lParam, TRUE);
+ bProcessed = HandleChar((WXWORD)wParam, lParam, TRUE);
break;
}
}
// Dialog window proc
//
MRESULT wxDlgProc(
- HWND hWnd
+ HWND WXUNUSED(hWnd)
, UINT uMsg
-, MPARAM wParam
-, MPARAM lParam)
+, MPARAM WXUNUSED(wParam)
+, MPARAM WXUNUSED(lParam))
{
if (uMsg == WM_INITDLG)
{
void wxAssociateWinWithHandle(
HWND hWnd
-, wxWindow* pWin
+, wxWindowOS2* pWin
)
{
//
} // end of wxAssociateWinWithHandle
void wxRemoveHandleAssociation(
- wxWindow* pWin
+ wxWindowOS2* pWin
)
{
wxWinHandleList->DeleteObject(pWin);
void wxWindowOS2::OS2DetachWindowMenu()
{
+#ifndef __WXUNIVERSAL__
if (m_hMenu)
{
HMENU hMenu = (HMENU)m_hMenu;
}
}
}
+#endif // __WXUNIVERSAL__
} // end of wxWindowOS2::OS2DetachWindowMenu
bool wxWindowOS2::OS2Create(
, long lWidth
, long lHeight
, WXHWND hOwner
-, WXHWND hZOrder
+, WXHWND WXUNUSED(hZOrder)
, unsigned long ulId
, void* pCtlData
, void* pPresParams
// Find parent's size, if it exists, to set up a possible default
// panel size the size of the parent window
//
- RECTL vParentRect;
- HWND hWndClient;
-
lX1 = lX;
lY1 = lY;
if (lWidth > -1L)
}
}
+ HWND parent;
+ if ( GetWindowStyleFlag() & wxPOPUP_WINDOW )
+ {
+ // popup windows should have desktop as parent because they shouldn't
+ // be limited to the parents client area as child windows usually are
+ parent = HWND_DESKTOP;
+ }
+ else if ( hParent )
+ {
+ parent = hParent;
+ }
+ else
+ {
+ // top level window
+ parent = NULL;
+ }
+
//
// We will either have a registered class via string name or a standard PM Class via a long
//
- m_hWnd = (WXHWND)::WinCreateWindow( (HWND)hParent
- ,zClass
- ,(PSZ)zTitle ? zTitle : wxT("")
- ,(ULONG)dwStyle
- ,(LONG)lX1
- ,(LONG)lY1
- ,(LONG)lWidth
- ,(LONG)lHeight
- ,hOwner
- ,HWND_TOP
- ,(ULONG)nControlId
- ,pCtlData
- ,pPresParams
- );
+ m_hWnd = (WXHWND)::WinCreateWindow(parent, zClass,
+ (PSZ)zTitle ? zTitle : wxT(""),
+ dwStyle, lX1, lY1, lWidth, lHeight,
+ hOwner, HWND_TOP, (ULONG)nControlId,
+ pCtlData, pPresParams);
+
if (!m_hWnd)
{
vError = ::WinGetLastError(vHabmain);
// ---------------------------------------------------------------------------
bool wxWindowOS2::HandleCreate(
- WXLPCREATESTRUCT vCs
+ WXLPCREATESTRUCT WXUNUSED(vCs)
, bool* pbMayCreate
)
{
- wxWindowCreateEvent vEvent(this);
+ wxWindowCreateEvent vEvent((wxWindow*)this);
(void)GetEventHandler()->ProcessEvent(vEvent);
*pbMayCreate = TRUE;
bool wxWindowOS2::HandleDestroy()
{
- wxWindowDestroyEvent vEvent(this);
+ wxWindowDestroyEvent vEvent((wxWindow*)this);
(void)GetEventHandler()->ProcessEvent(vEvent);
wxFocusEvent& rEvent
)
{
- //
- // Panel wants to track the window which was the last to have focus in it,
- // so we want to set ourselves as the window which last had focus
- //
- // Notice that it's also important to do it upwards the tree becaus
- // otherwise when the top level panel gets focus, it won't set it back to
- // us, but to some other sibling
- //
- wxWindow* pWin = this;
-
- while (pWin)
- {
- wxWindow* pParent = pWin->GetParent();
- wxPanel* pPanel = wxDynamicCast( pParent
- ,wxPanel
- );
- if (pPanel)
- {
- pPanel->SetLastFocus(pWin);
- }
- pWin = pParent;
- }
-
- wxLogTrace(_T("focus"), _T("%s (0x%08x) gets focus"),
- GetClassInfo()->GetClassName(), GetHandle());
-
rEvent.Skip();
} // end of wxWindowOS2::OnSetFocus
}
#endif // wxUSE_CARET
- //
- // Panel wants to track the window which was the last to have focus in it
- //
- wxPanel* pPanel = wxDynamicCast( GetParent()
- ,wxPanel
- );
- if (pPanel)
+#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 from EN_FOCUS handler
+ if ( wxDynamicCastThis(wxTextCtrl) )
{
- pPanel->SetLastFocus(this);
+ return FALSE;
}
+#endif // wxUSE_TEXTCTRL
wxFocusEvent vEvent(wxEVT_SET_FOCUS, m_windowId);
bool wxWindowOS2::HandleShow(
bool bShow
-, int nStatus
+, int WXUNUSED(nStatus)
)
{
- wxShowEvent vEvent( GetId()
- ,bShow
- );
+ wxShowEvent vEvent(GetId(), bShow);
vEvent.m_eventObject = this;
return GetEventHandler()->ProcessEvent(vEvent);
return GetEventHandler()->ProcessEvent(vEvent);
} // end of wxWindowOS2::HandleInitDialog
-bool wxWindowOS2::HandleEndDrag(WXWPARAM wParam)
+bool wxWindowOS2::HandleEndDrag(WXWPARAM WXUNUSED(wParam))
{
// TODO: We'll handle drag and drop later
return FALSE;
}
bool wxWindowOS2::HandleSetCursor(
- USHORT vId
+ USHORT WXUNUSED(vId)
, WXHWND hPointer
)
{
, WXDRAWITEMSTRUCT* pItemStruct
)
{
+#if wxUSE_OWNER_DRAWN
wxDC vDc;
-#if wxUSE_OWNER_DRAWN
+#if wxUSE_MENUS_NATIVE
//
// Is it a menu item?
//
// otherwise, we'd have to do it ourselves.
//
}
+#endif // wxUSE_MENUS_NATIVE
wxWindow* pItem = FindItem(vId);
{
return ((wxControl *)pItem)->OS2OnDraw(pItemStruct);
}
+#else
+ vId = vId;
+ pItemStruct = pItemStruct;
#endif
return FALSE;
} // end of wxWindowOS2::OS2OnDrawItem
, WXMEASUREITEMSTRUCT* pItemStruct
)
{
+#if wxUSE_OWNER_DRAWN
//
// Is it a menu item?
//
{
return ((wxControl *)pItem)->OS2OnMeasure(pItemStruct);
}
+#else
+ lId = lId;
+ pItemStruct = pItemStruct;
+#endif // wxUSE_OWNER_DRAWN
return FALSE;
}
} // end of wxWindowOS2::HandleSysColorChange
bool wxWindowOS2::HandleCtlColor(
- WXHBRUSH* phBrush
+ WXHBRUSH* WXUNUSED(phBrush)
)
{
//
} // end of wxWindowOS2::HandleCtlColor
bool wxWindowOS2::HandleWindowParams(
- PWNDPARAMS pWndParams
-, WXLPARAM lParam
+ PWNDPARAMS WXUNUSED(pWndParams)
+, WXLPARAM WXUNUSED(lParam)
)
{
// TODO: I'll do something here, just not sure what yet
}
// Define for each class of dialog and control
-WXHBRUSH wxWindowOS2::OnCtlColor(WXHDC hDC,
- WXHWND hWnd,
- WXUINT nCtlColor,
- WXUINT message,
- WXWPARAM wParam,
- WXLPARAM lParam)
+WXHBRUSH wxWindowOS2::OnCtlColor(WXHDC WXUNUSED(hDC),
+ WXHWND WXUNUSED(hWnd),
+ WXUINT WXUNUSED(nCtlColor),
+ WXUINT WXUNUSED(message),
+ WXWPARAM WXUNUSED(wParam),
+ WXLPARAM WXUNUSED(lParam))
{
return (WXHBRUSH)0;
}
} // end of wxWindowOS2::HandlePaletteChanged
bool wxWindowOS2::HandlePresParamChanged(
- WXWPARAM wParam
+ WXWPARAM WXUNUSED(wParam)
)
{
//
bool wxWindowOS2::HandlePaint()
{
- HRGN hRgn = NULLHANDLE;
- wxPaintEvent vEvent;
+ HRGN hRgn;
+ wxPaintEvent vEvent(m_windowId);
HPS hPS;
RECTL vRect;
+ bool bProcessed;
- if (::WinQueryUpdateRegion(GetHwnd(), hRgn) == RGN_NULL)
+ // Create empty region
+ // TODO: get HPS somewhere else if possible
+ hPS = ::WinGetPS(GetHwnd());
+ hRgn = ::GpiCreateRegion(hPS, 0, NULL);
+
+ if (::WinQueryUpdateRegion(GetHwnd(), hRgn) == RGN_ERROR)
{
wxLogLastError("CreateRectRgn");
return FALSE;
}
- m_updateRegion = wxRegion(hRgn);
+ m_updateRegion = wxRegion(hRgn, hPS);
+
vEvent.SetEventObject(this);
- if (!GetEventHandler()->ProcessEvent(vEvent))
+ bProcessed = GetEventHandler()->ProcessEvent(vEvent);
+
+ if (!bProcessed)
{
HPS hPS;
);
if(hPS)
{
+#if 0
::GpiCreateLogColorTable( hPS
,0L
,LCOLF_CONSECRGB
,(LONG)wxTheColourDatabase->m_nSize
,(PLONG)wxTheColourDatabase->m_palTable
);
+#endif
::GpiCreateLogColorTable( hPS
,0L
,LCOLF_RGB
::WinEndPaint(hPS);
}
}
- return (GetEventHandler()->ProcessEvent(vEvent));
+
+ ::GpiDestroyRegion(hPS, hRgn);
+ ::WinReleasePS(hPS);
+
+ return GetEventHandler()->ProcessEvent(vEvent); //bProcessed;
} // end of wxWindowOS2::HandlePaint
bool wxWindowOS2::HandleEraseBkgnd(
)
{
SWP vSwp;
+ bool rc;
::WinQueryWindowPos(GetHwnd(), &vSwp);
if (vSwp.fl & SWP_MINIMIZE)
wxDC vDC;
vDC.m_hPS = (HPS)hDC; // this is really a PS
- vDC.SetWindow(this);
+ vDC.SetWindow((wxWindow*)this);
vDC.BeginDrawing();
wxEraseEvent vEvent(m_windowId, &vDC);
vEvent.SetEventObject(this);
- bool rc = GetEventHandler()->ProcessEvent(vEvent);
+ rc = GetEventHandler()->ProcessEvent(vEvent);
vDC.EndDrawing();
vDC.m_hPS = NULLHANDLE;
{
RECTL vRect;
HPS hPS = rEvent.m_dc->m_hPS;
+ APIRET rc;
+ LONG lColor = m_backgroundColour.GetPixel();
- ::WinQueryWindowRect(GetHwnd(), &vRect);
- ::WinFillRect(hPS, &vRect, m_backgroundColour.GetPixel());
+ rc = ::WinQueryWindowRect(GetHwnd(), &vRect);
+ rc = ::WinFillRect(hPS, &vRect, lColor);
} // end of wxWindowOS2::OnEraseBackground
// ---------------------------------------------------------------------------
, int nY
)
{
- wxMoveEvent vEvent( wxPoint( nX
- ,nY
- )
- ,m_windowId
- );
+ wxMoveEvent vEvent(wxPoint(nX, nY), m_windowId);
vEvent.SetEventObject(this);
return GetEventHandler()->ProcessEvent(vEvent);
, WXUINT WXUNUSED(nFlag)
)
{
- wxSizeEvent vEvent( wxSize( nWidth
- ,nHeight
- )
- ,m_windowId
- );
+ wxSizeEvent vEvent(wxSize(nWidth, nHeight), m_windowId);
vEvent.SetEventObject(this);
return GetEventHandler()->ProcessEvent(vEvent);
, WXHWND hControl
)
{
+#if wxUSE_MENUS_NATIVE
if (wxCurrentPopupMenu)
{
wxMenu* pPopupMenu = wxCurrentPopupMenu;
wxCurrentPopupMenu = NULL;
return pPopupMenu->OS2Command(wCmd, wId);
}
+#endif // wxUSE_MENUS_NATIVE
wxWindow* pWin = FindItem(wId);
}
if (pWin)
- return pWin->OS2Command( wCmd
- ,wId
- );
+ return pWin->OS2Command(wCmd, wId);
+
return FALSE;
} // end of wxWindowOS2::HandleCommand
bool wxWindowOS2::HandleSysCommand(
WXWPARAM wParam
-, WXLPARAM lParam
+, WXLPARAM WXUNUSED(lParam)
)
{
//
// ---------------------------------------------------------------------------
// mouse events
// ---------------------------------------------------------------------------
-
+//TODO!!! check against MSW
void wxWindowOS2::InitMouseEvent(
wxMouseEvent& rEvent
, int nX
// ===========================================================================
void wxGetCharSize(
- WXHWND hWnd
-, int* pX
-, int* pY
-,wxFont* pTheFont
+ WXHWND WXUNUSED(hWnd)
+, int* WXUNUSED(pX)
+, int* WXUNUSED(pY)
+,wxFont* WXUNUSED(pTheFont)
)
{
// TODO: we'll do this later
#endif // __WXDEBUG__
+// Unused?
+#if 0
static void TranslateKbdEventToMouse(
wxWindow* pWin
, int* pX
pWin->ScreenToClient(pX, pY);
} // end of TranslateKbdEventToMouse
+#endif
// Find the wxWindow at the current mouse position, returning the mouse
// position.
wxWindow* wxFindWindowAtPointer(
- wxPoint& rPt
+ wxPoint& WXUNUSED(rPt)
)
{
return wxFindWindowAtPoint(wxGetMousePosition());