X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/05d31b3aca84298974766d6021738fb64961a36b..b404a8f3b072129c107c6d9a5e0f6f53cd34807b:/src/common/radiocmn.cpp diff --git a/src/common/radiocmn.cpp b/src/common/radiocmn.cpp index 8d954df010..538281a0ed 100644 --- a/src/common/radiocmn.cpp +++ b/src/common/radiocmn.cpp @@ -6,7 +6,7 @@ // Created: 03.06.01 // RCS-ID: $Id$ // Copyright: (c) 2001 Vadim Zeitlin -// License: wxWindows licence +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -38,13 +38,80 @@ #include "wx/cshelp.h" #endif +extern WXDLLEXPORT_DATA(const char) wxRadioBoxNameStr[] = "radioBox"; + // ============================================================================ // implementation // ============================================================================ +// ---------------------------------------------------------------------------- +// XTI +// ---------------------------------------------------------------------------- + +// TODO: wxCONSTRUCTOR +#if 0 // wxUSE_EXTENDED_RTTI +wxDEFINE_FLAGS( wxRadioBoxStyle ) + +wxBEGIN_FLAGS( wxRadioBoxStyle ) +// new style border flags, we put them first to +// use them for streaming out +wxFLAGS_MEMBER(wxBORDER_SIMPLE) +wxFLAGS_MEMBER(wxBORDER_SUNKEN) +wxFLAGS_MEMBER(wxBORDER_DOUBLE) +wxFLAGS_MEMBER(wxBORDER_RAISED) +wxFLAGS_MEMBER(wxBORDER_STATIC) +wxFLAGS_MEMBER(wxBORDER_NONE) + +// old style border flags +wxFLAGS_MEMBER(wxSIMPLE_BORDER) +wxFLAGS_MEMBER(wxSUNKEN_BORDER) +wxFLAGS_MEMBER(wxDOUBLE_BORDER) +wxFLAGS_MEMBER(wxRAISED_BORDER) +wxFLAGS_MEMBER(wxSTATIC_BORDER) +wxFLAGS_MEMBER(wxBORDER) + +// standard window styles +wxFLAGS_MEMBER(wxTAB_TRAVERSAL) +wxFLAGS_MEMBER(wxCLIP_CHILDREN) +wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) +wxFLAGS_MEMBER(wxWANTS_CHARS) +wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) +wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) +wxFLAGS_MEMBER(wxVSCROLL) +wxFLAGS_MEMBER(wxHSCROLL) + +wxFLAGS_MEMBER(wxRA_SPECIFY_COLS) +wxFLAGS_MEMBER(wxRA_HORIZONTAL) +wxFLAGS_MEMBER(wxRA_SPECIFY_ROWS) +wxFLAGS_MEMBER(wxRA_VERTICAL) + +wxEND_FLAGS( wxRadioBoxStyle ) + +IMPLEMENT_DYNAMIC_CLASS_XTI(wxRadioBox, wxControl,"wx/radiobox.h") + +wxBEGIN_PROPERTIES_TABLE(wxRadioBox) +wxEVENT_PROPERTY( Select , wxEVT_COMMAND_RADIOBOX_SELECTED , wxCommandEvent ) +wxPROPERTY_FLAGS( WindowStyle , wxRadioBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style +wxEND_PROPERTIES_TABLE() + +/* + selection + content + label + dimension + item + */ + +#endif + + +// ---------------------------------------------------------------------------- +// wxRadioBoxBase +// ---------------------------------------------------------------------------- + void wxRadioBoxBase::SetMajorDim(unsigned int majorDim, long style) { - wxCHECK_RET( majorDim != 0, _T("major radiobox dimension can't be 0") ); + wxCHECK_RET( majorDim != 0, wxT("major radiobox dimension can't be 0") ); m_majorDim = majorDim; @@ -125,7 +192,7 @@ int wxRadioBoxBase::GetNextItem(int item, wxDirection dir, long style) const break; default: - wxFAIL_MSG( _T("unexpected wxDirection value") ); + wxFAIL_MSG( wxT("unexpected wxDirection value") ); return wxNOT_FOUND; } @@ -158,7 +225,7 @@ int wxRadioBoxBase::GetNextItem(int item, wxDirection dir, long style) const } wxASSERT_MSG( item < count && item >= 0, - _T("logic error in wxRadioBox::GetNextItem()") ); + wxT("logic error in wxRadioBox::GetNextItem()") ); } // we shouldn't select the non-active items, continue looking for a // visible and shown one unless we came back to the item we started from in @@ -172,7 +239,7 @@ int wxRadioBoxBase::GetNextItem(int item, wxDirection dir, long style) const void wxRadioBoxBase::SetItemToolTip(unsigned int item, const wxString& text) { - wxASSERT_MSG( item < GetCount(), _T("Invalid item index") ); + wxASSERT_MSG( item < GetCount(), wxT("Invalid item index") ); // extend the array to have entries for all our items on first use if ( !m_itemsTooltips ) @@ -189,8 +256,7 @@ void wxRadioBoxBase::SetItemToolTip(unsigned int item, const wxString& text) if ( tooltip ) { // delete the tooltip - delete tooltip; - tooltip = NULL; + wxDELETE(tooltip); } else // nothing to do { @@ -247,7 +313,7 @@ wxRadioBoxBase::~wxRadioBoxBase() // set helptext for a particular item void wxRadioBoxBase::SetItemHelpText(unsigned int n, const wxString& helpText) { - wxCHECK_RET( n < GetCount(), _T("Invalid item index") ); + wxCHECK_RET( n < GetCount(), wxT("Invalid item index") ); if ( m_itemsHelpTexts.empty() ) { @@ -261,7 +327,7 @@ void wxRadioBoxBase::SetItemHelpText(unsigned int n, const wxString& helpText) // retrieve helptext for a particular item wxString wxRadioBoxBase::GetItemHelpText( unsigned int n ) const { - wxCHECK_MSG( n < GetCount(), wxEmptyString, _T("Invalid item index") ); + wxCHECK_MSG( n < GetCount(), wxEmptyString, wxT("Invalid item index") ); return m_itemsHelpTexts.empty() ? wxString() : m_itemsHelpTexts[n]; } @@ -271,13 +337,30 @@ wxString wxRadioBoxBase::DoGetHelpTextAtPoint(const wxWindow *derived, const wxPoint& pt, wxHelpEvent::Origin origin) const { - const int item = origin == wxHelpEvent::Origin_HelpButton - ? GetItemFromPoint(pt) - : GetSelection(); + int item; + switch ( origin ) + { + case wxHelpEvent::Origin_HelpButton: + item = GetItemFromPoint(pt); + break; + + case wxHelpEvent::Origin_Keyboard: + item = GetSelection(); + break; + + default: + wxFAIL_MSG( "unknown help even origin" ); + // fall through + + case wxHelpEvent::Origin_Unknown: + // this value is used when we're called from GetHelpText() for the + // radio box itself, so don't return item-specific text in this case + item = wxNOT_FOUND; + } if ( item != wxNOT_FOUND ) { - wxString text = GetItemHelpText(wx_static_cast(unsigned int, item)); + wxString text = GetItemHelpText(static_cast(item)); if( !text.empty() ) return text; }