The BUTTON object

- I don't know what's the definition of Button ? - It's simple BUTTON. I hope that everybody knows what's it. OK. I will explain how button works. When you make new button, you must set "message" of button. When button is pressed,it make new event with message of button. This event is send to object's hierarchy and when some object know it, it performs the task. Include "button.h" to your project when using button operations.

button_init ()
       Creates a new button.

       p_button  button_init ( p_button o, t_rect r, l_text caption, 
                               l_dword message, l_int flags );

       o           Allocated memory to store the button in.
       r           Rectangle defining the bounds of the button.
       caption     Text to be displayed on the button.
       message     Message to be sent when the button is pressed.
       flags       Button options. May be one of the following:

                     BF_NORMAL    - A normal button.
                     BF_DEFAULT   - Normal button, but when [enter] is pressed 
                                    in another object on its window, it sends the 
                                    message. In normal mode it only sends the 
                                    message if button is focused. To be used in 
                                    the same way as the OK button in a msgbox.
                     BF_PUSH      - Button can't be selected. For example the close 
                                    button of a window is set to this flag.
                     BF_DARROUND  - Button is double arrounded.
                     BF_UNDERSEL  - 

       The new button object.

The t_button structure


     Name:         t_view  obclass;

     Description:  Inherit functions from the t_view structure.

     Name:         l_int     flags;

     Description:  Flags of t_button, you will find above.

     Name:         l_text    caption;

     Description:  Caption of the button.

     Name:         l_dword   message;

     Description:  Message of the button. Message is sent whenever [enter]
                   or a mouse button is pressed in button view. This ope-
                   ration is found in "button.c" in the function
                   "button_translate_event (p_object o, p_event event)".


draw_state ()
       Draws the state of the button.

       void  (*draw_state) ( p_button o, l_int press );

       o           Button to draw.
       press       Draws a pushed button if set to true.
                   Otherwise it draws a normal button.


is_default ()
       Determines if this is the default button in the group,
       that will be activated whenever [enter] is pressed.

       l_bool  (*is_default) ( p_button o );

       o           Button to check.

       True if this is the default button. False otherwise.