X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3c299c3ab663257429983c24e6fb71450f3cf9f1..db70a2f20ac7b47299fe7ab66bae9ef613a0fe6b:/src/os2/radiobox.cpp diff --git a/src/os2/radiobox.cpp b/src/os2/radiobox.cpp index 47a6fbdd9c..8a11e966c4 100644 --- a/src/os2/radiobox.cpp +++ b/src/os2/radiobox.cpp @@ -86,7 +86,7 @@ void wxRadioBox::AdjustButtons( , int nY , int nWidth , int nHeight -, long lSizeFlags +, int nSizeFlags ) { wxSize vMaxSize; @@ -264,14 +264,19 @@ bool wxRadioBox::Create( // System fonts are too big in OS/2 and they are blue // We want smaller fonts and black by default. // - wxFont& rFont = *wxSMALL_FONT; + wxFont* pTextFont = new wxFont( 10 + ,wxMODERN + ,wxNORMAL + ,wxNORMAL + ); wxColour vColour; LONG lColor; vColour.Set(wxString("BLACK")); lColor = (LONG)vColour.GetPixel(); + m_backgroundColour = pParent->GetBackgroundColour(); m_nSelectedButton = -1; - m_nNoItems = nNum; + m_nNoItems = 0; m_nMajorDim = nMajorDim == 0 ? nNum : nMajorDim; m_nNoRowsOrCols = nMajorDim; @@ -279,26 +284,28 @@ bool wxRadioBox::Create( // // Common initialization // - if (!OS2CreateControl( pParent - ,vId - ,rPos - ,rSize - ,lStyle + if (!CreateControl( pParent + ,vId + ,rPos + ,rSize + ,lStyle #if wxUSE_VALIDATORS - ,rVal + ,rVal #endif - ,rsName - )) - - - - + ,rsName + )) + return FALSE; if (!OS2CreateControl( "STATIC" - ,SS_GROUPBOX | WS_GROUP +#if RADIOBTN_PARENT_IS_RADIOBOX + ,SS_GROUPBOX | WS_GROUP | WS_CLIPCHILDREN +#else + ,SS_GROUPBOX | WS_GROUP | WS_CLIPSIBLINGS +#endif ,rPos ,rSize ,rsTitle )) + return FALSE; #if RADIOBTN_PARENT_IS_RADIOBOX HWND hWndParent = GetHwnd(); @@ -310,14 +317,15 @@ bool wxRadioBox::Create( // // Some radio boxes test consecutive id. // + m_nNoItems = nNum; (void)NewControlId(); m_ahRadioButtons = new WXHWND[nNum]; m_pnRadioWidth = new int[nNum]; m_pnRadioHeight = new int[nNum]; - if (rFont.Ok()) + if (pTextFont->Ok()) { - hFont = rFont.GetResourceHandle(); + hFont = pTextFont->GetResourceHandle(); } for (int i = 0; i < nNum; i++) @@ -341,11 +349,19 @@ bool wxRadioBox::Create( ,NULL ,NULL ); + lColor = (LONG)vColour.GetPixel(); ::WinSetPresParam( hWndBtn ,PP_FOREGROUNDCOLOR ,sizeof(LONG) ,(PVOID)&lColor ); + lColor = (LONG)m_backgroundColour.GetPixel(); + + ::WinSetPresParam( hWndBtn + ,PP_BACKGROUNDCOLOR + ,sizeof(LONG) + ,(PVOID)&lColor + ); if (!hWndBtn) { return FALSE; @@ -353,7 +369,7 @@ bool wxRadioBox::Create( m_ahRadioButtons[i] = (WXHWND)hWndBtn; SubclassRadioButton((WXHWND)hWndBtn); wxOS2SetFont( hWndBtn - ,rFont + ,*pTextFont ); ::WinSetWindowULong(hWndBtn, QWL_USER, (ULONG)this); m_aSubControls.Add(nNewId); @@ -373,18 +389,29 @@ bool wxRadioBox::Create( ,NULL ,NULL ); - SetFont(*wxSMALL_FONT); + SetFont(*pTextFont); + lColor = (LONG)vColour.GetPixel(); ::WinSetPresParam( m_hWnd ,PP_FOREGROUNDCOLOR ,sizeof(LONG) ,(PVOID)&lColor ); + lColor = (LONG)m_backgroundColour.GetPixel(); + + ::WinSetPresParam( m_hWnd + ,PP_BACKGROUNDCOLOR + ,sizeof(LONG) + ,(PVOID)&lColor + ); + SetXComp(0); + SetYComp(0); SetSelection(0); SetSize( rPos.x ,rPos.y ,rSize.x ,rSize.y ); + delete pTextFont; return TRUE; } // end of wxRadioBox::Create @@ -437,7 +464,10 @@ void wxRadioBox::DoSetSize( nXx = nCurrentX; if (nY == -1 && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE)) nYy = nCurrentY; - + if (nYy < 0) + nYy = 0; + if (nXx < 0) + nXx = 0; wxGetCharSize( m_hWnd ,&nCx1 @@ -480,7 +510,9 @@ void wxRadioBox::DoSetSize( if (pParent) { - nYy = pParent->GetClientSize().y - (nYy + nHeight); + int nOS2Height = GetOS2ParentHeight(pParent); + + nYy = nOS2Height - (nYy + nHeight); nYOffset = nYy + nHeight; } else @@ -600,6 +632,7 @@ void wxRadioBox::DoSetSize( ,(LONG)nMaxHeight ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW ); + GetParent()->Refresh(); // // Where do we put the next button? //