SliceO_Class::Interface_Scroll

 

This method is called by sliceOmatic when the user move the mouse wheel inside one of the 2D windows.

 

 

Syntax

 

int  Interface_Scroll(

          SliceO_Window * window,

          int count,

          Point_2D * mouse_inf

) ;

 

 

Parameters

 

window

                    Pointer to the window where the event has occurred.

 

count

          Is a signed number expressing the number (and direction) of wheel "clicks".

 

mouse_inf

                    Position of the cursor in infinite space.

 

 

Return value

 

This method return "1" if it use the event.

 

 

Remarks

 

The method is responsible for calling the "Scroll" method for all its children.  The following lines must be included at the end of the method:

 

...

// --- 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 ) ;

 

// --- we did not use this click ---

return( 0 ) ;

 

Requirements

 

Header:

          sliceO_include.hpp

 

Library:

          sliceO_Structures.lib

 

 

Example

 

Default method for SliceO_Class::Interface_Scroll.

 

// ----------------------------------------------------------------------------

//

//          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 ) ;

}

 

See also