The HISTORY object

This object is used for dropdown listboxes, where you see only one line with the selected item and a button. When you press the button, the list is pulled down. You can use two types of t_history for now. One allows writing in text as in the textline object, and the second one is read-only.

history_init ()
     Description:
       Initializes a new history object.

     Syntax:
       p_history  history_init ( p_history o, t_rect r, p_list list, 
                                 l_int limit, l_int flags );

     Parameters:
       o           Allocated memory to store the object in.
       r           Rectangle to create the object in.
       list        List to be used in the object.
       limit       Maximum number of characters allowed if
                   the object is set to writeable.
       flags       Should be one of the following flags:

                      HF_NONE           - ZERO.
                      HF_REWRITEUNABLE  - Set to read-only.

     Returns:
       The new history object.




Example:


     p_list get_list ( void )
     {

        p_list list = list_init(malloc(sizeof(t_list)),
                                &free_listbox_item, 
                                DAT_LIST); 

        /* List's "items->rec" will be freed by "free_listbox_item()". */


        if ( list ) {

           list->insert(list, new_listbox_item("Name", 
                                               NULL,       /* No icon. */
                                               true,
                                               LIF_NONE));
           list->insert(list, new_listbox_item("New name", 
                                               NULL,       /* No icon. */
                                               true,
                                               LIF_NONE));
        };
        return list;
     };



     t_rect r = rect_assign(100, 100, 120, 200);
     p_history his = history_init(malloc(sizeof(t_history)),
                                  r, 
                                  get_list(), 
                                  100,                /* Max number of chars. */
                                  HF_REWRITEUNABLE);  /* Read-only. */

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

     r = rect_assign(100, 130, 200, 150);
     his = history_init(malloc(sizeof(t_history)),
                        r, 
                        get_list(), 
                        60,          /* Max number of chars. */
                        HF_NONE);    /* Read/writeable. */

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