Beispiel #1
0
void WHandleMenuSelect( WStatBar *wsb, HMENU menu, WPARAM wParam, LPARAM lParam )
{
    HMENU   popup;
    WORD    flags;

    if( wsb == NULL || menu == NULL ) {
        return;
    }

    flags = GET_WM_MENUSELECT_FLAGS( wParam, lParam );

    if( flags == (WORD)-1 && GET_WM_MENUSELECT_HMENU( wParam, lParam ) == (HMENU)NULL ) {
        WSetStatusText( wsb, NULL, "" );
    } else if( flags & (MF_SYSMENU | MF_SEPARATOR) ) {
        WSetStatusText( wsb, NULL, "" );
    } else if( flags & MF_POPUP ) {
        popup = (HMENU)GET_WM_MENUSELECT_ITEM( wParam, lParam );
#ifdef __NT__
        popup = GetSubMenu( (HMENU)lParam, (int)popup );
#endif
        WHandlePopupHint( wsb, menu, popup );
    } else {
        WDisplayHint( wsb, (int)GET_WM_MENUSELECT_ITEM( wParam, lParam ) );
    }
}
Beispiel #2
0
/*------------------------------------------------------------------------
Procedure:     MsgMenuSelect ID:1
Purpose:       Shows in the status bar a descriptive explaation of
the purpose of each menu item.The message
WM_MENUSELECT is sent when the user starts browsing
the menu for each menu item where the mouse passes.
Input:         Standard windows.
Output:        The string from the resources string table is shown
Errors:        If the string is not found nothing will be shown.
------------------------------------------------------------------------*/
LRESULT MsgMenuSelect(HWND hwnd, UINT uMessage, WPARAM wparam, LPARAM lparam)
{
	static char szBuffer[256];
	UINT   nStringID = 0;
	UINT   fuFlags = GET_WM_MENUSELECT_FLAGS(wparam, lparam) & 0xffff;
	UINT   uCmd    = GET_WM_MENUSELECT_CMD(wparam, lparam);
	HMENU  hMenu   = GET_WM_MENUSELECT_HMENU(wparam, lparam);

	szBuffer[0] = 0;                            // First reset the buffer
	if (fuFlags == 0xffff && hMenu == NULL)     // Menu has been closed
		nStringID = 0;

	else if (fuFlags & MFT_SEPARATOR)           // Ignore separators
		nStringID = 0;

	else if (fuFlags & MF_POPUP)                // Popup menu
	{
		if (fuFlags & MF_SYSMENU)               // System menu
			nStringID = IDS_SYSMENU;
		else
			// Get string ID for popup menu from idPopup array.
			nStringID = 0;
	}  // for MF_POPUP
	else                                        // Must be a command item
		nStringID = uCmd;                       // String ID == Command ID

	// Load the string if we have an ID
	if (0 != nStringID)
		LoadString(hInst, nStringID, szBuffer, sizeof(szBuffer));
	// Finally... send the string to the status bar
	UpdateStatusBar(szBuffer, 0, 0);
	return 0;
}
Beispiel #3
0
void 
GetMenuSelect ( HWND hWndStatus, UINT message, 
			WPARAM wParam, LPARAM lParam) 
{
	UINT nStringID = 0;

	UINT fuFlags = GET_WM_MENUSELECT_FLAGS(wParam, lParam) & 0xffff;
	UINT uCmd = GET_WM_MENUSELECT_CMD(wParam, lParam);
	HMENU hMenu = GET_WM_MENUSELECT_HMENU(wParam, lParam);

	if (fuFlags == 0xffff && hMenu == (HMENU)NULL)
		nStringID = (UINT) -1;

	else if (fuFlags & MF_SEPARATOR)
		nStringID = 0;

	else if (fuFlags & MF_POPUP)
	{
		if (fuFlags & MF_SYSMENU)
			nStringID = 0;
	}
	else
	{
		nStringID = uCmd;
	}
	DisplayStatusMenuHelp(hWndStatus, nStringID);
}
Beispiel #4
0
void WHandleMenuSelect( WMenuEditInfo *einfo, WPARAM wParam, LPARAM lParam )
{
    WMenuEntry  *entry;
    HWND        lbox;
    HMENU       popup;
    WORD        flags;
    WORD        id;
    int         pos;

    if( !einfo || !einfo->menu || ! einfo->menu->first_entry ) {
        return;
    }

    lbox = GetDlgItem ( einfo->edit_dlg, IDM_MENUEDLIST );
    if( lbox == (HWND)NULL ) {
        return;
    }

    flags = GET_WM_MENUSELECT_FLAGS(wParam,lParam);

    entry = NULL;

    if( ( flags == (WORD)-1 ) &&
         ( GET_WM_MENUSELECT_HMENU(wParam,lParam) == (HMENU)NULL ) ) {
        // we ignore WM_MENUSELECT when a menu is closing
    } else if( flags & MF_SYSMENU ) {
        // we ignore WM_MENUSELECT for the system menu
    } else if( flags & MF_SEPARATOR ) {
        // we ignore WM_MENUSELECT for separators, for now...
    } else if( flags & MF_POPUP ) {
        popup = (HMENU) GET_WM_MENUSELECT_ITEM(wParam,lParam);
        #ifdef __NT__
            popup = GetSubMenu( (HMENU)lParam, (int)popup );
        #endif
        entry = WFindEntryFromPreviewPopup( einfo->menu->first_entry, popup );
    } else {
        id = GET_WM_MENUSELECT_ITEM(wParam,lParam);
        entry = WFindEntryFromPreviewID( einfo->menu->first_entry, id );
    }

    if( entry == NULL ) {
        return;
    }

    pos = 0;

    if ( WFindEntryLBPos( einfo->menu->first_entry, entry, &pos ) ) {
        pos--;
        einfo->current_entry = NULL;
        einfo->current_pos   = -1;
        if( SendMessage ( lbox, LB_SETCURSEL, (WPARAM) pos, 0 ) != LB_ERR ) {
            WHandleSelChange ( einfo );
        }
    }
}
Beispiel #5
0
void setLastMenuSelect( WAccelEditInfo *einfo, WPARAM wParam, LPARAM lParam )
{
    WORD flags;

    flags = GET_WM_MENUSELECT_FLAGS( wParam, lParam );

    if( flags == (WORD)-1 && GET_WM_MENUSELECT_HMENU( wParam, lParam ) == (HMENU)NULL ) {
        einfo->last_menu_select = -1;
    } else if( flags & (MF_SYSMENU | MF_SEPARATOR | MF_POPUP) ) {
        einfo->last_menu_select = -1;
    } else {
        einfo->last_menu_select = GET_WM_MENUSELECT_ITEM( wParam, lParam );
    }
}
Beispiel #6
0
void WdeHandleMenuSelect( WPARAM wParam, LPARAM lParam )
{
    HMENU   menu;
    HMENU   popup;
    WORD    flags;

    menu = WdeGetMenuHandle();
    flags = GET_WM_MENUSELECT_FLAGS( wParam, lParam );

    if( flags == (WORD)-1 && GET_WM_MENUSELECT_HMENU( wParam, lParam ) == (HMENU)NULL ) {
        WdeSetStatusText( NULL, "", TRUE );
    } else if( flags & (MF_SYSMENU | MF_SEPARATOR) ) {
        WdeSetStatusText( NULL, "", TRUE );
    } else if( flags & MF_POPUP ) {
        popup = (HMENU)GET_WM_MENUSELECT_ITEM( wParam, lParam );
#ifdef __NT__
        popup = GetSubMenu( (HMENU)lParam, (int)popup );
#endif
        WdeHandlePopupHint( menu, popup );
    } else {
        WdeDisplayHint( (int)GET_WM_MENUSELECT_ITEM( wParam, lParam ) );
    }
}