The Tool_Tag class enable you to draw a tool that is used to select the Current TAG. Clicking on one of the TAG's buttons will select it inside the tool. The "Read()" method can then be used to return its index. Right clicking on a button will open a text interface that is used to change the TAG's label.
The variables of the Tool_Tag class are:
There is no variable associated with this class.
The methods of the Tool_Tag class are:
|
Tool_TAG( void ) ; Tool_TAG( unsigned short flag ) ;
|
Constructor. The "flag" variable is used to control the appearance of the tags depending on the "enable", "lock" or "select" flags.
The following values of "flag" are permitted:
If no value for "flag" is specified, TOOL_TAG_LOCK_AS_ENABLE is assumed.
|
||||||||||||
|
~Tool_TAG() ;
|
Destructor |
||||||||||||
|
int Read( void ) ;
|
Return the index of the currently selected TAG. You should use this method inside "Ctrl_Click" function to update one of the brush variables. if ( tool_tag.Click( up_down ) >= 0 ) { unsigned short *TAG_Cur = (unsigned short *) Fct_Variable_Get( "$TAG_CUR" ) ; if ( ! TAG_Cur ) return( 0 ) ; if ( *TAG_Cur != tool_tag.Read() ) { // --- we changed the current tag --- *TAG_Cur = tool_tag.Read() ; Fct_Update( UPDATE_CUR_TAG ) ; } return( 1 ) ; } |
The methods shared with the other SliceO_Tool classes are:
|
int Click( int up_down ) ; |
You must call this method if the user has activated a mouse button while the cursor is inside the tool |
|
void Draw( void ) ;
|
This method will draw the tool |
|
int Height( unsigned short nb=10 ) ; |
This method returns the height (in pixel) of the tool. The "nb" parameter defines how many lines of information will be displayed. |
|
int Keyboard( int key ) ; |
You must call this method if the user has activated a keyboard key while the cursor is inside the tool |
|
void Leave( void ) ;
|
You must call this method if the user move the cursor outside of the tool |
|
int Motion( int up_down ) ;
|
You must call this method if the user move the cursor inside the tool |
|
int Resize( Boxs *box ) ; |
You must call this method to resize the tool. The tool will reside inside the bounding box of the "Boxs" class. |
|
int Scroll( int val ) ; |
You must call this method if the user has activated the mouse wheel while the cursor is inside the tool |
|
void Update( UInt64 flag ) |
You must call this method when external events change the content of the tool. The "flag" parameter is the "Update Flag" defining these changes. The update should be called if one of the following flags are changed: UPDATE_ALL_TOOLS UPDATE_CUR_TAG // the current tag has changed UPDATE_COLOR_TAG // the color of a tag has changed UPDATE_TAG_LABEL // the label of a tag has changed UPDATE_TAG_ENABLE // the enable flag on a tag has changed UPDATE_TAG_LOCK // the lock flag on a tag has changed UPDATE_TAG_SELECT // the select flag on a tag has changed |
The TAGs in sliceOmatic are controlled by a number of system variables:
TAG_Max
The maximum number of TAGs that can be defined in sliceO. This variable is read only. (=256)
You can get the value of this variable with:
unsigned short TAG_Max = (unsigned short) Fct_Variable_Value( "$TAG_MAX" ) ;
TAG_Nb
The number of TAGs defined in sliceO. (default = 128)
You can get the value of this variable with:
unsigned short TAG_Nb = (unsigned short) Fct_Variable_Value( "$TAG_NB" ) ;
You can get a pointer to this variable with:
unsigned short * TAG_Nb = (unsigned short) Fct_Variable_Get( "$TAG_NB" ) ;
TAG_Cur
The currently selected TAG value.
You can get the value of this variable with:
unsigned short TAG_Cur = (unsigned short) Fct_Variable_Value( "$TAG_NB" ) ;
You can get a pointer to this variable with:
unsigned short * TAG_Cur = (unsigned short) Fct_Variable_Get( "$TAG_NB" ) ;
TAG_Red,
TAG_Grn,
TAG_Blu,
TAG_Alpha
Each of these is a vector of component colors (one per tag). The high byte is used to represent the color's component intensity (0 to 255).
You can get the value of this variable with:
unsigned short * TAG_Red = (unsigned short *) Fct_Variable_Value( "$TAG_RED" ) ;
TAG_Label
A vector of TAG labels (one per tag).
You can get the value of this variable with:
char ** TAG_Label = (char **) Fct_Variable_Value( "$TAG_LABEL" ) ;
TAG_Mix
The TAG opacity when displaying images in mode "Mix". (default = 0.5)
You can get a pointer to this variable with:
float * TAG_Mix = (float *) Fct_Variable_Get( "$TAG_MIX" ) ;
TAG_Enable
A vector of "enable" flags (one per tag).
You can get the value of this variable with:
unsigned char * TAG_Enable = (unsigned char *) Fct_Variable_Value( "$TAG_ENABLE" ) ;
TAG_Lock
A vector of "lock" flags (one per tag).
You can get the value of this variable with:
unsigned char * TAG_Lock = (unsigned char *) Fct_Variable_Value( "$TAG_LOCK" ) ;
TAG_Select
A vector of "select" flags (one per tag).
You can get the value of this variable with:
unsigned char * TAG_Select = (unsigned char *) Fct_Variable_Value( "$TAG_SELECT" ) ;
An example of the usage of the Tool_Tag class is given in the Samples\SliceO Tools\Tag_Selection demo directory.
The tool_tag_ctrl.cpp file from the Tool_Tag demo
|