Exemple #1
0
::Ice::DispatchStatus
Client::CClient::___moto(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
    __checkMode(::Ice::Normal, __current.mode);
    ::IceInternal::BasicStream* __os = __inS.os();
    ::Client::CMotoPrx __ret = moto(__current);
    __os->write(::Ice::ObjectPrx(::IceInternal::upCast(__ret.get())));
    return ::Ice::DispatchOK;
}
Exemple #2
0
/* Starts the program and prints the main menu */
int main(int qw) {
    static int mm = -1;
    mm++;
    initscr();
    curs_set(0);
    noecho();
    if(qw == 2)
        banner(4);
    else if(qw == 1)
        banner(3);
    ITEM **my_items;
    int c;
    MENU *my_menu;
    WINDOW *my_menu_win;
    int n_choices, i;
    ITEM *cur;
    /* Initialize curses */
    initscr();
    start_color();
    init_pair(5, COLOR_RED, COLOR_BLACK);
    init_pair(6, COLOR_BLACK, COLOR_RED);
    init_pair(7, COLOR_CYAN, COLOR_BLACK);
    cbreak();
    noecho();
    keypad(stdscr, TRUE);
    init_pair(1, COLOR_RED, COLOR_BLACK);
START:
    attrset(COLOR_PAIR(7));
    n_choices = ARRAY_SIZE(choices_index);
    my_items = (ITEM **)calloc(n_choices, sizeof(ITEM *));
    for(i = 0; i < n_choices; ++i) {
        my_items[i] = new_item(choices_index[i], NULL);
        if(i == 0)
            /* Set the user pointer */
            set_item_userptr(my_items[i], mains);
        else if(i == 1)
            set_item_userptr(my_items[i], race_menu);
        else if(i == 2)
            set_item_userptr(my_items[i], exitit);
    }
    my_items[n_choices] = (ITEM *)NULL;
    /* Crate menu */
    my_menu = new_menu((ITEM **)my_items);

    /* Create the window to be associated with the menu */
    my_menu_win = newwin(8, 25, 15, 70);
    keypad(my_menu_win, TRUE);

    /* Set main window and sub window */
    set_menu_win(my_menu, my_menu_win);
    set_menu_sub(my_menu, derwin(my_menu_win, 5, 19, 3, 1));

    /* Set menu mark to the string " * " */
    set_menu_mark(my_menu, "--> ");

    /* Print a border around the main window and print a title */
    box(my_menu_win, 0, 0);
    print_in_middle1(my_menu_win, 1, 0, 25, "CHOOSE A GAME", COLOR_PAIR(7));
    attrset(COLOR_PAIR(7));
    mvwaddch(my_menu_win, 2, 0, ACS_LTEE);
    mvwhline(my_menu_win, 2, 1, ACS_HLINE, 24);
    mvwaddch(my_menu_win, 2, 24, ACS_RTEE);
    mvprintw(LINES - 2, 1, " Press F1 to exit");
    /* Post the menu */
    mvprintw(LINES - 3, 1, " Press <ENTER> to see the option selected");
    mvprintw(LINES - 2, 1, " Up and Down arrow keys to navigate (F1 to Exit)");
    post_menu(my_menu);
    if(!mm)
        moto(0);
    else
        moto(1);
    refresh();

    /* Post the menu */
    post_menu(my_menu);
    wrefresh(my_menu_win);

    while((c = wgetch(my_menu_win)) != KEY_F(1))
    {   switch(c)
        {
        case KEY_DOWN:
            menu_driver(my_menu, REQ_DOWN_ITEM);
            break;
        case KEY_UP:
            menu_driver(my_menu, REQ_UP_ITEM);
            break;
        case 10:
            cur = current_item(my_menu);
            endwin();
            unpost_menu(my_menu);
            clear();
            refresh();
            void (*p)(char *);
            cur = current_item(my_menu);
            p = item_userptr(cur);
            p((char *)item_name(cur));
            pos_menu_cursor(my_menu);
            initscr();	/* Post the menu */
            attrset(COLOR_PAIR(7));
            mvprintw(LINES - 3, 1, " Press <ENTER> to see the option selected");
            mvprintw(LINES - 2, 1, " Up and Down arrow keys to naviage (F1 to Exit)");
            goto START;
            refresh();
            break;
        }
        wrefresh(my_menu_win);
    }

    /* Unpost and free all the memory taken up */
    for(i = 0; i < n_choices; ++i)
        free_item(my_items[i]);
    free_menu(my_menu);
    endwin();
    exit(1);
}