#if wxUSE_RADIOBOX
+#include "wx/radiobox.h"
+
#ifndef WX_PRECOMP
#include <stdio.h>
- #include "wx/wxchar.h"
+ #include "wx/crt.h"
#include "wx/string.h"
#include "wx/bitmap.h"
#include "wx/brush.h"
- #include "wx/radiobox.h"
#endif
#include "wx/os2/private.h"
wxRadioBox::~wxRadioBox()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
if (m_hWnd)
wxRemoveHandleAssociation(this);
if (m_ahRadioButtons)
{
- for (size_t i = 0; i < m_nNoItems; i++)
+ for (unsigned int i = 0; i < m_nNoItems; i++)
{
wxWindow* pWin = wxFindWinFromHandle((WXHWND)m_ahRadioButtons[i]);
wxRemoveHandleAssociation(pWin);
bool wxRadioBox::ContainsHWND( WXHWND hWnd ) const
{
- size_t nCount = GetCount();
- size_t i;
+ unsigned int nCount = GetCount();
+ unsigned int i;
for (i = 0; i < nCount; i++)
{
const wxValidator& rVal,
const wxString& rsName )
{
- wxColour vColour;
+ wxColour vColour(*wxBLACK);
LONG lColor;
HWND hWndParent = GetHwndOf(pParent);
- vColour.Set(wxString(wxT("BLACK")));
m_backgroundColour = pParent->GetBackgroundColour();
m_nSelectedButton = -1;
m_nNoItems = 0;
//
// Now we can set m_nNoItems and let SetMajorDim set m_numCols/m_numRows
//
- m_nNoItems = (size_t)nNum;
+ m_nNoItems = (unsigned int)nNum;
SetMajorDim(nMajorDim == 0 ? nNum : nMajorDim, lStyle);
m_ahRadioButtons = new WXHWND[nNum];
nStartX = nXOffset;
nStartY = nYOffset;
- for (size_t i = 0; i < m_nNoItems; i++)
+ for (unsigned int i = 0; i < m_nNoItems; i++)
{
//
// The last button in the row may be wider than the other ones as the
}
} // end of wxRadioBox::DoSetSize
-bool wxRadioBox::Enable(int nItem, bool bEnable)
+bool wxRadioBox::Enable(unsigned int nItem, bool bEnable)
{
wxCHECK_MSG( IsValid(nItem), false,
wxT("invalid item in wxRadioBox::Enable()") );
{
if ( !wxControl::Enable(bEnable) )
return false;
- for (size_t i = 0; i < m_nNoItems; i++)
+ for (unsigned int i = 0; i < m_nNoItems; i++)
::WinEnableWindow((HWND)m_ahRadioButtons[i], bEnable);
return true;
} // end of wxRadioBox::Enable
-size_t wxRadioBox::GetCount() const
+unsigned int wxRadioBox::GetCount() const
{
return m_nNoItems;
} // end of wxRadioBox::GetCount
int nWidthMax = 0;
int nHeightMax = 0;
- for (size_t i = 0 ; i < m_nNoItems; i++)
+ for (unsigned int i = 0 ; i < m_nNoItems; i++)
{
int nWidth;
int nHeight;
if (m_hWnd)
wxFindMaxSize( m_hWnd, &vRect );
- for (size_t i = 0; i < m_nNoItems; i++)
+ for (unsigned int i = 0; i < m_nNoItems; i++)
wxFindMaxSize( m_ahRadioButtons[i], &vRect );
if (pnWidth)
} // end of wxRadioBox::GetSize
// Find string for position
-wxString wxRadioBox::GetString( int nNum ) const
+wxString wxRadioBox::GetString(unsigned int nNum) const
{
wxCHECK_MSG( IsValid(nNum), wxEmptyString, wxT("invalid radiobox index") );
return wxGetWindowText(m_ahRadioButtons[nNum]);
// For single selection items only
wxString wxRadioBox::GetStringSelection() const
{
- wxString sResult;
- int nSel = GetSelection();
+ wxString sResult;
+ int nSel = GetSelection();
- if (nSel > -1)
+ if (nSel != wxNOT_FOUND)
sResult = GetString(nSel);
+
return sResult;
} // end of wxRadioBox::GetStringSelection
if (wId == GetId())
return true;
- for (size_t i = 0; i < m_nNoItems; i++)
+ for (unsigned int i = 0; i < m_nNoItems; i++)
{
if (wId == wxGetWindowId(m_ahRadioButtons[i]))
{
void wxRadioBox::SendNotificationEvent()
{
- wxCommandEvent vEvent( wxEVT_COMMAND_RADIOBOX_SELECTED
- ,m_windowId
- );
+ wxCommandEvent vEvent(
+ wxEVT_COMMAND_RADIOBOX_SELECTED,
+ m_windowId
+ );
vEvent.SetInt( m_nSelectedButton );
vEvent.SetString( GetString(m_nSelectedButton) );
//
// Also set the font of our radio buttons
//
- for (size_t n = 0; n < m_nNoItems; n++)
+ for (unsigned int n = 0; n < m_nNoItems; n++)
{
HWND hWndBtn = (HWND)m_ahRadioButtons[n];
m_nSelectedButton = nNum;
} // end of wxRadioBox::SetSelection
-void wxRadioBox::SetString(
- int nItem
-, const wxString& rsLabel
-)
+void wxRadioBox::SetString(unsigned int nItem, const wxString& rsLabel)
{
wxCHECK_RET( IsValid(nItem), wxT("invalid radiobox index") );
m_pnRadioWidth[nItem] = m_pnRadioHeight[nItem] = -1;
- ::WinSetWindowText((HWND)m_ahRadioButtons[nItem], (PSZ)rsLabel.c_str());
+ ::WinSetWindowText((HWND)m_ahRadioButtons[nItem], rsLabel.c_str());
} // end of wxRadioBox::SetString
bool wxRadioBox::SetStringSelection(const wxString& rsStr)
if (!wxControl::Show(bShow))
return false;
- for (size_t i = 0; i < m_nNoItems; i++)
+ for (unsigned int i = 0; i < m_nNoItems; i++)
{
::WinShowWindow((HWND)m_ahRadioButtons[i], (BOOL)bShow);
}
} // end of wxRadioBox::Show
// Show a specific button
-bool wxRadioBox::Show(
- int nItem
-, bool bShow
-)
+bool wxRadioBox::Show(unsigned int nItem, bool bShow)
{
wxCHECK_MSG( IsValid(nItem), false,
wxT("invalid item in wxRadioBox::Show()") );