コード例 #1
0
ファイル: guimenus.c プロジェクト: Azarien/open-watcom-v2
static bool GetParentMenuPos( HMENU hmenu, HMENU popup, HMENU *parent, gui_ctl_idx *position )
{
    gui_ctl_idx num;
    gui_ctl_idx pos;
    HMENU       submenu;

    num = _wpi_getmenuitemcount( hmenu );
    for( pos = 0; pos < num; pos++ ) {
        submenu = _wpi_getsubmenu( hmenu, pos );
        if( submenu != NULLHANDLE ) {
            if( submenu == popup ) {
                if( parent != NULL ) {
                    *parent = hmenu;
                }
                if( position != NULL ) {
                    *position = pos;
                }
                return( true );
            } else {
                if( GetParentMenuPos( submenu, popup, parent, position ) ) {
                    return( true );
                }
            }
        }
    }
    return( false );
}
コード例 #2
0
ファイル: wmdisim.c プロジェクト: hubei/open-watcom
/*
 * CheckForMessage - check for a WM_COMMAND message that needs to be
 *                   sent to the maximized window
 */
static bool CheckForMessage( HMENU menu, HWND currentWindow,
                             WPI_PARAM1 wparam, WPI_PARAM2 lparam )
{
    int         num;
    int         i;
    UINT        id;
    UINT        flags;

    if( menu != NULL ) {
        num = (int)_wpi_getmenuitemcount( menu );
        for( i = 0; i < num; i++ ) {
            flags = GetMenuState( menu, i, MF_BYPOSITION );
            if( flags & MF_POPUP ) {
                if( CheckForMessage( GetSubMenu( menu, i ), currentWindow,
                                     wparam, lparam ) ) {
                    return( TRUE );
                }
            } else {
                id = GetMenuItemID( menu, i );
                if( id == wparam ) {
                    _wpi_sendmessage( currentWindow, WM_COMMAND, wparam, lparam );
                    return( TRUE );
                }
            }
        }
    }
    return( FALSE );

} /* CheckForMessage */
コード例 #3
0
ファイル: wmdisim.c プロジェクト: hubei/open-watcom
/*
 * deleteMaximizedMenuConfig - delete the maximized menu configuration
 */
static void deleteMaximizedMenuConfig( void )
{
    HMENU       root_menu;
    int         count;

    if( !insertedItems ) {
        return;
    }
    insertedItems = FALSE;
    root_menu = _wpi_getmenu( mdiInfo.root );
    _wpi_deletemenu( root_menu, 0, TRUE );
    count = (int)_wpi_getmenuitemcount( root_menu );
    _wpi_deletemenu( root_menu, count-1, TRUE );
    _wpi_drawmenubar( mdiInfo.root );

} /* deleteMaximizedMenuConfig */
コード例 #4
0
ファイル: guimenus.c プロジェクト: Azarien/open-watcom-v2
gui_ctl_idx GUIGetMenuPopupCount( gui_window *wnd, gui_ctl_id id )
{
    HMENU       hmenu, popup;
    gui_ctl_idx count;

    hmenu = GUIGetHMENU( wnd );
    if( hmenu == NULLHANDLE ) {
        return( false );
    }

    popup = GetPopupHMENU( wnd, hmenu, id, NULL, NULL, MENU_HINT );

    if( popup != NULLHANDLE ) {
        count = _wpi_getmenuitemcount( popup );
    } else {
        count = -1;
    }

    return( count );
}
コード例 #5
0
ファイル: guimenus.c プロジェクト: Azarien/open-watcom-v2
bool GUIAddToSystemMenu( gui_window *wnd, HWND hwnd, int num_menus,
                         gui_menu_struct *menu, gui_create_styles style )
{
    HMENU           system;
    gui_ctl_idx     num;

    if( !( style & GUI_SYSTEM_MENU ) ) {
        return( true );
    }
    system = _wpi_getsystemmenu( hwnd );
    if( system == NULLHANDLE ) {
        return( false );
    }
    if( GUIMDI && ( _wpi_getparent( hwnd ) != NULLHANDLE ) ) {
        num = _wpi_getmenuitemcount( system );
#ifndef __OS2_PM__
        ModifyMenu( system, num - 1, MF_STRING | MF_BYPOSITION | MF_GRAYED,
                    SC_NEXTWINDOW, LIT( NexXt ) ); // add \tCtrl+F6" );
        ModifyMenu( system, num - 3, MF_STRING | MF_BYPOSITION | MF_ENABLED,
                    SC_CLOSE, LIT( XClose ) ); // add \tctrl+f4" );
#endif
    }
    if( !( style & GUI_CLOSEABLE ) ) {
        _wpi_enablemenuitem( system, SC_CLOSE, FALSE, FALSE );
    }
    if( style & GUI_CHANGEABLE_FONT ) {
        if( _wpi_appendmenu( system, MF_SEPARATOR, 0, 0, NULLHANDLE, NULL ) ) {
            _wpi_appendmenu( system, MF_STRING, MF_ENABLED,
                             GUIHint[GUI_MENU_FONT].id, NULLHANDLE,
                             GUIHint[GUI_MENU_FONT].label );
        }
    }
    if( num_menus > 0 ) {
        if( _wpi_appendmenu( system, MF_SEPARATOR, 0, 0, NULLHANDLE, NULL ) ) {
            return( AppendMenus( wnd, system, num_menus, menu ) );
        }
    }
    return( true );
}
コード例 #6
0
ファイル: wmdisim.c プロジェクト: hubei/open-watcom
/*
 * duplicateMenu - create a duplicate copy of a menu
 */
static HMENU duplicateMenu( HMENU orig )
{
    WPI_MENUSTATE       mstate;
    int                 num;
    unsigned            menu_flags;
    unsigned            attr_flags;
    UINT                id;
    char                name[MAX_STR];
    int                 i;
    HMENU               copy;
    HMENU               sub;

    if( orig != NULLHANDLE ) {
        copy = _wpi_createpopupmenu();
        if( copy == NULLHANDLE ) {
            return( NULLHANDLE );
        }
        num = (int)_wpi_getmenuitemcount( orig );
        for( i = 0; i < num; i++ ) {
            if( _wpi_getmenustate( orig, i, &mstate, TRUE ) ) {
                _wpi_getmenuflagsfromstate( &mstate, &menu_flags, &attr_flags );
                if( _wpi_ismenuseparatorfromstate( &mstate ) ) {
                    _wpi_appendmenu( copy, menu_flags, attr_flags, 0, NULLHANDLE, NULL );
                } else if( _wpi_ismenupopupfromstate( &mstate ) ) {
                    sub = duplicateMenu( _wpi_getsubmenu( orig, i ) );
                    name[0] = 0;
                    _wpi_getmenutext( orig, i, name, MAX_STR - 1, TRUE );
                    _wpi_appendmenu( copy, menu_flags, attr_flags, 0, sub, name );
                } else {
                    id = _wpi_getmenuitemid( orig, i );
                    _wpi_getmenutext( orig, i, name, MAX_STR - 1, TRUE );
                    _wpi_appendmenu( copy, menu_flags, attr_flags, id, NULLHANDLE, name );
                }
            }
        }
    }
    return( copy );

} /* duplicateMenu */