コード例 #1
0
ファイル: cuimenu.cpp プロジェクト: dogtwelve/eepp
Uint32 cUIMenu::OnMessage( const cUIMessage * Msg ) {
	switch ( Msg->Msg() ) {
		case cUIMessage::MsgMouseUp:
		{
			if ( Msg->Sender()->Parent() == this && ( Msg->Flags() & EE_BUTTONS_LRM ) ) {
				cUIEvent ItemEvent( Msg->Sender(), cUIEvent::EventOnItemClicked );
				SendEvent( &ItemEvent );
			}

			return 1;
		}
		case cUIMessage::MsgFocusLoss:
		{
			cUIControl * FocusCtrl = cUIManager::instance()->FocusControl();

			if ( this != FocusCtrl && !IsParentOf( FocusCtrl ) && !IsSubMenu( FocusCtrl ) ) {
				OnComplexControlFocusLoss();
			}

			return 1;
		}
	}

	return 0;
}
コード例 #2
0
ファイル: menuitem.cpp プロジェクト: chromylei/third_party
void wxMenuItem::Enable(bool bDoEnable)
{
    if ( m_isEnabled != bDoEnable )
    {
        if ( !IsSubMenu() )
        {
            // normal menu item
            if (m_buttonWidget)
                XtSetSensitive( (Widget) m_buttonWidget, (Boolean) bDoEnable);
        }
        else                            // submenu
        {
            // Maybe we should apply this to all items in the submenu?
            // Or perhaps it works anyway.
            if (m_buttonWidget)
                XtSetSensitive( (Widget) m_buttonWidget, (Boolean) bDoEnable);
        }

        wxMenuItemBase::Enable(bDoEnable);
    }
}
コード例 #3
0
void wxMenuItem::SetItemLabel( const wxString& rText )
{
    //
    // Don't do anything if label didn't change
    //

    wxString                        sText = wxPMTextToLabel(rText);
    if (m_text == sText)
        return;

    // wxMenuItemBase will do stock ID checks
    wxMenuItemBase::SetItemLabel(sText);

    HWND hMenu = GetHmenuOf(m_parentMenu);

    wxCHECK_RET(hMenu, wxT("menuitem without menu"));

#if wxUSE_ACCEL
    m_parentMenu->UpdateAccel(this);
#endif // wxUSE_ACCEL

    USHORT   uId = (USHORT)GetRealId();
    MENUITEM vItem;
    USHORT   uFlagsOld;

    if (!::WinSendMsg( hMenu
                      ,MM_QUERYITEM
                      ,MPFROM2SHORT(uId, TRUE)
                      ,(MPARAM)&vItem
                     ))
    {
        wxLogLastError(wxT("GetMenuState"));
    }
    else
    {
        uFlagsOld = vItem.afStyle;
        if (IsSubMenu())
        {
            uFlagsOld |= MIS_SUBMENU;
        }

        char*                       pData;

#if wxUSE_OWNER_DRAWN
        if (IsOwnerDrawn())
        {
            uFlagsOld |= MIS_OWNERDRAW;
            pData = (char*)this;
        }
        else
#endif  //owner drawn
        {
            uFlagsOld |= MIS_TEXT;
            pData = (char*) m_text.wx_str();
        }

        //
        // Set the style
        //
        if (!::WinSendMsg( hMenu
                          ,MM_SETITEM
                          ,MPFROM2SHORT(uId, TRUE)
                          ,(MPARAM)&vItem
                         ))
        {
            wxLogLastError(wxT("ModifyMenu"));
        }

        //
        // Set the text
        //
        if (::WinSendMsg( hMenu
                         ,MM_SETITEMTEXT
                         ,MPFROMSHORT(uId)
                         ,(MPARAM)pData
                        ))
        {
            wxLogLastError(wxT("ModifyMenu"));
        }
    }
} // end of wxMenuItem::SetText