Tool_Histo::Height

 

Return the vertical dimension (in pixels) of the tool. 

 

 

Syntax

 

int  Height(

          unsigned short nb=100

) ;

 

 

Parameters

 

nb

the desired height of the tool. This is exactly the value that the method will return. In other word, this method return what you gave it. It only exist for the sake of completion since all the other classes have a "Height" method.  If no argument is provide, the default is 100 pixels.

 

 

Return value

 

The vertical dimension of the tool (in pixels).

 

 

Remarks

 

This method is usually called in Ctrl_Register() to reserve the space for the tool and then again in Ctrl_Resize() to position the tool.

 

 

Requirements

 

Header:

          TomoVision_Util.hpp

          TomoVision_Tools.hpp

          Tool_work.hpp

 

Library:

          TomoVision_Util.lib

          TomoVision_Tools.lib

          SliceO_Tools.lib

 

 

Example

 

 

// --- Interface tools ---

static          Boxs          box_box ;

 

// --- for Histogram Tool ---

static          Boxs                    box_histo ;

static          Tool_Histo          tool_histo ;

 

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

//

//          Function:          Ctrl_Register

//

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

extern "C" __declspec(dllexport) int          Ctrl_Register( unsigned short *mode )

{

          ...

 

          short          Title_Dim =           (short) Fct_Variable_Value( "$INTERFACE_TITLE_DIM_BIG" ) ;

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

 

          // --- compute the height of the interface ---

          short height = Title_Dim                    // title at top of tool

                         + tool_histo.Height( 100 )          // histogram tool (100 pix high)

                         + Space_Dim ;                    // space at the bottom

 

          return( height ) ;

}

 

...

 

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

//

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

 

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

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

 

          ...

 

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

          // --- Histogram 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_histo.Height( 100 ) ;

 

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

          box_histo.Flag = OUTIL_EMPTY ;

          box_histo.Pos_X = p_x ;

          box_histo.Pos_Y = p_y ;

          box_histo.Dim_X = d_x ;

          box_histo.Dim_Y = d_y ;

          box_histo.color = box_box.color ;

          box_histo.border = Border_Dim;

          box_histo.Init( wnd ) ;

 

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

          tool_histo.Resize( &box_histo ) ;

 

          return( 1 ) ;

}

 

See also