1/*
2 * Author:      William Chia-Wei Cheng (bill.cheng@acm.org)
3 *
4 * Copyright (C) 2001-2009, William Chia-Wei Cheng.
5 *
6 * This file may be distributed under the terms of the Q Public License
7 * as defined by Trolltech AS of Norway and appearing in the file
8 * LICENSE.QPL included in the packaging of this file.
9 *
10 * THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING
11 * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
12 * PURPOSE.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
13 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
14 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
15 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
16 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 *
18 * @(#)$Header: /mm2/home/cvs/bc-src/tgif/tdgtlist.e,v 1.6 2011/05/16 16:22:00 william Exp $
19 */
20
21#ifndef _TDGTLIST_E_
22#define _TDGTLIST_E_
23
24#include "tidget.h"
25
26#include "list.e"
27
28#define TDGTLIST_DEF_H_PAD 1
29#define TDGTLIST_DEF_V_PAD 1
30
31typedef struct tagListInfo {
32   char **entries; /* this is a cache, updated by TdgtListUpdateEntries() */
33   DspList *dsp_ptr;
34
35   int first_index;
36   int marked_index;
37   int num_visible_lines;
38
39   struct CheckArrayRec *p_check_array;
40
41   CVList list;
42} ListInfo;
43
44typedef struct tagTdgtList {
45   TidgetInfo *pti;
46
47   Window dsp_win, scr_win;
48   SimpleWinInfo dsp_win_info, scr_win_info;
49
50   int can_select; /* if FALSE, cannot select an item */
51   int multicolor;
52   int auto_scroll_on_insert;
53
54   int scr_area_h;
55   int scr_dir; /* temporary variable, which direction it's scrolling */
56
57   ListInfo list_info;
58} TdgtList;
59
60typedef struct tagListItemInfo {
61   char nick_name[MAXSTRING];
62   int color_index, font_style;
63   char *buf;
64} ListItemInfo;
65
66#ifdef _INCLUDE_FROM_TDGTLIST_C_
67#undef extern
68#define extern
69#endif /*_INCLUDE_FROM_TDGTLIST_C_*/
70
71extern void	TdgtListReset ARGS_DECL((TdgtList*));
72extern TdgtList	*CreateTdgtList ARGS_DECL((Window parent_win,
73				TidgetInfo *parent_tidgetinfo, int ctl_id,
74				int x, int y, int w, int h_pad, int v_pad,
75				int num_visible_lines, int can_select,
76				int multicolor, int auto_scroll_on_insert));
77
78extern int	TdgtListCleanUpEntries ARGS_DECL((TdgtList*));
79extern int	TdgtListUpdateEntries ARGS_DECL((TdgtList*));
80extern int	TdgtListScrollToBottom ARGS_DECL((TdgtList*));
81extern int	TdgtListInsertString ARGS_DECL((TdgtList*, char*));
82extern int	TdgtListInsertListItemInfo ARGS_DECL((TdgtList*,
83				ListItemInfo*));
84extern int	TdgtListSetAutoScrollOnInsert ARGS_DECL((TdgtList*, int));
85extern int	TdgtListGetAutoScrollOnInsert ARGS_DECL((TdgtList*));
86
87extern int	InitTdgtList ARGS_DECL((void));
88extern void	CleanUpTdgtList ARGS_DECL((void));
89
90#ifdef _INCLUDE_FROM_TDGTLIST_C_
91#undef extern
92#ifndef _NO_RECURSIVE_EXTERN
93#define extern extern
94#endif /* ~_NO_RECURSIVE_EXTERN */
95#endif /*_INCLUDE_FROM_TDGTLIST_C_*/
96
97#endif /*_TDGTLIST_E_*/
98