aboutsummaryrefslogtreecommitdiff
path: root/SrcShared/Palm/Platform/Incs/Core/UI/List.h
blob: 60a6e163975b2beb5eb67149cb7d506431d8bd49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/******************************************************************************
 *
 * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
 * All rights reserved.
 *
 * File: List.h
 *
 * Description:
 *	  This file defines list structures and routines.
 *
 * History:
 *		November 3, 1994	Created by Roger Flores
 *			Name	Date		Description
 *			----	----		-----------
 *			bob	2/9/99	fixed const stuff
 *
 *****************************************************************************/

#ifndef __LIST_H__
#define __LIST_H__

#include <PalmTypes.h>
#include <CoreTraps.h>

#include <Event.h>

#define noListSelection    		-1

//-------------------------------------------------------------------
// List structures
//-------------------------------------------------------------------

typedef struct {
	UInt16 usable				:1;		// set if part of ui 
	UInt16 enabled				:1;		// set if interactable (not grayed out)
	UInt16 visible				:1;		// set if drawn
   UInt16 poppedUp			:1;     	// set if choices displayed in popup win.
	UInt16 hasScrollBar		:1;		// set if the list has a scroll bar
	UInt16 search				:1;		// set if incremental search is enabled
   UInt16 reserved			:2;
} ListAttrType;


// Load data callback routine prototype
typedef void ListDrawDataFuncType (Int16 itemNum, RectangleType *bounds, 
	Char **itemsText);
	
typedef ListDrawDataFuncType *ListDrawDataFuncPtr;


typedef struct ListType {
	UInt16					id;
   RectangleType			bounds;
   ListAttrType			attr;
   Char *					*itemsText;
   Int16						numItems;        		// number of choices in the list
   Int16 	  				currentItem;     		// currently display choice
   Int16   					topItem;         		// top item visible when poped up
   FontID           		font;						// font used to draw list
	UInt8 					reserved;
	WinHandle   			popupWin;				// used only by popup lists
   ListDrawDataFuncPtr	drawItemsCallback;	// 0 indicates no function
} ListType;

typedef ListType *ListPtr;


//-------------------------------------------------------------------
// List routines
//-------------------------------------------------------------------
#ifdef __cplusplus
extern "C" {
#endif

extern void LstDrawList (ListType *listP)
							SYS_TRAP(sysTrapLstDrawList);

extern void LstEraseList (ListType *listP)
							SYS_TRAP(sysTrapLstEraseList);

extern Int16 LstGetSelection (const ListType *listP)
							SYS_TRAP(sysTrapLstGetSelection);

extern Char * LstGetSelectionText (const ListType *listP, Int16 itemNum)
							SYS_TRAP(sysTrapLstGetSelectionText);

extern Boolean LstHandleEvent (ListType *listP, const EventType *eventP)
							SYS_TRAP(sysTrapLstHandleEvent);

extern void LstSetHeight (ListType *listP, Int16 visibleItems)
							SYS_TRAP(sysTrapLstSetHeight);

extern void LstSetPosition (ListType *listP, Coord x, Coord y)
							SYS_TRAP(sysTrapLstSetPosition);

extern void LstSetSelection (ListType *listP, Int16 itemNum)
							SYS_TRAP(sysTrapLstSetSelection);

extern void LstSetListChoices (ListType *listP, Char **itemsText, Int16 numItems)
							SYS_TRAP(sysTrapLstSetListChoices);

extern void LstSetDrawFunction (ListType *listP, ListDrawDataFuncPtr func)
							SYS_TRAP(sysTrapLstSetDrawFunction);

extern void LstSetTopItem (ListType *listP, Int16 itemNum)
							SYS_TRAP(sysTrapLstSetTopItem);

extern void LstMakeItemVisible (ListType *listP, Int16 itemNum)
							SYS_TRAP(sysTrapLstMakeItemVisible);

extern Int16 LstGetNumberOfItems (const ListType *listP)
							SYS_TRAP(sysTrapLstGetNumberOfItems);

extern Int16 LstPopupList (ListType *listP)
							SYS_TRAP(sysTrapLstPopupList);

extern Boolean LstScrollList(ListType *listP, WinDirectionType direction, Int16 itemCount)
							SYS_TRAP(sysTrapLstScrollList);

extern Int16 LstGetVisibleItems (const ListType *listP)
							SYS_TRAP(sysTrapLstGetVisibleItems);

extern Err LstNewList (void **formPP, UInt16 id, 
	Coord x, Coord y, Coord width, Coord height, 
	FontID font, Int16 visibleItems, Int16 triggerId)
							SYS_TRAP(sysTrapLstNewList);



#ifdef __cplusplus 
}
#endif

#endif // __LIST_H__