コード例 #1
0
static EVENT uicheckmove( EVENT ev, a_dialog *info )
{
    EVENT       new_ev;
    ORD         row;
    ORD         col;
    SAREA       new_area;
    VSCREEN     *vs;
    int         prev_row;
    int         prev_col;

    new_ev = ev;
    switch( ev ) {
    case EV_MOUSE_PRESS :
        if( uivmousepos( NULL, &row, &col ) == info->vs ) {
            vs = (VSCREEN *)info->vs;
            if( ( row + 1 ) == vs->area.row ) { /* because it's framed */
                PrevRow = row;
                PrevCol = col;
                info->moving = TRUE;
                new_ev = EV_NO_EVENT;
            }
        }
        break;
    case EV_MOUSE_DRAG :
        if( info->moving ) {
            uivmousepos( NULL, &row, &col );
            if( ( row != PrevRow ) || ( col != PrevCol ) ) {
                vs = (VSCREEN *)info->vs;
                if( vs->area.row + row < PrevRow ) {
                    new_area.row = 0;
                } else {
                    new_area.row = vs->area.row + row - PrevRow;
                }
                if( vs->area.col + col < PrevCol ) {
                    new_area.col = 0;
                } else {
                    new_area.col = vs->area.col + col - PrevCol;
                }
                new_area.width = vs->area.width;
                new_area.height = vs->area.height;
                prev_row = vs->area.row;
                prev_col = vs->area.col;
                uiresizedialog( info, &new_area );
                /* new_area may have been adjusted */
                PrevRow += new_area.row - prev_row;
                PrevCol += new_area.col - prev_col;
            }
            new_ev = EV_NO_EVENT;
        }
        break;
    case EV_MOUSE_RELEASE :
        if( info->moving ) {
            info->moving = FALSE;
            new_ev = EV_NO_EVENT;
        }
    }
    return( new_ev );
}
コード例 #2
0
ファイル: guixdlg.c プロジェクト: ABratovic/open-watcom-v2
bool GUIResizeDialog( gui_window *wnd, SAREA *new_area )
{
    a_dialog    *ui_dlg_info;

    ui_dlg_info = GUIGetDialog( wnd );
    if( ui_dlg_info != NULL ) {
        uiresizedialog( ui_dlg_info, new_area );
        return( true );
    }
    return( false );
}