#include "wx/ownerdrw.h"
#endif
+#ifdef __WXPALMOS6__
#include <Loader.h>
+#else // __WXPALMOS5__
+#include <UIResources.h> // MenuRscType
+#endif
+
#include <Form.h>
#include <Menu.h>
for( size_t i = 0 ; i < GetMenuCount() ; ++i )
{
wxMenuInfo* info = new wxMenuInfo() ;
- info->Create( const_cast<wxMenuBar*>(this)->GetMenu(i) , GetLabelTop(i) ) ;
+ info->Create( const_cast<wxMenuBar*>(this)->GetMenu(i) , GetMenuLabel(i) ) ;
list->Append( info ) ;
}
return m_menuInfos ;
wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
{
- wxCHECK_MSG( item, NULL, _T("NULL item in wxMenu::DoAppend") );
+ wxCHECK_MSG( item, NULL, wxT("NULL item in wxMenu::DoAppend") );
if(!wxMenuBase::DoAppend(item) || !DoInsertOrAppend(item))
{
// Palm OS does not have support for grayed or disabled items
}
-void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
+void wxMenuBar::SetMenuLabel(size_t pos, const wxString& label)
{
wxCHECK_RET( pos < GetMenuCount(), wxT("invalid menu index") );
- m_titles[pos]=wxStripMenuCodes(label);
+ m_titles[pos] = label;
if ( !IsAttached() )
{
Refresh();
}
-wxString wxMenuBar::GetLabelTop(size_t pos) const
+wxString wxMenuBar::GetMenuLabel(size_t pos) const
{
wxCHECK_MSG( pos < GetMenuCount(), wxEmptyString,
- wxT("invalid menu index in wxMenuBar::GetLabelTop") );
+ wxT("invalid menu index in wxMenuBar::GetMenuLabel") );
- return wxMenuItem::GetLabelFromText(m_titles[pos]);
+ return m_titles[pos];
}
// ---------------------------------------------------------------------------
if ( !menuOld )
return NULL;
- m_titles[pos]=wxStripMenuCodes(title);
+ m_titles[pos] = title;
if ( IsAttached() )
{
if ( !wxMenuBarBase::Insert(pos, menu, title) )
return false;
- m_titles.Insert(wxStripMenuCodes(title), pos);
+ m_titles.Insert(title, pos);
if ( IsAttached() )
{
if ( !wxMenuBarBase::Append(menu, title) )
return false;
- m_titles.Add(wxStripMenuCodes(title));
+ m_titles.Add(title);
if(IsAttached())
{
{
int i=0;
int j=0;
-
+#ifdef __WXPALMOS6__
// Handle to the currently running application database
DmOpenRef AppDB;
// Get app database reference - needed for some Palm OS Menu API calls.
SysGetModuleDatabase(SysGetRefNum(), NULL, &AppDB);
+#endif // __WXPALMOS6__
// Get the number of menus
int NumMenus=GetMenuCount();
// Load the menu template and set up the menu pointers
if(NumMenus==1)
{
- PalmOSMenuBar=DmGetResource(AppDB,'MBAR',1000);
- PalmOSMenuBarPtr=(char *)MemHandleLock(PalmOSMenuBar);
+ PalmOSMenuBar = POS_DmGetResource (AppDB, MenuRscType, 1000);
+ PalmOSMenuBarPtr = (char *)MemHandleLock (PalmOSMenuBar);
- PalmOSMenuBarPtr+=74;
+ PalmOSMenuBarPtr += 74;
}
else if(NumMenus==2)
{
- PalmOSMenuBar=DmGetResource(AppDB,'MBAR',2000);
- PalmOSMenuBarPtr=(char *)MemHandleLock(PalmOSMenuBar);
+ PalmOSMenuBar = POS_DmGetResource (AppDB, MenuRscType, 2000);
+ PalmOSMenuBarPtr = (char *)MemHandleLock (PalmOSMenuBar);
- PalmOSMenuBarPtr+=116;
+ PalmOSMenuBarPtr += 116;
}
else if(NumMenus==3)
{
- PalmOSMenuBar=DmGetResource(AppDB,'MBAR',3000);
- PalmOSMenuBarPtr=(char *)MemHandleLock(PalmOSMenuBar);
+ PalmOSMenuBar = POS_DmGetResource (AppDB, MenuRscType, 3000);
+ PalmOSMenuBarPtr = (char *)MemHandleLock (PalmOSMenuBar);
- PalmOSMenuBarPtr+=158;
+ PalmOSMenuBarPtr += 158;
}
else
{
// more than we can handle.
NumMenus=4;
- PalmOSMenuBar=DmGetResource(AppDB,'MBAR',4000);
- PalmOSMenuBarPtr=(char *)MemHandleLock(PalmOSMenuBar);
+ PalmOSMenuBar = POS_DmGetResource (AppDB, MenuRscType, 4000);
+ PalmOSMenuBarPtr = (char *)MemHandleLock (PalmOSMenuBar);
- PalmOSMenuBarPtr+=200;
+ PalmOSMenuBarPtr += 200;
}
// Set the proper names for the drop-down triggers.
wxString MenuTitle=m_titles.Item(i);
// Make sure we don't copy more than 8 bytes for the label
- int LengthToCopy=MenuTitle.length();
- if(LengthToCopy>8)
- LengthToCopy=8;
+ int LengthToCopy = MenuTitle.length();
+ if(LengthToCopy > 8)
+ LengthToCopy = 8;
- MemMove(PalmOSMenuBarPtr,MenuTitle,LengthToCopy);
+ MemMove(PalmOSMenuBarPtr,(char*)(&MenuTitle),LengthToCopy);
PalmOSMenuBarPtr+=11;
}
// We must make the menu active before we can add items to the drop-down
// triggers.
- FrmSetMenu(FrmGetActiveForm(),AppDB,NumMenus*1000);
+ POS_FrmSetMenu (FrmGetActiveForm(), AppDB, NumMenus * 1000);
/* Add the menu items to the drop-down triggers. This must be done after
* setting the triggers, because setting the names of drop-down triggers
else
{
if(j==0)
- MenuAddItem(9000+i,((i*1000)+1000)+j,0x00,ItemLabel);
+ MenuAddItem(9000+i,((i*1000)+1000)+j,0x00,(char *)(&ItemLabel));
else
- MenuAddItem(((i*1000)+1000)+j-1,((i*1000)+1000)+j,0x00,ItemLabel);
+ MenuAddItem(((i*1000)+1000)+j-1,((i*1000)+1000)+j,0x00,(char *)(&ItemLabel));
}
}