This method is called by sliceOmatic when the user press a keyboard key while the cursor is inside one of the 2D windows.
Syntax
int Interface_Key(
SliceO_Window * window,
int key,
Point_2D * mouse_inf
) ;
Parameters
window
Pointer to the window where the event has occurred.
key
is the key code of the activated key
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 "key" 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_Key( window, key, 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_Key.
|
// ----------------------------------------------------------------------------
//
// Interface_Key()
//
// param: window (SliceO_Window *) The curent window
// key (int) pressed key
// mouse inf (Point_2D *) mouse pos (in "Inf" coord)
//
// return: (int) 1 if this event has been used
//
// ----------------------------------------------------------------------------
int SliceO_Class::Interface_Key( SliceO_Window *window, int key, Point_2D *mouse_inf )
{
VALIDITY_TEST_CLASS( this, "SliceO_Class::Interface_Key" ) ;
// --- if this element is not visible get out ---
if ( ! this->Flag_Get_Bit( CLASS_MODE_THIS, window, CLASS_FLAG_VISIBLE ) )
return( 0 ) ;
// --- does one of the children use this event ? ---
for ( int i=0; i < m_child_nb; i++ )
if ( m_child_pt[i]->Interface_Key( window, key, mouse_inf ) )
return( 1 ) ;
// --- by default, we do not use this event ---
return( 0 ) ;
}
|
|
See also