Files
Aerofoil/PortabilityLayer/PLMenus.cpp

84 lines
1.5 KiB
C++
Raw Normal View History

2019-12-12 23:37:40 -05:00
#include "PLMenus.h"
2019-12-21 18:40:17 -05:00
#include "PLResources.h"
#include "MenuManager.h"
// Menu resource structure:
// uint16 menu ID
// uint16 width
// uint16 height
// uint16 command ID
// uint16 padding
// uint32 enable flags
// pstr title (Apple menu is 0x14)
// Zero-byte terminated list:
// pstr Item text (separator is char 0x2d)
// int8 Icon #
// uint8 key
// uint8 submenu ID
// uint8 text style
2019-11-11 00:11:59 -05:00
MenuHandle GetMenu(int resID)
{
2019-12-21 18:40:17 -05:00
Handle menuRes = GetResource('MENU', resID);
2019-11-11 00:11:59 -05:00
2019-12-21 18:40:17 -05:00
if (!menuRes)
return nullptr;
const MenuHandle menu = PortabilityLayer::MenuManager::GetInstance()->DeserializeMenu(*menuRes);
ReleaseResource(menuRes);
return menu;
2019-11-11 00:11:59 -05:00
}
2019-12-21 18:40:17 -05:00
void InsertMenu(MenuHandle menu, int beforeID)
2019-11-11 00:11:59 -05:00
{
2019-12-21 18:40:17 -05:00
PortabilityLayer::MenuManager *mm = PortabilityLayer::MenuManager::GetInstance();
if (beforeID)
{
MenuHandle otherMenu = mm->GetMenuByID(beforeID);
if (otherMenu)
{
mm->InsertMenuBefore(menu, otherMenu);
return;
}
}
mm->InsertMenuAtEnd(menu);
2019-11-11 00:11:59 -05:00
}
void DeleteMenu(int menuID)
{
PL_NotYetImplemented();
}
void DrawMenuBar()
{
2019-12-21 18:40:17 -05:00
PL_NotYetImplemented_TODO("Menus");
2019-11-11 00:11:59 -05:00
}
void HiliteMenu(int menu)
{
2019-12-21 18:40:17 -05:00
PL_NotYetImplemented_TODO("Menus");
2019-11-11 00:11:59 -05:00
}
void EnableMenuItem(MenuHandle menu, int index)
{
2019-12-21 18:40:17 -05:00
PL_NotYetImplemented_TODO("Menus");
2019-11-11 00:11:59 -05:00
}
void DisableMenuItem(MenuHandle menu, int index)
{
2019-12-21 18:40:17 -05:00
PL_NotYetImplemented_TODO("Menus");
2019-11-11 00:11:59 -05:00
}
void CheckMenuItem(MenuHandle menu, int index, Boolean checked)
{
2019-12-21 18:40:17 -05:00
PL_NotYetImplemented_TODO("Menus");
2019-11-11 00:11:59 -05:00
}
void SetMenuItemText(MenuHandle menu, int index, const PLPasStr &text)
{
2019-12-21 18:40:17 -05:00
PL_NotYetImplemented_TODO("Menus");
2019-11-11 00:11:59 -05:00
}