|
// ----------------------------------------------------------------------------
//
// Interface_Scroll()
//
// param: window (SliceO_Window *) The curent window
// count (int) number of whell clicks
// mouse inf (Point_2D *) mouse pos (in "Inf" coord)
//
// return: (int) 1 if this event has been used
//
// ----------------------------------------------------------------------------
int SliceO_Class::Interface_Scroll( SliceO_Window *window, int count, Point_2D *mouse_inf )
{
#ifdef TRACE_6
Error_Fct( hwnd, ERROR_CODE_TRACE_6, "in SliceO_Class::Interface_Scroll()" ) ;
#endif
VALIDITY_TEST_CLASS( this, "SliceO_Class::Interface_Scroll" ) ;
// --- if this element is not visible get out ---
if ( ! this->Flag_Get_Bit( CLASS_MODE_THIS, window, CLASS_FLAG_VISIBLE ) )
return( 0 ) ;
int a_x, a_y, d_x ;
a_x = (int) m_inside[window->Id_Get()].min_x - 2 ;
a_x += MODE_ALL_HORIZ_SPACING+1 ;
a_x += 24 ;
a_y = (int) m_inside[window->Id_Get()].min_y ;
Region_2D region_slider( COORD_INF, a_x, a_y, a_x+MODE_ALL_SLIDER_DIM_X, a_y+MODE_ALL_SLIDER_DIM_Y ) ;
// ====================================================================
// === The slider for display one and loop ===
// ====================================================================
switch( Flag_Get_Bit( CLASS_MODE_THIS, window, CLASS_MASK_DISPLAY ) ) {
case CLASS_FLAG_ONE :
// --- for display one, the slice selection slider on the right of the icon ---
if ( region_slider.Inside( mouse_inf ) ) {
int val = Child_Get_Cur(window) ;
val += count ;
val = CLIP( 0, val, Child_Get_Nb()-1 ) ;
Fct_Change_Child( window, Child_Get_Pt( val ) ) ;
return( 1 ) ;
}
break ;
case CLASS_FLAG_LOOP :
d_x = 30 ;
// --- for display one, the slice selection slider on the right of the icon ---
if ( region_slider.Inside( mouse_inf ) ) {
int val = m_fps[window->Id_Get()] ;
val += count ;
val = CLIP( 0, val, 29 ) ;
m_fps[window->Id_Get()] = (unsigned short) val + 1 ;
// --- set the timer ---
Fct_Loop_Start( window, this ) ;
// -- we need to redraw this level ---
Fct_Redraw( REDRAW_DB_OPENGL_AND_UP, window, this ) ;
return( 1 ) ;
}
break ;
}
// --- does one of the children use this event ? ---
for ( int i=0; i < m_child_nb; i++ )
if ( m_child_pt[i]->Interface_Scroll( window, count, mouse_inf ) )
return( 1 ) ;
// --- by default, we do not use this event ---
return( 0 ) ;
}
|