#if wxUSE_RADIOBOX
+#include "wx/radiobox.h"
+
#ifndef WX_PRECOMP
#include "wx/bitmap.h"
#include "wx/brush.h"
- #include "wx/radiobox.h"
#include "wx/settings.h"
#include "wx/log.h"
#endif
#include "wx/msw/subwin.h"
#if wxUSE_TOOLTIPS
- #if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__)
- #include <commctrl.h>
- #endif
#include "wx/tooltip.h"
#endif // wxUSE_TOOLTIPS
GWL_STYLE) & WS_VISIBLE) != 0;
}
+#if wxUSE_TOOLTIPS
+
+bool wxRadioBox::HasToolTips() const
+{
+ return wxStaticBox::HasToolTips() || wxRadioBoxBase::HasItemToolTips();
+}
+
+void wxRadioBox::DoSetItemToolTip(unsigned int item, wxToolTip *tooltip)
+{
+ // we have already checked for the item to be valid in wxRadioBoxBase
+ const HWND hwndRbtn = (*m_radioButtons)[item];
+ if ( tooltip != NULL )
+ tooltip->Add(hwndRbtn);
+ else // unset the tooltip
+ wxToolTip::Remove(hwndRbtn);
+}
+
+#endif // wxUSE_TOOLTIPS
+
WX_FORWARD_STD_METHODS_TO_SUBWINDOWS(wxRadioBox, wxStaticBox, m_radioButtons)
// ----------------------------------------------------------------------------
// and also wide enough for its label
int widthLabel;
- GetTextExtent(wxStripMenuCodes(GetLabel()), &widthLabel, NULL);
+ GetTextExtent(GetLabelText(), &widthLabel, NULL);
widthLabel += RADIO_SIZE; // FIXME this is bogus too
if ( widthLabel > width )
width = widthLabel;
}
}
+int wxRadioBox::GetItemFromPoint(const wxPoint& pt) const
+{
+ const unsigned int count = GetCount();
+ for ( unsigned int i = 0; i < count; i++ )
+ {
+ RECT rect = wxGetWindowRect((*m_radioButtons)[i]);
+
+ if ( rect.left <= pt.x && pt.x < rect.right &&
+ rect.top <= pt.y && pt.y < rect.bottom )
+ {
+ return i;
+ }
+ }
+
+ return wxNOT_FOUND;
+}
+
// ----------------------------------------------------------------------------
// radio box drawing
// ----------------------------------------------------------------------------
return lDlgCode | DLGC_WANTARROWS;
}
-#if wxUSE_TOOLTIPS
- case WM_NOTIFY:
- {
- NMHDR* hdr = (NMHDR *)lParam;
- if ( hdr->code == TTN_NEEDTEXT )
- {
- wxRadioBox *
- radiobox = (wxRadioBox *)wxGetWindowUserData(hwnd);
-
- wxCHECK_MSG( radiobox, 0,
- wxT("radio button without radio box?") );
-
- wxToolTip *tooltip = radiobox->GetToolTip();
- if ( tooltip )
- {
- TOOLTIPTEXT *ttt = (TOOLTIPTEXT *)lParam;
- ttt->lpszText = (wxChar *)tooltip->GetTip().c_str();
- }
-
- // processed
- return 0;
- }
- }
- break;
-#endif // wxUSE_TOOLTIPS
-
case WM_KEYDOWN:
{
wxRadioBox *radiobox = (wxRadioBox *)wxGetWindowUserData(hwnd);