Exemple #1
0
void wxSlider::SetValue( int value )
{
    double fpos = (double)value;
    m_oldPos = fpos;
    if ( AreSameAdjustValues(fpos, m_adjust->value) )
        return;

    m_adjust->value = fpos;

    GtkDisableEvents();

    gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );

    GtkEnableEvents();
}
Exemple #2
0
static void gtk_slider_callback( GtkAdjustment *adjust,
                                 SCROLLBAR_CBACK_ARG
                                 wxSlider *win )
{
    if (g_isIdle) wxapp_install_idle_handler();

    if (!win->m_hasVMT) return;
    if (g_blockEventsOnDrag) return;

    const double dvalue = adjust->value;
    const double diff = dvalue - win->m_oldPos;
    if ( AreSameAdjustValues(diff, 0) )
        return;

    wxEventType evtType;
    evtType = GtkScrollTypeToWx(GET_SCROLL_TYPE(win->m_widget));

    ProcessScrollEvent(win, evtType, dvalue);

    win->m_oldPos = dvalue;
}
Exemple #3
0
static void gtk_slider_callback( GtkAdjustment *adjust,
                                 SCROLLBAR_CBACK_ARG
                                 wxSlider *win )
{
    if (g_isIdle) wxapp_install_idle_handler();

    if (!win->m_hasVMT) return;
    if (g_blockEventsOnDrag) return;

    const double dvalue = adjust->value;
    const double diff = dvalue - win->m_oldPos;
    if ( AreSameAdjustValues(diff, 0) )
        return;

    wxEventType evtType;
    if ( win->m_isScrolling )
        evtType = wxEVT_SCROLL_THUMBTRACK;
    // it could seem that UP/DOWN are inversed but this is what wxMSW does
    else if ( AreSameAdjustValues(diff, adjust->step_increment) )
        evtType = wxEVT_SCROLL_LINEDOWN;
    else if ( AreSameAdjustValues(diff, -adjust->step_increment) )
        evtType = wxEVT_SCROLL_LINEUP;
    else if ( AreSameAdjustValues(diff, adjust->page_increment) )
        evtType = wxEVT_SCROLL_PAGEDOWN;
    else if ( AreSameAdjustValues(diff, -adjust->page_increment) )
        evtType = wxEVT_SCROLL_PAGEUP;
    else if ( AreSameAdjustValues(adjust->value, adjust->lower) )
        evtType = wxEVT_SCROLL_TOP;
    else if ( AreSameAdjustValues(adjust->value, adjust->upper) )
        evtType = wxEVT_SCROLL_BOTTOM;
    else
        evtType = wxEVT_NULL; // wxEVT_SCROLL_CHANGED will still be generated

    ProcessScrollEvent(win, evtType, dvalue);

    win->m_oldPos = dvalue;
}