Ejemplo n.º 1
0
void WPopupMenu::attachItem( WWindow *win, int idx ) {
/****************************************************/

    gui_menu_struct     menu_item;
    unsigned long       menu_style;

    menu_item.label = (char *)text();
    menu_item.id = menuId();
    menu_style = GUI_ENABLED;
    if( checked() ) {
        menu_style |= GUI_MENU_CHECKED;
    }
    if( !enabled() ) {
        menu_style |= GUI_GRAYED;
    }
    if( _isMdiPopup ) {
        menu_style |= GUI_MDIWINDOW;
    }
    menu_item.style = (gui_menu_styles)menu_style;
    menu_item.hinttext = NULL;
    menu_item.num_child_menus = 0;
    menu_item.child = NULL;
    if( (parent()->menuId() == WMAIN_MENU_ID) ||
        parent()->isFloatingMain() ) {
        // appending popup menu to menu bar
        //      or
        // appending popup menu to top level floating popup menu
        GUIInsertMenu( win->handle(), idx, &menu_item, isFloatingPopup() );
    } else {
        // popup menu is a menu item
        GUIInsertMenuToPopup( win->handle(), parent()->menuId(), idx,
                              &menu_item, isFloatingPopup() );
    }
}
Ejemplo n.º 2
0
static void InsertMenuForWindow( gui_window *root, int index, int offset )
{
    char                name[MAX_LENGTH];
    char                label[MAX_LENGTH];
    gui_menu_struct     menu;

    MakeLabel( index, name, label );
    menu.label = label;
    menu.id = MDIWIN2ID( index );
    menu.style = GUI_ENABLED;
    if( index == CurrMDIWindow ) {
        menu.style |= GUI_CHECKED;
    }
    menu.num_child_menus = 0;
    menu.child = NULL;
    MakeHintText( index, name );
    menu.hinttext = MenuHint[index];
    if( GUIMDIMenuID != NO_SELECT ) {
        GUIInsertMenuToPopup( root, GUIMDIMenuID, offset, &menu, false );
    }
}