mac adaptions

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4458 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
1999-11-09 15:24:52 +00:00
parent eff869aad2
commit e75491071d
66 changed files with 4803 additions and 5220 deletions

View File

@@ -37,24 +37,26 @@
// -----------
wxMenuItem::wxMenuItem(wxMenu *pParentMenu, int id,
const wxString& strName, const wxString& strHelp,
const wxString& text, const wxString& strHelp,
bool bCheckable,
wxMenu *pSubMenu) :
m_bCheckable(bCheckable),
m_strName(strName),
m_strHelp(strHelp)
wxMenu *pSubMenu)
{
wxASSERT( pParentMenu != NULL );
wxASSERT( pParentMenu != NULL );
m_pParentMenu = pParentMenu;
m_pSubMenu = pSubMenu;
m_idItem = id;
m_bEnabled = TRUE;
m_parentMenu = pParentMenu;
m_subMenu = pSubMenu;
m_isEnabled = TRUE;
m_isChecked = FALSE;
m_id = id;
m_text = text;
m_isCheckable = bCheckable;
m_help = strHelp;
if ( m_strName == "E&xit" ||m_strName == "Exit" )
{
m_strName = "Quit\tCtrl+Q" ;
}
if ( m_text == "E&xit" ||m_text == "Exit" )
{
m_text = "Quit\tCtrl+Q" ;
}
}
wxMenuItem::~wxMenuItem()
@@ -64,53 +66,57 @@ wxMenuItem::~wxMenuItem()
// misc
// ----
/*
// delete the sub menu
void wxMenuItem::DeleteSubMenu()
{
wxASSERT( m_pSubMenu != NULL );
wxASSERT( m_subMenu != NULL );
delete m_pSubMenu;
m_pSubMenu = NULL;
delete m_subMenu;
m_subMenu = NULL;
}
*/
// change item state
// -----------------
void wxMenuItem::Enable(bool bDoEnable)
{
if ( m_bEnabled != bDoEnable ) {
if ( m_pSubMenu == NULL )
if ( m_isEnabled != bDoEnable ) {
if ( m_subMenu == NULL )
{
// normal menu item
if ( m_pParentMenu->m_macMenuHandle )
if ( m_parentMenu->GetHMenu() )
{
int index = m_pParentMenu->MacGetIndexFromItem( this ) ;
int index = m_parentMenu->MacGetIndexFromItem( this ) ;
if ( index >= 1 )
{
if ( bDoEnable )
UMAEnableMenuItem( m_pParentMenu->m_macMenuHandle , index ) ;
UMAEnableMenuItem( m_parentMenu->GetHMenu() , index ) ;
else
UMADisableMenuItem( m_pParentMenu->m_macMenuHandle , index ) ;
UMADisableMenuItem( m_parentMenu->GetHMenu() , index ) ;
}
}
}
else
{
// submenu
if ( m_pParentMenu->m_macMenuHandle )
if ( m_parentMenu->GetHMenu() )
{
int index = m_pParentMenu->MacGetIndexFromItem( this ) ;
int index = m_parentMenu->MacGetIndexFromItem( this ) ;
if ( index >= 1 )
{
if ( bDoEnable )
UMAEnableMenuItem( m_pParentMenu->m_macMenuHandle , index ) ;
UMAEnableMenuItem( m_parentMenu->GetHMenu() , index ) ;
else
UMADisableMenuItem( m_pParentMenu->m_macMenuHandle , index ) ;
UMADisableMenuItem( m_parentMenu->GetHMenu() , index ) ;
}
}
}
m_bEnabled = bDoEnable;
m_isEnabled = bDoEnable;
}
}
@@ -118,18 +124,18 @@ void wxMenuItem::Check(bool bDoCheck)
{
wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
if ( m_bChecked != bDoCheck )
if ( m_isChecked != bDoCheck )
{
m_bChecked = bDoCheck;
if ( m_pParentMenu->m_macMenuHandle )
m_isChecked = bDoCheck;
if ( m_parentMenu->GetHMenu() )
{
int index = m_pParentMenu->MacGetIndexFromItem( this ) ;
int index = m_parentMenu->MacGetIndexFromItem( this ) ;
if ( index >= 1 )
{
if ( bDoCheck )
::SetItemMark( m_pParentMenu->m_macMenuHandle , index , 0x12 ) ; // checkmark
::SetItemMark( m_parentMenu->GetHMenu() , index , 0x12 ) ; // checkmark
else
::SetItemMark( m_pParentMenu->m_macMenuHandle , index , 0 ) ; // no mark
::SetItemMark( m_parentMenu->GetHMenu() , index , 0 ) ; // no mark
}
}
}