WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable;
+WXDLLEXPORT wxString wxPMTextToLabel(const wxString& rsTitle);
#endif
// _WX_ACCEL_H_
return (Ok() && rc);
} // end of wxAcceleratorTable::Translate
+// ---------------------------------------------------------------------------
+// function for translating labels
+// ---------------------------------------------------------------------------
+
+wxString wxPMTextToLabel(
+ const wxString& rsTitle
+)
+{
+ wxString sTitle;
+ const wxChar* zPc;
+
+ if (rsTitle.IsEmpty())
+ return(sTitle);
+
+ for (zPc = rsTitle.c_str(); *zPc != wxT('\0'); zPc++)
+ {
+ if (*zPc == wxT('&'))
+ {
+ if (*(zPc + 1) == wxT('&'))
+ {
+ zPc++;
+ sTitle << wxT('&');
+ }
+ else
+ sTitle << wxT('~');
+ }
+ else
+ {
+ if ( *zPc == wxT('~'))
+ {
+ //
+ // Tildes must be doubled to prevent them from being
+ // interpreted as accelerator character prefix by PM ???
+ //
+ sTitle << *zPc;
+ }
+ sTitle << *zPc;
+ }
+ }
+ return(sTitle);
+} // end of wxPMTextToLabel
+
IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler)
-// ----------------------------------------------------------------------------
-// static function for translating menu labels
-// ----------------------------------------------------------------------------
-
-static wxString TextToLabel(
- const wxString& rsTitle
-)
-{
- wxString sTitle = "";
- const wxChar* zPc;
-
- if (rsTitle.IsEmpty())
- return sTitle;
- for (zPc = rsTitle.c_str(); *zPc != wxT('\0'); zPc++ )
- {
- if (*zPc == wxT('&') )
- {
- if (*(zPc + 1) == wxT('&'))
- {
- zPc++;
- sTitle << wxT('&');
- }
- else
- sTitle << wxT('~');
- }
- else
- {
- if ( *zPc == wxT('~') )
- {
- //
- // Tildes must be doubled to prevent them from being
- // interpreted as accelerator character prefix by PM ???
- //
- sTitle << *zPc;
- }
- sTitle << *zPc;
- }
- }
- return sTitle;
-} // end of TextToLabel
-
// ============================================================================
// implementation
// ============================================================================
m_bDoBreak = FALSE;
}
- if (pItem->IsSeparator())
- {
- rItem.afStyle |= MIS_SEPARATOR;
- }
-
//
// Id is the numeric id for normal menu items and HMENU for submenus as
// required by ::MM_INSERTITEM message API
//
-
if (pSubmenu != NULL)
{
wxASSERT_MSG(pSubmenu->GetHMenu(), wxT("invalid submenu"));
pItem->m_vMenuData.afStyle = rItem.afStyle;
pItem->m_vMenuData.hItem = rItem.hItem;
}
- else if (!pItem->IsSeparator())
+ else
#endif
+ if (pItem->IsSeparator())
+ {
+ rItem.afStyle = MIS_SEPARATOR;
+ }
+ else
{
//
// Menu is just a normal string (passed in data parameter)
)
{
SHORT nId;
- wxString sTitle = TextToLabel(rTitle);
+ wxString sTitle = wxPMTextToLabel(rTitle);
wxMenu* pMenuOld = wxMenuBarBase::Replace( nPos
,pMenu
,sTitle
, const wxString& rTitle
)
{
- wxString sTitle = TextToLabel(rTitle);
+ wxString sTitle = wxPMTextToLabel(rTitle);
if (!wxMenuBarBase::Insert( nPos
,pMenu
wxCHECK_MSG(hSubmenu, FALSE, wxT("can't append invalid menu to menubar"));
- wxString sTitle = TextToLabel(rsTitle);
+ wxString sTitle = wxPMTextToLabel(rsTitle);
if (!wxMenuBarBase::Append(pMenu, sTitle))
return FALSE;
#define OWNER_DRAWN_ONLY( code )
#endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
-// ----------------------------------------------------------------------------
-// static function for translating menu labels
-// ----------------------------------------------------------------------------
-
-static wxString TextToLabel(
- const wxString& rsTitle
-)
-{
- wxString sTitle;
- const wxChar* zPc;
-
- if (rsTitle.IsEmpty())
- return(sTitle);
-
- for (zPc = rsTitle.c_str(); *zPc != wxT('\0'); zPc++)
- {
- if (*zPc == wxT('&'))
- {
- if (*(zPc + 1) == wxT('&'))
- {
- zPc++;
- sTitle << wxT('&');
- }
- else
- sTitle << wxT('~');
- }
- else
- {
- if ( *zPc == wxT('~'))
- {
- //
- // Tildes must be doubled to prevent them from being
- // interpreted as accelerator character prefix by PM ???
- //
- sTitle << *zPc;
- }
- sTitle << *zPc;
- }
- }
- return(sTitle);
-} // end of TextToLabel
-
// ============================================================================
// implementation
// ============================================================================
)
: wxMenuItemBase( pParentMenu
,nId
- ,TextToLabel(rsText)
+ ,wxPMTextToLabel(rsText)
,rsHelp
,eKind
,pSubMenu
)
#if wxUSE_OWNER_DRAWN
-, wxOwnerDrawn( TextToLabel(rsText)
+, wxOwnerDrawn( wxPMTextToLabel(rsText)
,eKind == wxITEM_CHECK
)
#endif // owner drawn
)
: wxMenuItemBase( pParentMenu
,nId
- ,TextToLabel(rsText)
+ ,wxPMTextToLabel(rsText)
,rsHelp
,bIsCheckable ? wxITEM_CHECK : wxITEM_NORMAL
,pSubMenu
)
#if wxUSE_OWNER_DRAWN
-, wxOwnerDrawn( TextToLabel(rsText)
+, wxOwnerDrawn( wxPMTextToLabel(rsText)
,bIsCheckable
)
#endif // owner drawn
// Don't do anything if label didn't change
//
- wxString sText = TextToLabel(rText);
+ wxString sText = wxPMTextToLabel(rText);
if (m_text == sText)
return;