コード例 #1
0
ファイル: guimdi.c プロジェクト: NoSuchProcess/open-watcom-v2
void InitMDI( gui_window *wnd, gui_create_info *dlg_info )
{
    gui_window  *root;

    root = GUIGetRootWindow();
    AddMenu( wnd, dlg_info->parent, dlg_info->num_menus, dlg_info->menu );
    if( GUIXInitMDI( wnd ) ) {
        if( dlg_info->parent && ( GUIGetParentWindow( dlg_info->parent ) != NULL ) ) {
            return;
        }
        if( CurrMDIWindow != -1 ) {
            GUICheckMenuItem( root, MDIWIN2ID( CurrMDIWindow ), false, false );
        }
        NumMDIWindows++;
        if( NumMDIWindows == 1 ) {
            EnableMDIMenus( root, true );
        }
        CurrMDIWindow = NumMDIWindows - 1;
        if( NumMDIWindows > MAX_NUM_MDI_WINDOWS ) {
            if( NumMDIWindows == MAX_NUM_MDI_WINDOWS + 1 ) {
                if( GUIMDIMenuID != NO_SELECT ) {
                    MDIMoreMenu[0].label = LIT( XMore_Windows );
                    MDIMoreMenu[0].hinttext = LIT( More_Windows_Hint );
                    GUIAppendMenuToPopup( root, GUIMDIMenuID, MDIMoreMenu, false );
                }
            }
        } else {
            MDIWindows[CurrMDIWindow] = wnd;
            InsertMenuForWindow( root, CurrMDIWindow, -1 );
        }
    } else if( Root == NULL ) {
        Root = wnd;
    }
}
コード例 #2
0
ファイル: guimdi.c プロジェクト: NoSuchProcess/open-watcom-v2
void AddMDIActions( bool has_items, gui_window *wnd )
{
    int         i;

    if( !MDIMenuStructInitialized ) {
        InitMDIMenuStruct();
        MDIMenuStructInitialized = true;
    }

    if( has_items ) {
        GUIAppendMenuToPopup( wnd, GUIMDIMenuID, MDIFirstSepMenu, false );
    }

    for( i = 0; i < NUM_MDI_MENUS; i++ ) {
        GUIAppendMenuToPopup( wnd, GUIMDIMenuID, &MDIMenu[i], false );
    }
}
コード例 #3
0
ファイル: guimdi.c プロジェクト: NoSuchProcess/open-watcom-v2
static void EnableMDIMenus( gui_window *root, bool enable )
{
    GUIEnableMDIActions( enable );
    if( enable ) {
        if( GUIMDIMenuID != NO_SELECT && GUIGetMenuPopupCount( root, GUIMDIMenuID ) != 0 ){
            GUIAppendMenuToPopup( root, GUIMDIMenuID, MDISecondSepMenu, false );
        }
    } else {
        GUIDeleteMenuItem( root, GUI_MDI_SECOND_SEPARATOR, false );
    }
}
コード例 #4
0
ファイル: guimdi.c プロジェクト: NoSuchProcess/open-watcom-v2
void MDIResetMenus( gui_window *wnd, gui_window *parent, int num_menus, gui_menu_struct *menu )
{
    gui_window  *root;
    int         i;
    int         max_num;

    if( !AddMenu( wnd, parent, num_menus, menu ) ) {
        return;
    }
    root = GUIGetRootWindow();
    max_num = NumMDIWindows;
    if( NumMDIWindows > MAX_NUM_MDI_WINDOWS ) {
        max_num = MAX_NUM_MDI_WINDOWS;
    }
    for( i = 0; i < max_num; i++ ) {
        InsertMenuForWindow( root, i, -1 );
    }
    if( NumMDIWindows > MAX_NUM_MDI_WINDOWS ) {
        MDIMoreMenu[0].label = LIT( XMore_Windows );
        MDIMoreMenu[0].hinttext = LIT( More_Windows_Hint );
        GUIAppendMenuToPopup( root, GUIMDIMenuID, MDIMoreMenu, false );
    }
}
コード例 #5
0
ファイル: wndpop.c プロジェクト: Ukusbobra/open-watcom-v2
extern  void    WndAddPopupMenu( a_window *wnd )
{
    int                 i,j;
    gui_menu_struct     *curr,*sub;
    int                 max;

    if( WndMain == NULL ) return;
    curr = WndMainMenuPtr;
    max = CalcMaxId( WndMainMenuPtr, WndNumMenus );
    for( i = 0; i < WndNumMenus; ++i ) {
        if( curr->style & WND_MENU_POPUP ) {
            sub = curr->child;
            for( j = 0; j < curr->num_child_menus; ++j ) {
                GUIDeleteMenuItem( WndMain->gui, sub->id, FALSE );
                ++sub;
            }
            if( wnd->popupmenu == NULL ) {
                curr->num_child_menus = 0;
                curr->child = NULL;
            } else {
                curr->num_child_menus = wnd->num_popups;
                curr->child = wnd->popupmenu;
            }
            WndPopupMenuPtr = curr;
            sub = curr->child;
            for( j = 0; j < curr->num_child_menus; ++j ) {
                if( ( sub->style & GUI_SEPARATOR ) && ( sub->id == 0 ) ) {
                    sub->id = ++max;
                }
                GUIAppendMenuToPopup( WndMain->gui, curr->id, sub, FALSE );
                ++sub;
            }
            break;
        }
        ++curr;
    }
}