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
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 #3
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 #4
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 ) );
    }
}
Beispiel #5
0
void GUIPopupMenuSelect( WPI_PARAM1 wparam, WPI_PARAM2 lparam )
{
    bool                menu_closed;
    gui_ctl_id          id;
    bool                is_hilite;
#ifdef __OS2_PM__
    WPI_MENUSTATE       mstate;
    HMENU               hmenu;
#endif

    lparam=lparam;
    id = GET_WM_MENUSELECT_ITEM( wparam, lparam );
    menu_closed = ( _wpi_is_close_menuselect( wparam, lparam ) != 0 );

#ifndef __OS2_PM__
    is_hilite = ( (GET_WM_MENUSELECT_FLAGS( wparam, lparam ) & MF_HILITE) != 0 );
#else
    hmenu = (HMENU)lparam;
    if( !menu_closed &&
        !WinSendMsg( hmenu, MM_QUERYITEM, MPFROM2SHORT(id, true),
                     MPFROMP(&mstate) ) ) {
        return;
    }
    is_hilite = ( (mstate.afAttribute & MF_HILITE) != 0 );
#endif

    if( menu_closed ) {
        CurrId = NO_SELECT;
    } else {
        if( !InitComplete ) {
            InitComplete = true;
        } else {
            if( is_hilite ) {
                CurrId = id;
            }
        }
    }
}
Beispiel #6
0
/*
 * HintMenuSelect - handle the WM_MENUSELECT message
 */
void HintMenuSelect( statwnd *wnd, HWND hwnd, WPARAM wparam, LPARAM lparam )
{
    HMENU       hmenu;
    WORD        flags;
    msg_id      msgid;

    if( MENU_CLOSED( wparam, lparam ) ) {
        updateHintText( wnd, HINT_EMPTY );
    } else {
        hmenu = GetMenu( hwnd );
        flags = GET_WM_MENUSELECT_FLAGS( wparam, lparam );
        if( flags & (MF_SYSMENU | MF_SEPARATOR) ) {
            updateHintText( wnd, HINT_EMPTY );
        } else if( flags & MF_POPUP ) {
            //
            // NYI handle popup message hints
            //
        } else {
            msgid = getItemMsg( wnd, GET_WM_MENUSELECT_ITEM( wparam, lparam ) );
            updateHintText( wnd, msgid );
        }
    }

} /* HintMenuSelect */
Beispiel #7
0
static void DisplayMenuHintText( gui_window *wnd, WPI_PARAM1 wparam,
                                 WPI_PARAM2 lparam, hint_type type )
{
    gui_window          *top_wnd;
    gui_menu_styles     style;
    gui_ctl_id          id;
    HMENU               hpopup;
    int                 menu_closed;
    int                 is_separator;
    int                 is_popup;
    int                 is_hilite;
    int                 is_enabled;
    int                 is_sysmenu;
#ifndef __OS2_PM__
    WORD                flags;
#else
    WPI_MENUSTATE       mstate;
    HMENU               hmenu;
#endif

    lparam = lparam;
    id = GET_WM_MENUSELECT_ITEM( wparam, lparam );
    menu_closed = _wpi_is_close_menuselect( wparam, lparam );

#ifndef __OS2_PM__
    flags = GET_WM_MENUSELECT_FLAGS( wparam, lparam );
    is_sysmenu = ( flags & MF_SYSMENU );
    is_separator = ( flags & MF_SEPARATOR );
    is_hilite = ( flags & MF_HILITE );
    is_popup = ( flags & MF_POPUP );
    is_enabled = ( ( flags & MF_GRAYED ) || ( flags & MF_DISABLED ) );
    hpopup = (HMENU)NULL;
    if( is_popup ) {
        hpopup = (HMENU)GET_WM_MENUSELECT_ITEM( wparam, lparam );
    }
#else
    hmenu = (HMENU) lparam;
    if( !menu_closed &&
        WinSendMsg( hmenu, MM_QUERYITEM, MPFROM2SHORT(id, true),
                    MPFROMP(&mstate) ) ) {
        is_sysmenu = ( mstate.afStyle & MF_SYSMENU );
        is_separator = false;
        is_popup = ( mstate.afStyle & MF_POPUP );
        is_hilite = ( mstate.afAttribute & MF_HILITE );
        is_enabled = ( mstate.afAttribute & MF_DISABLED );
        hpopup = (HMENU)NULL;
        if( is_popup ) {
            hpopup = mstate.hwndSubMenu;
        }
    } else {
        menu_closed = true;
    }
#endif

    if( !( menu_closed || is_separator || is_hilite ) ) {
        return;
    }

    top_wnd = GUIGetTopGUIWindow( wnd->hwnd );
    if( top_wnd == NULL ) {
        return;
    }


    if( menu_closed ) {
        style = GUI_IGNORE; /* will display blank */
    } else {
        if( is_separator ) {
            style = GUI_SEPARATOR; /* will display blank */
        } else {
            /* must be MF_HILITE */
            if( is_enabled ) {
                style = GUI_GRAYED;
            } else {
                style = GUI_ENABLED;
            }
            if( is_sysmenu ) {
                if( id > GUI_LAST_MENU_ID ) {
                    /* menu item added by GUI */
                    type = GUI_HINT;
                }
            }
            if( is_popup ) {
                if( !GetPopupId( wnd, hpopup, &id ) ) {
                    style = GUI_IGNORE; /* will display blank */
                }
            }
        }
    }

    GUIDisplayHintText( top_wnd, wnd, id, type, style );
}