Tool_Propagate::Set

 

Associate a "propagate" function to the tool. 

 

 

Syntax

 

int  Set(

          int (*fct)( void *source, void *target )

) ;

 

 

Parameters

 

This method does not have a parameter.

 

 

Return value

 

The vertical dimension of the tool (in pixels).

 

 

Remarks

 

This method is usually called in Ctrl_Resize() to associate a function to the "propagate" UP and DOWN buttons. The method will call the function with 2 arguments: a pointer to the "source" frame and a pointer to the "target" frame.

 

 

Requirements

 

Header:

          TomoVision_Util.hpp

          TomoVision_Tools.hpp

          Tool_work.hpp

 

Library:

          TomoVision_Util.lib

          TomoVision_Tools.lib

          SliceO_Tools.lib

 

 

Example

 

In tool_propagate_Propagate.cpp

 

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

int          Demo_Propagate( void *v_source, void *v_target )

{

          // --- make sure we can propagate ---

          SliceO_Frame *source = (SliceO_Frame *) v_source ;

          SliceO_Frame *target = (SliceO_Frame *) v_target ;

 

          Error_Fct( hwnd, ERROR_CODE_REPORT, "Propagate from %s to %s", source->Name_Get(), target->Name_Get() ) ;

 

          return( 1 ) ;

}

 

in tool_propagate_ctrl.cpp

 

// --- Interface tools ---

static          Boxs          box_box ;

 

// --- for Propagate Tool ---

static          Boxs          box_prop ;

static          Tool_Propagate          tool_propagate ;

 

// --- defined in tool_propagate_propagate.cpp ---

int          Demo_Propagate( void *v_source, void *v_target ) ;

 

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

//

//          Function:          Ctrl_Resize

//

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

extern "C" __declspec(dllexport) int          Ctrl_Resize( HWND wnd, int width, int height )

{

short          p_x, p_y, d_x, d_y ;

 

char   *          Tools_Font_Name =   (char *) Fct_Variable_Value( "$INTERFACE_TOOL_FONT_NAME" ) ;

char   *          Tools_Font_Weigth = (char *) Fct_Variable_Value( "$INTERFACE_TOOL_FONT_WEIGHT" ) ;

short          Tools_Font_Scale =  (short)  Fct_Variable_Value( "$INTERFACE_TOOL_FONT_SCALE" ) ;

 

short          Space_Dim =              (short)  Fct_Variable_Value( "$INTERFACE_SPACE_DIM" ) ;

short          Border_Dim =              (short)  Fct_Variable_Value( "$INTERFACE_BORDER_DIM" ) ;

 

          ...

 

          // ===========================================================================

          // --- Propagate Tool

          // ===========================================================================

          p_x = box_box.Pos_X + Space_Dim ;

          p_y = box_box.Pos_Y + Space_Dim ;

          d_x = box_box.Dim_X - 2*Space_Dim ;

          d_y = tool_propagate.Height() ;

 

          // --- The tool will be inside this box ---

          box_prop.Flag =  OUTIL_EMPTY ;

          box_prop.Pos_X = p_x ;

          box_prop.Pos_Y = p_y ;

          box_prop.Dim_X = d_x ;

          box_prop.Dim_Y = d_y ;

          box_prop.border   = Border_Dim ;

          box_prop.Font_Name   = Tools_Font_Name ;

          box_prop.Font_Weight = Tools_Font_Weigth ;

          box_prop.Font_Scale  = Tools_Font_Scale ;

          box_prop.color = box_box.color ;

          box_prop.Init( wnd ) ; 

 

          // --- now prepare the tool itself ---

          tool_propagate.Resize( &box_prop ) ;

 

          // --- associate a function to the propagate action ---

          tool_propagate.Set( Demo_Propagate ) ;

 

          return( 1 ) ;

}

 

See also