#include "SRMenu.h" using namespace SRFramework; SRMenu::SRMenu() :m_hMenu(NULL) { } SRMenu::SRMenu(HMENU hMenu) { m_hMenu = hMenu; } void SRMenu::DestroyMenu() { if(m_hMenu) ::DestroyMenu(m_hMenu); } SRMenu::~SRMenu() { DestroyMenu(); } BOOL SRMenu::CreateMenu() { DestroyMenu(); m_hMenu = ::CreateMenu(); return m_hMenu != NULL; } BOOL SRMenu::AppendMenu(UINT nFlags, UINT_PTR nIDNewItem, const WCString &wcsNewItem) { return ::AppendMenu(m_hMenu, nFlags, nIDNewItem, wcsNewItem.w_str()); } BOOL SRMenu::CreatePopupMenu() { DestroyMenu(); m_hMenu = ::CreatePopupMenu(); return m_hMenu != NULL; } BOOL SRMenu::InsertMenu(const SRMenu & menu, UINT uPosition, UINT uFlags, const WCString & wcsNewItem) { return ::InsertMenu(m_hMenu, uPosition, uFlags, (UINT)menu.m_hMenu, wcsNewItem.w_str()); } BOOL SRMenu::CheckMenuItem(UINT nIDCheckItem, UINT nCheck) { return ::CheckMenuItem(m_hMenu, nIDCheckItem, nCheck); }