wxFLAGS_MEMBER(wxBORDER_RAISED)
wxFLAGS_MEMBER(wxBORDER_STATIC)
wxFLAGS_MEMBER(wxBORDER_NONE)
-
+
// old style border flags
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
#endif
/*
- selection
- content
- label
- dimension
- item
+ selection
+ content
+ label
+ dimension
+ item
*/
// there are two possible ways to create the radio buttons: either as children
if ( cmd == BN_CLICKED )
{
if (id == GetId())
- return TRUE;
+ return true;
- int selectedButton = -1;
+ int selectedButton = wxID_ANY;
for ( int i = 0; i < m_noItems; i++ )
{
}
}
- if ( selectedButton == -1 )
+ if ( selectedButton == wxID_ANY )
{
// just ignore it - due to a hack with WM_NCHITTEST handling in our
// wnd proc, we can receive dummy click messages when we click near
// the radiobox edge (this is ugly but Julian wouldn't let me get
// rid of this...)
- return FALSE;
+ return false;
}
if ( selectedButton != m_selectedButton )
}
//else: don't generate events when the selection doesn't change
- return TRUE;
+ return true;
}
else
- return FALSE;
+ return false;
}
// Radio box item
wxRadioBox::wxRadioBox()
{
- m_selectedButton = -1;
+ m_selectedButton = wxID_ANY;
m_noItems = 0;
m_noRowsOrCols = 0;
m_radioButtons = NULL;
const wxString& name)
{
// initialize members
- m_selectedButton = -1;
+ m_selectedButton = wxID_ANY;
m_noItems = 0;
m_majorDim = majorDim == 0 ? n : majorDim;
// common initialization
if ( !CreateControl(parent, id, pos, size, style, val, name) )
- return FALSE;
+ return false;
// create the static box
if ( !MSWCreateControl(wxT("BUTTON"), BS_GROUPBOX | WS_GROUP,
pos, size, title, 0) )
- return FALSE;
+ return false;
// and now create the buttons
m_noItems = n;
m_radioHeight = new int[n];
WXHFONT hfont = 0;
- wxFont& font = GetFont();
+ wxFont font = GetFont();
if ( font.Ok() )
{
hfont = font.GetResourceHandle();
for ( int i = 0; i < n; i++ )
{
m_radioWidth[i] =
- m_radioHeight[i] = -1;
+ m_radioHeight[i] = wxDefaultCoord;
long styleBtn = BS_AUTORADIOBUTTON | WS_TABSTOP | WS_CHILD | WS_VISIBLE;
if ( i == 0 && style == 0 )
styleBtn |= WS_GROUP;
{
wxLogLastError(wxT("CreateWindow(radio btn)"));
- return FALSE;
+ return false;
}
m_radioButtons[i] = (WXHWND)hwndBtn;
0, 0, 0, 0, hwndParent,
(HMENU)NewControlId(), wxGetInstance(), NULL);
+#ifdef __WXWINCE__
+ // Set the z-order correctly
+ SetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+#endif
+
SetSelection(0);
SetSize(pos.x, pos.y, size.x, size.y);
// Now that we have items determine what is the best size and set it.
SetBestSize(size);
-
- return TRUE;
+
+ return true;
}
bool wxRadioBox::Create(wxWindow *parent,
wxRadioBox::~wxRadioBox()
{
- m_isBeingDeleted = TRUE;
+ m_isBeingDeleted = true;
if (m_radioButtons)
{
{
wxCHECK_RET( item >= 0 && item < m_noItems, wxT("invalid radiobox index") );
- m_radioWidth[item] = m_radioHeight[item] = -1;
+ m_radioWidth[item] = m_radioHeight[item] = wxDefaultCoord;
SetWindowText((HWND)m_radioButtons[item], label.c_str());
}
{
// the radiobox should be big enough for its buttons
int cx1, cy1;
- wxGetCharSize(m_hWnd, &cx1, &cy1, &GetFont());
+ wxGetCharSize(m_hWnd, &cx1, &cy1, GetFont());
int extraHeight = cy1;
extraHeight /= 2;
#endif
*/
-
+
int height = GetNumVer() * sizeBtn.y + cy1/2 + extraHeight;
int width = GetNumHor() * (sizeBtn.x + cx1) + cx1;
int xx = x;
int yy = y;
- if (x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+ if (x == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
xx = currentX;
- if (y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+ if (y == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
yy = currentY;
#if RADIOBTN_PARENT_IS_RADIOBOX
#endif
int cx1, cy1;
- wxGetCharSize(m_hWnd, &cx1, &cy1, & GetFont());
+ wxGetCharSize(m_hWnd, &cx1, &cy1, GetFont());
// Attempt to have a look coherent with other platforms: We compute the
// biggest toggle dim, then we align all items according this value.
totHeight = totSize.y;
// only change our width/height if asked for
- if ( width == -1 )
+ if ( width == wxDefaultCoord )
{
if ( sizeFlags & wxSIZE_AUTO_WIDTH )
width = totWidth;
width = widthOld;
}
- if ( height == -1 )
+ if ( height == wxDefaultCoord )
{
if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
height = totHeight;
void wxRadioBox::GetSize(int *width, int *height) const
{
- RECT rect;
- rect.left = -1; rect.right = -1; rect.top = -1; rect.bottom = -1;
+ RECT rect = { -1, -1, -1, -1 };
if (m_hWnd)
wxFindMaxSize(m_hWnd, &rect);
{
if (m_noItems > 0)
{
- ::SetFocus((HWND)m_radioButtons[m_selectedButton == -1
+ ::SetFocus((HWND)m_radioButtons[m_selectedButton == wxID_ANY
? 0
: m_selectedButton]);
}
bool wxRadioBox::Show(bool show)
{
if ( !wxControl::Show(show) )
- return FALSE;
+ return false;
int nCmdShow = show ? SW_SHOW : SW_HIDE;
for ( int i = 0; i < m_noItems; i++ )
::ShowWindow((HWND)m_radioButtons[i], nCmdShow);
}
- return TRUE;
+ return true;
}
// Enable a specific button
bool wxRadioBox::Enable(bool enable)
{
if ( !wxControl::Enable(enable) )
- return FALSE;
+ return false;
for (int i = 0; i < m_noItems; i++)
::EnableWindow((HWND) m_radioButtons[i], enable);
- return TRUE;
+ return true;
}
// Show a specific button
for ( size_t i = 0; i < count; i++ )
{
if ( GetRadioButtons()[i] == hWnd )
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void wxRadioBox::Command(wxCommandEvent & event)
if ( !wxControl::SetFont(font) )
{
// nothing to do
- return FALSE;
+ return false;
}
// also set the font of our radio buttons
::InvalidateRect(hwndBtn, NULL, FALSE /* don't erase bg */);
}
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") );
- bool processed = TRUE;
+ bool processed = true;
wxDirection dir;
switch ( wParam )
break;
default:
- processed = FALSE;
+ processed = false;
// just to suppress the compiler warning
dir = wxALL;
wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") );
- bool processed = TRUE;
+ bool processed wxDUMMY_INITIALIZE(true);
// HELPINFO doesn't seem to be supported on WinCE.
#ifndef __WXWINCE__
#endif
{
wxWindow* subjectOfHelp = radiobox;
- bool eventProcessed = FALSE;
+ bool eventProcessed = false;
while (subjectOfHelp && !eventProcessed)
{
wxHelpEvent helpEvent(wxEVT_HELP, subjectOfHelp->GetId(),
processed = radiobox->GetEventHandler()->ProcessEvent(helpEvent);
}
else
- processed = FALSE;
+ processed = false;
#endif
if (processed)
return 0;