コード例 #1
0
ファイル: guixdlg.c プロジェクト: Azarien/open-watcom-v2
EVENT GUIProcessControlNotify( EVENT ev, a_dialog *ui_dlg_info, gui_window *wnd )
{
    gui_ctl_id  id;

    switch( ev ) {
    case EV_CHECK_BOX_CLICK :
        CheckNotify( ui_dlg_info, wnd );
        return( EV_NO_EVENT );
    case EV_LIST_BOX_DCLICK :
    case EV_LIST_BOX_CHANGED :
    case EV_LIST_BOX_CLOSED :
        ListNotify( ev, ui_dlg_info, wnd );
        return( EV_NO_EVENT );
    case EV_CURSOR_UP :
        EditNotify( GUI_KEY_UP, ui_dlg_info, wnd );
        return( EV_NO_EVENT );
    case EV_CURSOR_DOWN :
        EditNotify( GUI_KEY_DOWN, ui_dlg_info, wnd );
        return( EV_NO_EVENT );
    default :
        if( IS_CTLEVENT( ev ) ) {
            id = EV2ID( ev );
            GUIEVENTWND( wnd, GUI_CONTROL_CLICKED, &id );
            return( EV_NO_EVENT );
        }
        return( ev );
    }
}
コード例 #2
0
ファイル: guixloop.c プロジェクト: bhanug/open-watcom-v2
static void ProcessInitPopupEvent( void )
{
    MENUITEM    menu;
    gui_ctl_id  id;

    if( uigetcurrentmenu ( &menu ) ) {
        id = EV2ID( menu.event );
        if( id != 0 ) {
            GUIEVENTWND( GUICurrWnd, GUI_INITMENUPOPUP, &id );
        }
    }
}
コード例 #3
0
ファイル: guifloat.c プロジェクト: bhanug/open-watcom-v2
void GUIProcessMenuCurr( MENUITEM *menu )
{
    gui_window          *top_wnd;
    gui_ctl_id          id;
    gui_window          *menu_wnd;
    gui_menu_styles     style;
    hint_type           type;

    id = 0;
    if( ( menu == NULL ) || ( menu->event == EV_NO_EVENT ) ) {
        style = GUI_IGNORE;
    } else {
        if( menu->flags & ITEM_SEPARATOR ) {
            style = GUI_SEPARATOR;
        } else {
            if( IS_CTLEVENT( menu->event ) ) {
                id = EV2ID( menu->event );
                if( menu->flags & ITEM_GRAYED ) {
                    style = GUI_GRAYED;
                } else {
                    style = GUI_ENABLED;
                }
            } else {
                style = GUI_IGNORE;
            }
        }
    }
    type = MENU_HINT;
    top_wnd = GUIGetMenuWindow();
    menu_wnd = NULL;
    switch( MenuState ) {
    case MENU_NONE :
        menu_wnd = top_wnd;
        if( top_wnd != NULL && GUIHasToolBar( top_wnd ) && GUIToolBarFixed( top_wnd ) ) {
            if( GUIHasHintText( menu_wnd, id, TOOL_HINT ) ) {
                type = TOOL_HINT;
            }
        }
        break;
    case MENU_FLOAT :
        type = FLOAT_HINT;
    case MENU_SYS :
        menu_wnd = MenuWnd;
    }
    if( ( top_wnd != NULL ) && ( menu_wnd != NULL ) ) {
        GUIDisplayHintText( top_wnd, menu_wnd, id, type, style );
    }
}
コード例 #4
0
ファイル: guitool.c プロジェクト: lycaner/open-watcom-v2
bool ToolbarCallBack( gui_window *wnd, gui_event gui_ev, void *param )
{
    gui_ctl_id  id;

    switch( gui_ev ) {
    case GUI_INIT_WINDOW :
        GUIEVENTWND( wnd->parent, GUI_TOOLBAR_FLOATING, NULL );
        return( true );
    case GUI_KEYDOWN :
    case GUI_KEYUP :
        GUIEVENTWND( wnd->parent, gui_ev, param );
        break;
    case GUI_CLICKED :
        GUI_GETID( param, id );
        if( id == FIX_TOOLBAR ) {
            FixToolbar( wnd );
        }
        break;
    case GUI_CONTROL_CLICKED :
        GUI_GETID( param, id );
        id = EV2ID( id );
        GUIEVENTWND( wnd->parent, GUI_CLICKED, &id );
        break;
    case GUI_LBUTTONDBLCLK :
        FixToolbar( wnd );
        break;
    case GUI_DESTROY :
        /* didn't get close first */
        if( wnd->parent->tbinfo->floattoolbar != NULL ) {
            wnd->parent->tbinfo->floattoolbar = NULL;
        }
        GUICloseToolBar( wnd->parent );
        break;
    case GUI_CLOSE :
        wnd->parent->tbinfo->floattoolbar = NULL;
        break;
    default :
        break;
    }
    return( true );
}
コード例 #5
0
ファイル: guifloat.c プロジェクト: bhanug/open-watcom-v2
EVENT GUICreateMenuPopup( gui_window *wnd, gui_point *location,
                          MENUITEM *menu, gui_mouse_track track,
                          gui_ctl_id *curr_id )
{
    EVENT       ev;
    gui_ctl_id  id;
    ATTR        attr_active;
    ATTR        attr_hot;
    ATTR        attr_curr_active;
    ATTR        attr_hot_curr;
    ATTR        attr_inactive;
    ATTR        attr_curr_inactive;
    ATTR        attr_menu;
    gui_window  *top;
    SAREA       area;
    DESCMENU    desc;

    MenuWnd = wnd;
    if( MenuState == MENU_NONE ) {
        MenuState = MENU_SYS;
    }
    if( menu == NULL ) {
        return( EV_NO_EVENT );
    }
    attr_active         = UIData->attrs[ATTR_ACTIVE];
    attr_hot            = UIData->attrs[ATTR_HOT];
    attr_curr_active    = UIData->attrs[ATTR_CURR_ACTIVE];
    attr_hot_curr       = UIData->attrs[ATTR_HOT_CURR];
    attr_inactive       = UIData->attrs[ATTR_INACTIVE];
    attr_curr_inactive  = UIData->attrs[ATTR_CURR_INACTIVE];
    attr_menu           = UIData->attrs[ATTR_MENU];

    UIData->attrs[ATTR_ACTIVE]          = wnd->colours[GUI_MENU_PLAIN];
    UIData->attrs[ATTR_HOT]             = wnd->colours[GUI_MENU_STANDOUT];
    UIData->attrs[ATTR_CURR_ACTIVE]     = wnd->colours[GUI_MENU_ACTIVE];
    UIData->attrs[ATTR_HOT_CURR]        = wnd->colours[GUI_MENU_ACTIVE_STANDOUT];
    UIData->attrs[ATTR_INACTIVE]        = wnd->colours[GUI_MENU_GRAYED];
    UIData->attrs[ATTR_CURR_INACTIVE]   = wnd->colours[GUI_MENU_GRAYED_ACTIVE];
    UIData->attrs[ATTR_MENU]            = wnd->colours[GUI_MENU_FRAME];

    ev = 0;
    if( ( curr_id != NULL ) && ( *curr_id != 0 ) ) {
        ev = ID2EV( *curr_id );
    }
    top = GUIGetTopWnd( wnd );
    COPYAREA( top->use, area );
    area.row += top->screen.area.row;
    area.col += top->screen.area.col;

    if( !uiposfloatingpopup( menu, &desc, wnd->screen.area.row + location->y,
                            wnd->screen.area.col + location->x, &area, NULL ) ) {
        return( EV_NO_EVENT );
    }
    ev = uicreatepopupinarea( menu, &desc, track & GUI_TRACK_LEFT,
                              track & GUI_TRACK_RIGHT, ev, &area, false );

    if( ev == EV_KILL_UI ) {
        uiforceevadd( EV_KILL_UI );
        ev = EV_NO_EVENT;
    }

    GUIProcessMenuCurr( NULL );

    UIData->attrs[ATTR_ACTIVE]          = attr_active;
    UIData->attrs[ATTR_HOT]             = attr_hot;
    UIData->attrs[ATTR_CURR_ACTIVE]     = attr_curr_active;
    UIData->attrs[ATTR_HOT_CURR]        = attr_hot_curr;
    UIData->attrs[ATTR_INACTIVE]        = attr_inactive;
    UIData->attrs[ATTR_CURR_INACTIVE]   = attr_curr_inactive;
    UIData->attrs[ATTR_MENU]            = attr_menu;

    if( ( ev != EV_MOUSE_DCLICK ) && ( ev != EV_NO_EVENT ) ) {
        if( IS_CTLEVENT( ev ) ) {
            id = EV2ID( ev );
            GUIEVENTWND( wnd, GUI_CLICKED, &id );
            if( curr_id != NULL ) {
                *curr_id = id;
            }
        } else {
            GUIProcessSysMenuEvent( ev, wnd );
        }
    }
    if( MenuState == MENU_SYS ) {
        MenuState = MENU_NONE;
    }
    MenuWnd = NULL;

    return( ev );
}
コード例 #6
0
ファイル: guixloop.c プロジェクト: bhanug/open-watcom-v2
bool GUIProcessEvent( EVENT ev )
{
    gui_event   gui_ev;
    ORD         row, col;
    gui_window  *wnd;
    int         prev;
    int         diff;
    gui_ctl_id  id;
    gui_window  *menu_window;
    bool        new_curr_wnd;
    VSCREEN     *screen;

    // this is processed before all others and signals the end for all
    // GUI UI windows ( unconditional )
    if( ev == EV_KILL_UI ) {
        GUIDestroyWnd( NULL );
        return( false );
    }

    ev = MapMiddleToRight( ev );
    ev = CheckPrevEvent( ev );
    wnd = NULL;
    if( uimouseinstalled() ) {
        screen = uivmousepos( NULL, &row, &col );
        if( screen != NULL && (screen->flags & V_GUI_WINDOW) != 0 ) {
            wnd = (gui_window *)((char *)screen - offsetof( gui_window, screen ));
        }
    }
    if( GUIDoKeyboardMoveResize( ev ) ) {
        return( true );
    }
    if( MouseState == MOUSE_MOVE || MouseState == MOUSE_SIZE ) {
        if( GUIDoMoveResizeCheck( GUIMouseWnd, ev, row, col ) ) {
            MouseState = MOUSE_FREE;
            return( true );
        }
        if( GUI_WND_MINIMIZED( GUIMouseWnd ) ) {
            switch( ev ) {
            case EV_MOUSE_DCLICK :
            case EV_MOUSE_RELEASE :
            case EV_MOUSE_DRAG :
                ProcessMinimizedMouseEvent( ev, row, col );
            }
        } else {
            switch( ev ) {
            case EV_MOUSE_RELEASE :
            case EV_MOUSE_DRAG :
            case EV_MOUSE_DRAG_R :
                ProcessMouseReleaseDrag( ev, GUI_LBUTTONUP, row, col );
            }
        }
        return( true );
    }
    new_curr_wnd = SetCurrWnd( ev, wnd );
    if( GUIProcessAltMenuEvent( ev ) ) {
        return( true );
    }
    /* Only deal with press and dclick events for minimized windows.
     * All other non-menu events are ingored.
     */
    if( !IS_CTLEVENT( ev ) && ( GUICurrWnd != NULL ) && GUI_WND_MINIMIZED( GUICurrWnd ) ) {
        /* ignore event if mouse not in minimized current window */
        if( GUICurrWnd == wnd ) {
            switch( ev ) {
            case EV_MOUSE_PRESS :
            case EV_MOUSE_DCLICK :
            case EV_MOUSE_RELEASE :
                GUIMouseWnd = GUICurrWnd;
                ProcessMinimizedMouseEvent( ev, row, col );
                break;
            }
        }
        return( true );
    }
    if( !IS_CTLEVENT( ev ) && ( GUICurrWnd != NULL ) && GUIIsOpen( GUICurrWnd ) ) {
        /* see if any of the controls in the window consume the event */
        ev = GUIProcessControlEvent( GUICurrWnd, ev, row, col );
        /* See if the event is for on of the scroll bars. */
        /* Diff and prev are used if the event return is  */
        /* EV_SCROLL_HORIZONTAL or EV_SCROLL_VERTICAL.    */
        if( !new_curr_wnd || ( GUIGetWindowStyles() & ( GUI_INACT_GADGETS+GUI_INACT_SAME ) ) ) {
            ev = GUIGadgetFilter( GUICurrWnd, ev, &prev, &diff );
        }
        if( ev == EV_NO_EVENT ) {
            return( true );
        }
    }
    gui_ev = GUI_NO_EVENT;
    ev = GUIMapKeys( ev );
    switch( ev ) {
    case EV_MOUSE_DCLICK_R :
        ProcessMousePos( GUI_RBUTTONDBLCLK, row, col, wnd );
        return( true );
        break;
    case EV_MOUSE_RELEASE_R :
        ProcessMouseReleaseDrag( ev, GUI_RBUTTONUP, row, col );
        return( true );
        break;
    case EV_MOUSE_DRAG_R :
        if( GUICurrWnd != GUIMouseWnd ) {
            /* got drag without press first */
            ProcessMousePress( EV_MOUSE_PRESS_R, GUI_LBUTTONDOWN, row, col,
                               new_curr_wnd );
        }
    case EV_MOUSE_MOVE :
        ProcessMousePos( GUI_MOUSEMOVE, row, col, wnd );
        return( true );
        break;
    case EV_MOUSE_RELEASE :
        ProcessMouseReleaseDrag( ev, GUI_LBUTTONUP, row, col );
        return( true );
        break;
    case EV_MOUSE_DRAG :
        if( GUICurrWnd != GUIMouseWnd ) {
            /* got drag without press first */
            ProcessMousePress( EV_MOUSE_PRESS, GUI_LBUTTONDOWN, row, col,
                               new_curr_wnd );
        }
        ProcessMouseReleaseDrag( ev, GUI_MOUSEMOVE, row, col );
        return( true );
        break;
    case EV_MOUSE_PRESS_R :
        ProcessMousePress( ev, GUI_RBUTTONDOWN, row, col, new_curr_wnd );
        return( true );
        break;
    case EV_MOUSE_PRESS :
        ProcessMousePress( ev, GUI_LBUTTONDOWN, row, col, new_curr_wnd );
        return( true );
        break;
    case EV_MOUSE_DCLICK :
        ProcessMousePress( ev, GUI_LBUTTONDBLCLK, row, col, new_curr_wnd );
        return( true );
        break;
    case EV_NO_EVENT :
        gui_ev = GUI_NO_EVENT;
        break;
    case EV_SCROLL_UP :
    case EV_SCROLL_DOWN :
    case EV_SCROLL_PAGE_UP :
    case EV_SCROLL_PAGE_DOWN :
    case EV_SCROLL_LEFT :
    case EV_SCROLL_RIGHT :
    case EV_SCROLL_LEFT_PAGE :
    case EV_SCROLL_RIGHT_PAGE :
        if( GUICurrWnd != NULL ) {
            ProcessScrollEvent( ev );
            return( true );
        }
        break;
    case EV_SCROLL_VERTICAL :
        if( GUI_VSCROLL_EVENTS_SET( GUICurrWnd ) ) {
            DoScrollDrag( GUICurrWnd->vgadget, prev, diff );
        } else {
            GUIWholeWndDirty( GUICurrWnd );
        }
        return( true );
        break;
    case EV_SCROLL_HORIZONTAL :
        if( GUI_HSCROLL_EVENTS_SET( GUICurrWnd ) ) {
            DoScrollDrag( GUICurrWnd->hgadget, prev, diff );
        } else {
            GUIWholeWndDirty( GUICurrWnd );
        }
        return( true );
        break;
    case EV_MENU_INITPOPUP :
        ProcessInitPopupEvent();
        return( true );
        break;
#if 0
    case EV_BACKGROUND_RESIZE :
        {
            gui_window          *root;
            root = GUIGetRootWindow();
            if( root != NULL ) {
                GUIZoomWnd( root, GUI_NONE );
            }
        }
        return( true );
        break;
#endif
    default :
        if( IS_CTLEVENT( ev ) ) {
            if( !GUIMDIProcessEvent( ev ) ) {
                menu_window = GUIGetMenuWindow();
                if( menu_window != NULL ) {
                    id = EV2ID( ev );
                    GUIEVENTWND( menu_window, GUI_CLICKED, &id );
                }
            }
            return( true );
        }
        break;
    }
    if( ( GUICurrWnd != NULL ) && (gui_ev != GUI_NO_EVENT ) ) {
        GUIEVENTWND( GUICurrWnd, gui_ev, NULL );
    }
    return( true );
}