1 /* Monolith display table class.
2 * - by Richard W.M. Jones <rich@annexia.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the Free
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 * $Id: ml_display_table.h,v 1.1 2003/02/13 16:12:35 rich Exp $
21 #ifndef ML_DISPLAY_TABLE_H
22 #define ML_DISPLAY_TABLE_H
28 struct ml_display_table;
29 typedef struct ml_display_table *ml_display_table;
31 /* Function: new_ml_display_table - monolith display table widget
32 * Function: ml_display_table_set_row_repaint
33 * Function: ml_display_table_set_add_callback
34 * Function: ml_display_table_set_edit_callback
35 * Function: ml_display_table_set_delete_callback
37 * @code{ml_display_table} is a highly configurable widget allowing
38 * lists of items or tables to be displayed and edited. A display
39 * table shows a list of items, with Edit, Delete and Add buttons
40 * below, allowing the user to edit, delete or add rows.
42 * The underlying data model is a c2lib @code{vector}. Display table
43 * doesn't care what the vector contains (although it does sometimes
44 * pull out pointers to rows in the vector to pass to various callback
47 * To create a display table, you need to do several things:
49 * - Write a row repaint function. This is called to display each row.
51 * - Write an action function for 'Edit'. This is called when the user
52 * tries to edit a row, and usually displays a form in a new window.
54 * - (Optional) Write an action function for 'Delete'.
56 * - Write an 'Add row' widget (explained below).
58 * You then call @code{new_ml_display_table} to create the overall
59 * table. Then call @code{ml_display_table_set_row_repaint},
60 * @code{ml_display_table_set_add_callback},
61 * @code{ml_display_table_set_edit_callback} and optionally
62 * @code{ml_display_table_set_delete_callback} to set each
65 * @code{new_ml_display_table} takes usual pool and session arguments.
66 * It takes a @code{vector dm} which is the data model (ie. list of rows).
67 * The type of elements of the vector is not important to the display
70 * Bugs: The current display table does not support the following
71 * desirable features. These may be added in future releases.
77 * Extra action buttons.
79 * Add functions which open a new window.
81 extern ml_display_table new_ml_display_table (pool pool, ml_session session, vector dm);
82 extern ml_display_table ml_display_table_set_row_repaint (ml_display_table, );
83 extern ml_display_table ml_display_table_set_add_callback (...);
84 extern ml_display_table ml_display_table_set_edit_callback (...);
85 extern ml_display_table ml_display_table_set_delete_callback (...);
87 #endif /* ML_DISPLAY_TABLE */