IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
#endif
-bool wxRadioBox::MSWCommand(const WXUINT param, const WXWORD id)
+bool wxRadioBox::MSWCommand(WXUINT param, WXWORD id)
{
if (param == BN_CLICKED)
{
m_radioHeight = NULL ;
}
-bool wxRadioBox::Create(wxWindow *parent, const wxWindowID id, const wxString& title,
+bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size,
- const int n, const wxString choices[],
- const int majorDim, const long style,
+ int n, const wxString choices[],
+ int majorDim, long style,
const wxValidator& val, const wxString& name)
{
m_selectedButton = -1;
m_noRowsOrCols = majorDim;
if (majorDim==0)
m_majorDim = n ;
- m_majorDim = majorDim ;
+ else // Seemed to make sense to put this 'else' here... (RD)
+ m_majorDim = majorDim ;
long msStyle = GROUP_FLAGS;
SetFont(* parent->GetFont());
- // Subclass again for purposes of dialog editing mode
SubclassWin((WXHWND)m_hWnd);
-/* Label will be the same as button font now.
- if (labelFont)
- {
- labelFont->RealizeResource();
- if (labelFont->GetResourceHandle())
- SendMessage(ms_handle,WM_SETFONT,
- (WPARAM)labelFont->GetResourceHandle(),0L);
- }
-*/
-
// Some radio boxes test consecutive id.
(void)NewControlId() ;
m_radioButtons = new WXHWND[n];
}
#if 0
-bool wxRadioBox::Create(wxWindow *parent, const wxWindowID id, const wxString& title,
+bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size,
- const int n, const wxBitmap *choices[],
- const int majorDim, const long style,
+ int n, const wxBitmap *choices[],
+ int majorDim, long style,
const wxValidator& val, const wxString& name)
{
m_selectedButton = -1;
0,0,0,0,
(HWND) parent->GetHWND(), (HMENU) m_windowId, wxGetInstance(), NULL) ;
-/*
- if (labelFont)
- {
- labelFont->RealizeResource();
- if (labelFont->GetResourceHandle())
- SendMessage(ms_handle,WM_SETFONT,
- (WPARAM)labelFont->GetResourceHandle(),0L);
- }
-*/
the_handle = (HWND) parent->GetHWND();
#if CTL3D
wxRadioBox::~wxRadioBox(void)
{
m_isBeingDeleted = TRUE;
-
+
if (m_radioButtons)
{
int i;
}
-wxString wxRadioBox::GetLabel(const int item) const
+wxString wxRadioBox::GetLabel(int item) const
{
GetWindowText((HWND)m_radioButtons[item], wxBuffer, 300);
return wxString(wxBuffer);
}
-void wxRadioBox::SetLabel(const int item, const wxString& label)
+void wxRadioBox::SetLabel(int item, const wxString& label)
{
m_radioWidth[item] = m_radioHeight[item] = -1 ;
SetWindowText((HWND)m_radioButtons[item], (const char *)label);
}
-void wxRadioBox::SetLabel(const int item, wxBitmap *bitmap)
+void wxRadioBox::SetLabel(int item, wxBitmap *bitmap)
{
/*
m_radioWidth[item] = bitmap->GetWidth() + FB_MARGIN ;
return -1;
}
-void wxRadioBox::SetSelection(const int N)
+void wxRadioBox::SetSelection(int N)
{
if ((N < 0) || (N >= m_noItems))
return;
}
// Find string for position
-wxString wxRadioBox::GetString(const int N) const
+wxString wxRadioBox::GetString(int N) const
{
GetWindowText((HWND) m_radioButtons[N], wxBuffer, 1000);
return wxString(wxBuffer);
}
-void wxRadioBox::SetSize(const int x, const int y, const int width, const int height, const int sizeFlags)
+void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags)
{
int currentX, currentY;
GetPosition(¤tX, ¤tY);
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
yy = currentY;
+ AdjustForParentClientOrigin(xx, yy, sizeFlags);
+
char buf[400];
int y_offset = yy;
int x_offset = xx;
- float current_width;
-
- float cyf;
+ int current_width, cyf;
int cx1,cy1 ;
wxGetCharSize(m_hWnd, &cx1, &cy1, GetFont());
int nbHor,nbVer;
- if (m_windowStyle & wxRA_VERTICAL)
+ if (m_windowStyle & wxRA_HORIZONTAL)
{
nbVer = m_majorDim ;
nbHor = (m_noItems+m_majorDim-1)/m_majorDim ;
// Bidimensional radio adjustment
if (i&&((i%m_majorDim)==0)) // Why is this omitted for i = 0?
{
- if (m_windowStyle & wxRA_VERTICAL)
+ if (m_windowStyle & wxRA_HORIZONTAL)
{
y_offset = startY;
x_offset += maxWidth + cx1 ;
}
MoveWindow((HWND) m_radioButtons[i],x_offset,y_offset,eachWidth,eachHeight,TRUE);
- if (m_windowStyle & wxRA_VERTICAL)
+ if (m_windowStyle & wxRA_HORIZONTAL)
{
y_offset += maxHeight;
if (m_radioWidth[0]>0)
{
::ScreenToClient((HWND) parent->GetHWND(), &point);
}
+ // We may be faking the client origin.
+ // So a window that's really at (0, 30) may appear
+ // (to wxWin apps) to be at (0, 0).
+ if (GetParent())
+ {
+ wxPoint pt(GetParent()->GetClientAreaOrigin());
+ point.x -= pt.x;
+ point.y -= pt.y;
+ }
*x = point.x;
*y = point.y;
void wxRadioBox::SetFocus(void)
{
-/*
- if (m_noItems > 0)
- ::SetFocus((HWND) m_radioButtons[0]);
-*/
-/* Begin Alberts Patch 26. 5. 1997*/
if (m_noItems > 0)
{
if (m_selectedButton == -1)
else
::SetFocus((HWND) m_radioButtons[m_selectedButton]);
}
-/* Ende Alberts Patch*/
}
-bool wxRadioBox::Show(const bool show)
+bool wxRadioBox::Show(bool show)
{
int cshow;
if (show)
}
// Enable a specific button
-void wxRadioBox::Enable(const int item, const bool enable)
+void wxRadioBox::Enable(int item, bool enable)
{
if (item<0)
wxWindow::Enable(enable) ;
}
// Enable all controls
-void wxRadioBox::Enable(const bool enable)
+void wxRadioBox::Enable(bool enable)
{
wxControl::Enable(enable);
-
+
int i;
for (i = 0; i < m_noItems; i++)
::EnableWindow((HWND) m_radioButtons[i], enable);
}
// Show a specific button
-void wxRadioBox::Show(const int item, const bool show)
+void wxRadioBox::Show(int item, bool show)
{
if (item<0)
wxRadioBox::Show(show) ;
}
}
-WXHBRUSH wxRadioBox::OnCtlColor(const WXHDC pDC, const WXHWND pWnd, const WXUINT nCtlColor,
+WXHBRUSH wxRadioBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{
#if CTL3D
return FALSE;
}
-/*
-void wxRadioBox::SetLabelFont(wxFont *font)
-{
- // Decrement the usage count of the old label font
- // (we may be able to free it up)
- if (labelFont)
- labelFont->ReleaseResource();
-
- labelFont = font;
-
- // Increment usage count
- if (font)
- font->UseResource();
-
- HWND hWnd = GetHWND();
- if (hWnd != 0)
- {
- if (font)
- {
- font->RealizeResource();
-
- if (font->GetResourceHandle())
- SendMessage(hWnd, WM_SETFONT,
- (WPARAM)font->GetResourceHandle(),TRUE);
- }
- }
-}
-
-*/
-
bool wxRadioBox::ContainsHWND(WXHWND hWnd) const
{
int i;
ProcessCommand (event);
}
+long wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
+{
+ if (nMsg == WM_NCHITTEST)
+ {
+ int xPos = LOWORD(lParam); // horizontal position of cursor
+ int yPos = HIWORD(lParam); // vertical position of cursor
+
+ ScreenToClient(&xPos, &yPos);
+
+ // Make sure you can drag by the top of the groupbox, but let
+ // other (enclosed) controls get mouse events also
+ if (yPos < 10)
+ return (long)HTCLIENT;
+ }
+
+ return wxControl::MSWWindowProc(nMsg, wParam, lParam);
+}