The APPWIN object

The appwin object is used for advanced application windows with buttons for close, resize etc. For simple dialog windows, without any buttons, you should use the window object instead.


window_init ()
     Description:
       Initializes a new application window.

     Syntax:
       p_appwin  window_init ( p_appwin o, t_rect r, l_text caption, 
                               l_int flags );

     Parameters:
       o           Allocated memory to store the window in.
       r           Rectangle defining the bounds of the window.
       caption     Title of the window.
       flags       One of or a combination of the available flags.

     Returns:
       The new appwin object.




appwin_init ()
     Description:
       Initializes a new application window.

     Syntax:
       p_appwin  appwin_init ( p_appwin o, t_rect r, l_text caption, 
                               l_int flags, l_hdlx id, 
                               void (*trans_ev)( p_object o, t_event *e ));

     Parameters:
       o           Allocated memory to store the window in.
       r           Rectangle defining the bounds of the window.
       caption     Title of the window.
       flags       One of or a combination of the available flags.
       id          The ap_id of the application. 
       trans_ev    The "translate_event()" function of the application.

     Returns:
       The new appwin object.




Available flags

Here are the available flags for the
window_init() and appwin_init() functions:

     0            - Default (close button only).
     WF_MAXIMIZE  - Use maximize button.
     WF_MINIMIZE  - Use minimize button.
     WF_MINSIZE   - Window is minimized.




The palette of the window


     Name:         pal_appwin 

     Description:  The color palette of the window. Get a color by using
                   "VIEW(o)->get_color(VIEW(o), #num_color);" where num_color
                   is the number of the color to retrieve. May be one of:

                             0 - Background of window.
                             1 - Active title.
                             2 - Gradient color of active title.
                             3 - Passive title.
                             4 - Gradient color to passive title.
                             5 - Active caption (text).
                             6 - Passive caption (text).




Messages sent by the appwin object

These are the messages sent by the window to the
translate_event() function when one of the buttons is pressed.

     Name:         #define   MSG_MAXIMIZE   101

     Description:  When maximize button is pressed, it sends this message 
                   to the window and the t_event.info is set to a pointer 
                   to a t_appinfo structure.



     Name:         #define   MSG_MINIMIZE   102

     Description:  Same as with maximize, but for the minimize button.



     Name:         #define   MSG_RESIZE     103

     Description:  Same as with maximize, but for the resize button.




The t_appinfo structure


     Name:         l_text    title;

     Description:  Title of the window.



     Name:         p_object  obj;

     Description:  The window structure pointer.



     Name:         l_char    reserved[48];

     Description:  Reserved for future versions.




Example:


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

     p_appwin  w = window_init (malloc(sizeof(t_window)),
                                r,
                                "Hello window", 
                                0);               /* Only show close button. */

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