#ifndef WX_PRECOMP
#include <stdio.h>
#include "wx/setup.h"
+ #include "wx/wxchar.h"
+ #include "wx/string.h"
#include "wx/bitmap.h"
#include "wx/brush.h"
#include "wx/radiobox.h"
#include "wx/os2/private.h"
-#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
-#endif
// ---------------------------------------------------------------------------
// private functions
// ---------------------------------------------------------------------------
// wnd proc for radio buttons
-MRESULT _EXPORT wxRadioBtnWndProc(HWND hWnd,
- UINT message,
- MPARAM wParam,
- MPARAM lParam);
+MRESULT wxRadioBtnWndProc(HWND hWnd,
+ UINT message,
+ MPARAM wParam,
+ MPARAM lParam);
// ---------------------------------------------------------------------------
// global vars
// wxRadioBox
// ---------------------------------------------------------------------------
+int wxRadioBox::GetCount() const
+{
+ return m_noItems;
+}
+
+int wxRadioBox::GetColumnCount() const
+{
+ return GetNumHor();
+}
+
+int wxRadioBox::GetRowCount() const
+{
+ return GetNumVer();
+}
+
int wxRadioBox::GetNumVer() const
{
if ( m_windowStyle & wxRA_SPECIFY_ROWS )
const wxPoint& pos, const wxSize& size,
int n, const wxString choices[],
int majorDim, long style,
+#if wxUSE_VALIDATORS
const wxValidator& val, const wxString& name)
+#endif
{
m_selectedButton = -1;
m_noItems = n;
SetName(name);
+#if wxUSE_VALIDATORS
SetValidator(val);
-
+#endif
parent->AddChild(this);
m_backgroundColour = parent->GetBackgroundColour();
m_foregroundColour = parent->GetForegroundColour();
m_majorDim = majorDim;
m_noRowsOrCols = majorDim;
- long msStyle = GROUP_FLAGS;
+ long msStyle = 0; // TODO: GROUP_FLAGS;
bool want3D;
WXDWORD exStyle = Determine3DEffects(0, &want3D);
}
// Create a dummy radio control to end the group.
- (void)CreateWindowEx(0, RADIO_CLASS, wxT(""), WS_GROUP | RADIO_FLAGS,
- 0, 0, 0, 0, hwndParent,
- (HMENU)NewControlId(), wxGetInstance(), NULL);
+// (void)CreateWindowEx(0, RADIO_CLASS, wxT(""), WS_GROUP | RADIO_FLAGS,
+// 0, 0, 0, 0, hwndParent,
+// (HMENU)NewControlId(), wxGetInstance(), NULL);
SetSelection(0);
}
+void wxRadioBox::SetString(int item, const wxString& label)
+{
+ wxCHECK_RET( item >= 0 && item < m_noItems, wxT("invalid radiobox index") );
+
+ m_radioWidth[item] = m_radioHeight[item] = -1;
+ ::WinSetWindowText((HWND)m_radioButtons[item], label.c_str());
+}
+
wxString wxRadioBox::GetLabel(int item) const
{
wxCHECK_MSG( item >= 0 && item < m_noItems, wxT(""), wxT("invalid radiobox index") );
{
if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
height = totHeight + extraHeight;
- else
+ else
height = heightOld;
}
- MoveWindow(GetHwnd(), x_offset, y_offset, width, height, TRUE);
+// TODO: MoveWindow(GetHwnd(), x_offset, y_offset, width, height, TRUE);
x_offset += cx1;
y_offset += cy1;
void wxRadioBox::GetSize(int *width, int *height) const
{
RECT rect;
- rect.left = -1; rect.right = -1; rect.top = -1; rect.bottom = -1;
+ rect.xLeft = -1; rect.xRight = -1; rect.yTop = -1; rect.yBottom = -1;
if (m_hWnd)
wxFindMaxSize(m_hWnd, &rect);
for (i = 0; i < m_noItems; i++)
wxFindMaxSize(m_radioButtons[i], &rect);
- *width = rect.right - rect.left;
- *height = rect.bottom - rect.top;
+ *width = rect.xRight - rect.xLeft;
+ *height = rect.yBottom - rect.yTop;
}
void wxRadioBox::GetPosition(int *x, int *y) const
{
wxWindow *parent = GetParent();
RECT rect;
- rect.left = -1; rect.right = -1; rect.top = -1; rect.bottom = -1;
+ rect.xLeft = -1; rect.xRight = -1; rect.yTop = -1; rect.yBottom = -1;
int i;
for (i = 0; i < m_noItems; i++)
// Since we now have the absolute screen coords,
// if there's a parent we must subtract its top left corner
- POINT point;
- point.x = rect.left;
- point.y = rect.top;
+ POINTL point;
+ point.x = rect.xLeft;
+ point.y = rect.yTop;
// TODO:
/*
if (parent)
if ( !wxControl::Show(show) )
return FALSE;
- int nCmdShow = show ? SW_SHOW : SW_HIDE;
+ int nCmdShow = 0; // TODO: show ? SW_SHOW : SW_HIDE;
for ( int i = 0; i < m_noItems; i++ )
{
// TODO: ::ShowWindow((HWND)m_radioButtons[i], nCmdShow);
// window proc for radio buttons
// ---------------------------------------------------------------------------
-MRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
- UINT msg,
- MPARAM wParam,
- MPARAM lParam)
+MRESULT wxRadioBtnWndProc(HWND hwnd,
+ UINT msg,
+ MPARAM wParam,
+ MPARAM lParam)
{
bool processed = TRUE;
- if ( msg != WM_KEYDOWN )
- processed = FALSE;
+// if ( msg != WM_KEYDOWN )
+// processed = FALSE;
if ( processed )
{
- wxRadioBox *radiobox = (wxRadioBox *)::GetWindowLong(hwnd, GWL_USERDATA);
+ wxRadioBox *radiobox = NULL; // TODO: (wxRadioBox *)::GetWindowLong(hwnd, GWL_USERDATA);
wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") );
// fall through
default:
- processed = FALSE;
+ processed = FALSE;
}
*/
if ( processed )