#include "wx/ownerdrw.h"
#endif
+#ifdef __WXPALMOS6__
#include <Loader.h>
+#else // __WXPALMOS5__
+#include <UIResources.h> // MenuRscType
+#endif
+
#include <Form.h>
#include <Menu.h>
{
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));
}
}