예제 #1
0
bool UIAPI uiintoplist( ui_event ui_ev )
/**************************************/
{
    if( UIData->events->num_lists > 0 )
        return( uiinlist( ui_ev, UIData->events->events[UIData->events->num_lists - 1] ) );
    return( false );
}
예제 #2
0
static EVENT td_sizeevent( void )
/*******************************/
{
    SAREA           area;

    if( !SizePending ) return (EV_NO_EVENT);
    if( !uiinlist(EV_BACKGROUND_RESIZE) ) return (EV_NO_EVENT);
    if( !setupscrnbuff(UIData->height,UIData->width) ) return (EV_NO_EVENT);
    SizePending = 0;
    area.row = 0;
    area.col = 0;
    area.height = UIData->height;
    area.width = UIData->width;
    uidirty(area);
    return (EV_BACKGROUND_RESIZE);
}
예제 #3
0
bool UIAPI uiinlists( ui_event ui_ev )
/************************************/
{
    int         index;

    // EV_KILL_UI is implicitly pushed as part of every list
    if( ui_ev == EV_KILL_UI )
        return( true );
    if( UIData->events->num_lists > 0 ) {
        for( index = UIData->events->num_lists - 1; index >= 0; --index ) {
            if( UIData->events->events[index] == NULL )
                break;
            if( uiinlist( ui_ev, UIData->events->events[index] ) ) {
                return( true );
            }
        }
    }
    return( false );
}
예제 #4
0
an_event uidialog( a_dialog *info )
{
    static EVENT    dialog_events[] = {
        'a',            'z',
        'A',            'Z',
        EV_ALT_Q,       EV_ALT_M,
        EV_NO_EVENT,
        EV_ALT_CURSOR_DOWN,
        EV_CURSOR_UP,   EV_CURSOR_DOWN,
        EV_CURSOR_LEFT, EV_CURSOR_RIGHT,
        EV_TAB_FORWARD, EV_TAB_BACKWARD,
        EV_MOUSE_PRESS, EV_MOUSE_RELEASE,
        EV_MOUSE_DRAG,  EV_MOUSE_REPEAT,
        EV_MOUSE_DCLICK,
        EV_ENTER,       ' ',
        EV_NO_EVENT
    };
    a_list      *list;
    an_event    ev;
    VFIELD      *field;

    ev = EV_NO_EVENT;
    enter_field( info, info->curr );

    while( ev == EV_NO_EVENT || !uiinlist( ev ) ) {
        field = info->curr;
        if( field != NULL ) {
            switch( field->typ ) {
                case FLD_EDIT:
                case FLD_INVISIBLE_EDIT:
                    uieditpushlist();
                    break;
                case FLD_PULLDOWN:
                    uiboxpushlist( );
                    break;
                case FLD_COMBOBOX:
                    uiboxpushlist( );
                    uieditpushlist();
                    break;
                case FLD_LISTBOX:
                case FLD_EDIT_MLE:
                    list = field->ptr;
                    uiboxpushlist();
                    break;
            }
        }
        uipushlist( dialog_events );
        ev = uidialogevent( info->vs );
        ev = uidialogcallback( info, ev );
        uipoplist( /* dialog_events */ );

        if( field != NULL ) {
            switch( field->typ ) {
            case FLD_EDIT:
            case FLD_INVISIBLE_EDIT:
                uieditpoplist();
                break;
            case FLD_PULLDOWN:
                uiboxpoplist();
                break;
            case FLD_COMBOBOX:
                uiboxpoplist();
                uieditpoplist();
                break;
            case FLD_LISTBOX:
            case FLD_EDIT_MLE:
                uiboxpoplist();
                break;
            }
        }
        ev = uiprocessdialogevent( ev, info );
    }
    /* This code will make sure to exit the current fields before returning
     * a default hot spot event. This is for consistency with windows.
     */
    if( uiisdefaulthotspot( info->fields, ev ) ) {
        if( exit_field( info, info->curr ) ) {
            info->dirty = TRUE;
        }
    }
    info->field = (VFIELD *)info->curr - (VFIELD *)info->fields;
    return( ev );
}
예제 #5
0
EVENT global uiveditevent( VSCREEN *vptr, VEDITLINE *editline, EVENT ev )
/***********************************************************************/
{
    register    int                     scroll;
    register    bool                    scrollable;
    register    bool                    growing;
    auto        VBUFFER                 buffer;


    if( editline->update ) {
        if( vptr->cursor == C_OFF ) {
            vptr->cursor = C_NORMAL;
        }
        uipadblanks( editline->buffer, editline->length );
        vptr->row = editline->row;
        scroll = min( editline->scroll, editline->index );
        scroll = max( scroll, editline->index - editline->fldlen + 1 );
        editline->scroll = scroll;
        vptr->col = editline->col + editline->index - editline->scroll;
        echoline( vptr, editline );
//      uirefresh();                    not needed for QNX or DOS ??? jimg
        editline->update = FALSE;
    }
    if( ev > EV_NO_EVENT ) {
        if( uiinlist( ev ) == FALSE ) {
            growing = uiinlist( EV_BUFFER_FULL );
            scrollable = growing || ( editline->length > editline->fldlen );
            buffer.content = editline->buffer;
            buffer.length = editline->length;
            buffer.index = editline->index;
            buffer.insert = ( vptr->cursor == C_INSERT );
            buffer.dirty = FALSE;
            buffer.auto_clear = editline->auto_clear;
            ev = uieditevent( ev, &buffer );
            editline->auto_clear = buffer.auto_clear;
            editline->dirty |= buffer.dirty;
            editline->index = buffer.index;
            vptr->cursor = buffer.insert ? C_INSERT : C_NORMAL ;
            if( scrollable ) {
                scroll = min( editline->scroll, editline->index );
                scroll = max( scroll, editline->index - editline->fldlen + 1 );
            } else {
                scroll = 0;
            }
            vptr->col = editline->col + editline->index - scroll;
            if( ( scroll != editline->scroll ) || buffer.dirty ) {
                editline->scroll = scroll;
                echoline( vptr, editline );
            }
            if( ( editline->index == editline->length ) ||
                ( *(editline->buffer + editline->length - 1) != ' ' ) ) {
                if( growing ) {
                    ev = EV_BUFFER_FULL;   /* may clobber EV_BUMP_RIGHT */
                }
            }
//            if( ev != EV_NO_EVENT && !uiinlist( ev ) ) {   /* 891206 */
//                ev = EV_NO_EVENT;
//            }
        }
    }
    return( ev );
}
예제 #6
0
void global uidisplayitem( MENUITEM *menu, DESCMENU *desc, int item, bool curr )
/******************************************************************************/
{
    bool                    active;
    ORD                     choffset;
    int                     len;
    char                    ch;
    char*                   tab_loc;
    int                     tab_len;
    ORD                     start_col;
    char*                   str;
    ATTR                    attr;
    ATTR                    chattr;
    int                     str_len;

    active = !MENUGRAYED(*menu) && uiinlist( menu->event );
    if( active ) {
        if( curr ) {
            attr = UIData->attrs[ ATTR_CURR_ACTIVE ];
            chattr = UIData->attrs[ ATTR_HOT_CURR ];
        } else {
            attr = UIData->attrs[ ATTR_ACTIVE ];
            chattr = UIData->attrs[ ATTR_HOT ];
        }
    } else {
        if( curr ) {
            attr = UIData->attrs[ ATTR_CURR_INACTIVE ];
        } else {
            attr = UIData->attrs[ ATTR_INACTIVE ];
        }
        chattr = attr;
    }
    if( item > 0 ) {
        len = desc->area.width - 2;
        str = menu->name;
        if( MENUSEPARATOR( *menu ) ) {
            ch = UiGChar[ UI_SBOX_LEFT_TACK ];
            mstring( &UIData->screen,
                     (ORD) desc->area.row + item,
                     (ORD) desc->area.col,
                     UIData->attrs[ATTR_MENU], &ch, 1 );
            mfill( &UIData->screen,
                   (ORD) desc->area.row + item,
                   (ORD) desc->area.col + 1,
                   UIData->attrs[ATTR_MENU],
                   UiGChar[ UI_SBOX_HORIZ_LINE ],
                   len, 1 );
            ch = UiGChar[ UI_SBOX_RIGHT_TACK ];
            mstring( &UIData->screen,
                     (ORD) desc->area.row + item,
                     (ORD) desc->area.col + len + 1,
                     UIData->attrs[ATTR_MENU], &ch, 1 );
        } else {
            if( len < 0 ) {
                len = 0;
            }
            choffset = ( menu->flags & ITEM_CHAR_OFFSET );
            mfill( &UIData->screen,                     /* blank line */
                   (ORD) desc->area.row + item,
                   (ORD) desc->area.col + 1,
                   attr, ' ', len, 1 );
            if( desc->flags & MENU_HAS_CHECK ) {
                start_col = desc->area.col + 1;
                len--;
            } else {
                start_col = desc->area.col;
            }
            if( menu->flags & ITEM_CHECKED ) {
                mfill( &UIData->screen,                 /* checkmark */
                       (ORD) desc->area.row + item,
                       (ORD) start_col,
                       attr, UiGChar[ UI_CHECK_MARK], 1, 1 );
            }
            if( menu->popup != NULL ) {
                mfill( &UIData->screen,                 /* > for popup */
                       (ORD) desc->area.row + item,
                       (ORD) start_col + len,
                       attr, UiGChar[ UI_POPUP_MARK], 1, 1 );
            }
            if( desc->flags & MENU_HAS_POPUP ) {
                len--;
            }
            if( str != NULL ) {
                tab_loc = strchr( str, TABCHAR );
                if( tab_loc != NULL ) {
                    tab_loc++;
                    if( tab_loc != NULL ) {
                        tab_len = strlen( tab_loc ) + 1;
                    } else {
                        tab_len = 0;
                    }
                } else {
                    tab_len = 0;
                }
                str_len = strlen( str ) - tab_len;
                if( desc->flags & MENU_HAS_TAB ) {
                    if( str_len > TAB_OFFSET( desc ) ) {
                        str_len = TAB_OFFSET( desc ) - 1;
                    }
                }
                /* text */
                mstring( &UIData->screen, (ORD) desc->area.row + item,
                         (ORD) start_col + 2, attr, str, str_len );
                if( tab_loc != NULL ) {
                    mstring( &UIData->screen,           /* tabbed text */
                             (ORD) desc->area.row + item,
                             (ORD) start_col + TAB_OFFSET( desc ) + 2,
                             attr, tab_loc, tab_len );
                }
                mstring( &UIData->screen,               /* short cut key */
                         (ORD) desc->area.row + item,
                         (ORD) start_col + choffset + 2,
                         chattr, &str[choffset], 1 );
            }
        }
    }
}