BeMDI SDK
left  3. Add a MDI client view your window right  5. Create some MDI views up  Tutorial Index
4. Add a MDI view menu

Now we will create a typical 'Window' menu which allows the user to stack the MDI views and tile them vertical and horizontal.

The 'Window' menu also contains a list of all MDI views inside the client area. This list is updated before the menu is displayed in the implementation of MenusBeginning().

If you allow the user to minimize MDI views you need to add a 'Window' menu. Currently this menu is the only way to restore minimized MDI views, because they don't have any other on-screen representation.

CExampleWindow::CExampleWindow(...)
{
    ....

    BMenu *windowSubMenu    = new CMDIViewMenu(client, "Window");

    windowSubMenu->AddItem(new BMenuItem("Tile vertical", 
        new BMessage(MDI_MSG_TILE_VIEWS_VERTICAL)));
    windowSubMenu->AddItem(new BMenuItem("Tile horizontal", 
        new BMessage(MDI_MSG_TILE_VIEWS_HORIZONTAL)));
    windowSubMenu->AddItem(new BMenuItem("Stack", 
        new BMessage(MDI_MSG_STACK_VIEWS)));

    menuBar->AddItem(windowSubMenu);
}

void CExampleWindow::MenusBeginning()
{
    CMDIViewMenu *windowSubMenu = 
        dynamic_cast<CMDIViewMenu *>(KeyMenuBar()->ItemAt(1)->Submenu());
        
    windowSubMenu->UpdateViewItems();
    windowSubMenu->SetTargetForItems(client);
}

  Top


© 2000 by 3rd-evolution