// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
+#if wxUSE_RADIOBOX
+
+#include "wx/radiobox.h"
+
#ifndef WX_PRECOMP
#include <stdio.h>
#include "wx/wxchar.h"
#include "wx/string.h"
#include "wx/bitmap.h"
#include "wx/brush.h"
- #include "wx/radiobox.h"
#endif
#include "wx/os2/private.h"
wxRemoveHandleAssociation(this);
if (m_ahRadioButtons)
{
- for (int i = 0; i < m_nNoItems; i++)
+ for (unsigned int i = 0; i < m_nNoItems; i++)
{
wxWindow* pWin = wxFindWinFromHandle((WXHWND)m_ahRadioButtons[i]);
wxRemoveHandleAssociation(pWin);
delete[] m_pnRadioHeight;
} // end of wxRadioBox::~wxRadioBox
-void wxRadioBox::Command (
- wxCommandEvent& rEvent
-)
+void wxRadioBox::Command ( wxCommandEvent& rEvent )
{
SetSelection (rEvent.GetInt());
ProcessCommand(rEvent);
} // end of wxRadioBox::Command
-bool wxRadioBox::ContainsHWND(
- WXHWND hWnd
-) const
+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++)
{
return false;
} // end of wxRadioBox::ContainsHWND
-bool wxRadioBox::Create(
- wxWindow* pParent
-, wxWindowID vId
-, const wxString& rsTitle
-, const wxPoint& rPos
-, const wxSize& rSize
-, const wxArrayString& asChoices
-, int nMajorDim
-, long lStyle
-, const wxValidator& rVal
-, const wxString& rsName
-)
+bool wxRadioBox::Create( wxWindow* pParent,
+ wxWindowID vId,
+ const wxString& rsTitle,
+ const wxPoint& rPos,
+ const wxSize& rSize,
+ const wxArrayString& asChoices,
+ int nMajorDim,
+ long lStyle,
+ const wxValidator& rVal,
+ const wxString& rsName )
{
wxCArrayString chs(asChoices);
chs.GetStrings(), nMajorDim, lStyle, rVal, rsName);
}
-bool wxRadioBox::Create(
- wxWindow* pParent
-, wxWindowID vId
-, const wxString& rsTitle
-, const wxPoint& rPos
-, const wxSize& rSize
-, int nNum
-, const wxString asChoices[]
-, int nMajorDim
-, long lStyle
-, const wxValidator& rVal
-, const wxString& rsName
-)
-{
- wxColour vColour;
- LONG lColor;
- HWND hWndParent = GetHwndOf(pParent);
+bool wxRadioBox::Create( wxWindow* pParent,
+ wxWindowID vId,
+ const wxString& rsTitle,
+ const wxPoint& rPos,
+ const wxSize& rSize,
+ int nNum,
+ const wxString asChoices[],
+ int nMajorDim,
+ long lStyle,
+ const wxValidator& rVal,
+ const wxString& rsName )
+{
+ 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 = nNum;
+ m_nNoItems = (unsigned int)nNum;
SetMajorDim(nMajorDim == 0 ? nNum : nMajorDim, lStyle);
m_ahRadioButtons = new WXHWND[nNum];
nStartX = nXOffset;
nStartY = nYOffset;
- for (int 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
// radiobox may be wider than the sum of the button widths (as it
// happens, for example, when the radiobox label is very long)
//
- bool bIsLastInTheRow;
+ bool bIsLastInTheRow;
if (m_windowStyle & wxRA_SPECIFY_COLS)
{
//
int n = i + 1;
- bIsLastInTheRow = ((n % GetMajorDim()) == 0) || (n == m_nNoItems);
+ bIsLastInTheRow = ((n % GetMajorDim()) == 0) || (n == (int)m_nNoItems);
}
else // winRA_SPECIFY_ROWS
{
}
} // 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()") );
return true;
} // end of wxRadioBox::Enable
-bool wxRadioBox::Enable(
- bool bEnable
-)
+bool wxRadioBox::Enable(bool bEnable)
{
if ( !wxControl::Enable(bEnable) )
return false;
- for (int 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
-int wxRadioBox::GetCount() const
+unsigned int wxRadioBox::GetCount() const
{
return m_nNoItems;
} // end of wxRadioBox::GetCount
wxSize wxRadioBox::GetMaxButtonSize() const
{
- int nWidthMax = 0;
- int nHeightMax = 0;
+ int nWidthMax = 0;
+ int nHeightMax = 0;
- for (int i = 0 ; i < m_nNoItems; i++)
+ for (unsigned int i = 0 ; i < m_nNoItems; i++)
{
- int nWidth;
- int nHeight;
+ int nWidth;
+ int nHeight;
if (m_pnRadioWidth[i] < 0L)
{
void wxRadioBox::GetSize( int* pnWidth, int* pnHeight ) const
{
- RECT vRect;
+ RECT vRect;
vRect.xLeft = -1;
vRect.xRight = -1;
vRect.yBottom = -1;
if (m_hWnd)
- wxFindMaxSize( m_hWnd
- ,&vRect
- );
+ wxFindMaxSize( m_hWnd, &vRect );
- for (int i = 0; i < m_nNoItems; i++)
- wxFindMaxSize( m_ahRadioButtons[i]
- ,&vRect
- );
+ for (unsigned int i = 0; i < m_nNoItems; i++)
+ wxFindMaxSize( m_ahRadioButtons[i], &vRect );
if (pnWidth)
*pnWidth = vRect.xRight - vRect.xLeft;
} // 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 (int 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) );
}
} // end of wxRadioBox::SetFocus
-bool wxRadioBox::SetFont(
- const wxFont& rFont
-)
+bool wxRadioBox::SetFont(const wxFont& rFont)
{
if (!wxControl::SetFont(rFont))
{
//
// Also set the font of our radio buttons
//
- for (int n = 0; n < (int)m_nNoItems; n++)
+ for (unsigned int n = 0; n < m_nNoItems; n++)
{
- HWND hWndBtn = (HWND)m_ahRadioButtons[n];
+ HWND hWndBtn = (HWND)m_ahRadioButtons[n];
- wxOS2SetFont( hWndBtn
- ,rFont
- );
+ wxOS2SetFont( hWndBtn, rFont );
::WinInvalidateRect(hWndBtn, NULL, FALSE);
}
return true;
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") );
return false;
} // end of wxRadioBox::SetStringSelection
-bool wxRadioBox::Show(
- bool bShow
-)
+bool wxRadioBox::Show(bool bShow)
{
if (!wxControl::Show(bShow))
return false;
- for (int 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()") );
(MPARAM)lParam )
);
} // end of wxRadioBoxWndProc
+
+#endif // wxUSE_RADIOBOX