The STATTEXT object

This object is used for formatted static text output, such as labels. You can show text on the window right by this object.


stattext_init ()
     Description:
       Creates a new stattext object. The text of the object is
       formatted in the same way as in the "printf()" function.

     Syntax:
       p_stattext stattext_init ( p_stattext o, t_rect r, l_int align,
                                  l_text format, ... );

     Parameters:
       o           Allocated memory to store the object in.
       r           Rectangle defining the bounds of the object.
       align       Alignment of the text.
       format      The formatting to use.
       ...         String (or strings) to display.

     Returns:
       The new stattext object.



stattext_init_ex ()
     Description:
       Creates a new stattext object. The text of the object is
       formatted with a list of arguments.

     Syntax:
       p_stattext stattext_init_ex ( p_stattext o, t_rect r, l_int align,
                                     l_text text, va_list argp );

     Parameters:
       o           Allocated memory to store the object in.
       r           Rectangle defining the bounds of the object.
       align       Alignment of the text.
       text        The text to display.
       argp        A list of arguments to format the text.

     Returns:
       The new stattext object.




Available alignments

Here are the alignments available for use in the stattext object:

     TX_ALIGN_LEFT     
     TX_ALIGN_TOP      
     TX_ALIGN_RIGHT    
     TX_ALIGN_BOTTOM   
     TX_ALIGN_CENTERX   - Center text horizontally.
     TX_ALIGN_CENTERY   - Center text vertically.
     TX_ALIGN_CENTER    - Center in both directions.
     TX_ALIGN_DEFAULT   - Aligns text to top-left.




Example:


     t_rect r = rect_assign(100, 100, 300, 120);

     p_stattext o = stattext_init ( malloc(sizeof(t_stattext)), 
                                    r, 
                                    TX_ALIGN_CENTERX,
                                    "Hello %s ! It's year %i", 
                                    "world", 
                                    2000); 

     OBJECT(desktop)->insert(OBJECT(desktop), OBJECT(o));