+ case WM_CONTROL:
+ switch(SHORT2FROMMP(wParam))
+ {
+ case BN_PAINT:
+ {
+ HWND hWnd = ::WinWindowFromID((HWND)GetHwnd(), SHORT1FROMMP(wParam));
+ wxWindowOS2* pWin = wxFindWinFromHandle(hWnd);
+
+ if (!pWin)
+ {
+ bProcessed = false;
+ break;
+ }
+ if (pWin->IsKindOf(CLASSINFO(wxBitmapButton)))
+ {
+ wxBitmapButton* pBitmapButton = wxDynamicCast(pWin, wxBitmapButton);
+
+ pBitmapButton->OS2OnDraw((WXDRAWITEMSTRUCT *)lParam);
+ }
+ return 0;
+ }
+ // break;
+
+ case BKN_PAGESELECTEDPENDING:
+ {
+ PPAGESELECTNOTIFY pPage = (PPAGESELECTNOTIFY)lParam;
+
+ if ((pPage->ulPageIdNew != pPage->ulPageIdCur) &&
+ (pPage->ulPageIdNew > 0L && pPage->ulPageIdCur > 0L))
+ {
+ wxWindowOS2* pWin = wxFindWinFromHandle(pPage->hwndBook);
+ wxBookCtrlEvent vEvent( wxEVT_NOTEBOOK_PAGE_CHANGED
+ ,(int)SHORT1FROMMP(wParam)
+ ,(int)pPage->ulPageIdNew
+ ,(int)pPage->ulPageIdCur
+ );
+ if (!pWin)
+ {
+ bProcessed = false;
+ break;
+ }
+ if (pWin->IsKindOf(CLASSINFO(wxNotebook)))
+ {
+ wxNotebook* pNotebook = wxDynamicCast(pWin, wxNotebook);
+
+ vEvent.SetEventObject(pWin);
+ pNotebook->OnSelChange(vEvent);
+ bProcessed = true;
+ }
+ else
+ bProcessed = false;
+ }
+ else
+ bProcessed = false;
+ }
+ break;
+
+ case CBN_LBSELECT:
+ case BN_CLICKED: // Dups as LN_SELECT and CBN_LBSELECT
+ {
+ HWND hWnd = ::WinWindowFromID((HWND)GetHwnd(), SHORT1FROMMP(wParam));
+ wxWindowOS2* pWin = wxFindWinFromHandle(hWnd);
+
+ if (!pWin)
+ {
+ bProcessed = false;
+ break;
+ }
+ //
+ // Simulate a WM_COMMAND here, as wxWidgets expects all control
+ // button clicks to generate WM_COMMAND msgs, not WM_CONTROL
+ //
+ if (pWin->IsKindOf(CLASSINFO(wxRadioBox)))
+ {
+ wxRadioBox* pRadioBox = wxDynamicCast(pWin, wxRadioBox);
+
+ pRadioBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
+ ,(WXWORD)SHORT1FROMMP(wParam)
+ );
+ }
+ if (pWin->IsKindOf(CLASSINFO(wxRadioButton)))
+ {
+ wxRadioButton* pRadioButton = wxDynamicCast(pWin, wxRadioButton);
+
+ pRadioButton->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
+ ,(WXWORD)SHORT1FROMMP(wParam)
+ );
+ }
+ if (pWin->IsKindOf(CLASSINFO(wxCheckBox)))
+ {
+ wxCheckBox* pCheckBox = wxDynamicCast(pWin, wxCheckBox);
+
+ pCheckBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
+ ,(WXWORD)SHORT1FROMMP(wParam)
+ );
+ }
+ if (pWin->IsKindOf(CLASSINFO(wxListBox)))
+ {
+ wxListBox* pListBox = wxDynamicCast(pWin, wxListBox);
+
+ pListBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
+ ,(WXWORD)SHORT1FROMMP(wParam)
+ );
+ if (pListBox->GetWindowStyle() & wxLB_OWNERDRAW)
+ Refresh();
+ }
+ if (pWin->IsKindOf(CLASSINFO(wxComboBox)))
+ {
+ wxComboBox* pComboBox = wxDynamicCast(pWin, wxComboBox);
+
+ pComboBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
+ ,(WXWORD)SHORT1FROMMP(wParam)
+ );
+ }
+ if (pWin->IsKindOf(CLASSINFO(wxChoice)))
+ {
+ wxChoice* pChoice = wxDynamicCast(pWin, wxChoice);
+
+ pChoice->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
+ ,(WXWORD)SHORT1FROMMP(wParam)
+ );
+ }
+ return 0;
+ }
+ // break;
+
+ case LN_ENTER:
+ {
+ HWND hWnd = HWNDFROMMP(lParam);
+ wxWindowOS2* pWin = wxFindWinFromHandle(hWnd);
+
+ if (!pWin)
+ {
+ bProcessed = false;
+ break;
+ }
+ //
+ // Simulate a WM_COMMAND here, as wxWidgets expects all control
+ // button clicks to generate WM_COMMAND msgs, not WM_CONTROL
+ //
+ if (pWin->IsKindOf(CLASSINFO(wxListBox)))
+ {
+ wxListBox* pListBox = wxDynamicCast(pWin, wxListBox);
+
+ pListBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
+ ,(WXWORD)SHORT1FROMMP(wParam)
+ );
+ if (pListBox->GetWindowStyle() & wxLB_OWNERDRAW)
+ Refresh();
+
+ }
+ if (pWin->IsKindOf(CLASSINFO(wxComboBox)))
+ {
+ wxComboBox* pComboBox = wxDynamicCast(pWin, wxComboBox);
+
+ pComboBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
+ ,(WXWORD)SHORT1FROMMP(wParam)
+ );
+ }
+ return 0;
+ }
+ // break;
+
+ case SPBN_UPARROW:
+ case SPBN_DOWNARROW:
+ case SPBN_CHANGE:
+ {
+ char zVal[10];
+ long lVal;
+
+ ::WinSendMsg( HWNDFROMMP(lParam)
+ ,SPBM_QUERYVALUE
+ ,&zVal[0]
+ ,MPFROM2SHORT( (USHORT)10
+ ,(USHORT)SPBQ_UPDATEIFVALID
+ )
+ );
+ lVal = atol(zVal);
+ bProcessed = OS2OnScroll( wxVERTICAL
+ ,(WXWORD)SHORT2FROMMP(wParam)
+ ,(WXWORD)lVal
+ ,HWNDFROMMP(lParam)
+ );
+ }
+ break;
+
+ case SLN_SLIDERTRACK:
+ {
+ HWND hWnd = ::WinWindowFromID(GetHWND(), SHORT1FROMMP(wParam));
+ wxWindowOS2* pChild = wxFindWinFromHandle(hWnd);
+
+ if (!pChild)
+ {
+ bProcessed = false;
+ break;
+ }
+ if (pChild->IsKindOf(CLASSINFO(wxSlider)))
+ bProcessed = OS2OnScroll( wxVERTICAL
+ ,(WXWORD)SHORT2FROMMP(wParam)
+ ,(WXWORD)LONGFROMMP(lParam)
+ ,hWnd
+ );
+ }
+ break;
+ }
+ break;
+