|
// --- 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_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_propagate.Height() // propagate
+ 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 ;
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 ) ;
}
|