Category.h
. It discusses the following topics:
AppInfo
block as the storage area. An application could implement the category popup on its own without this API and use the Data Manager category routines, and /or the AppInfo
block, as it chooses.
AppInfo
block be used like this:
typedef struct {
    UInt16 renamedCategories;
    Char categoryLabels
    [dmRecNumCategories]
    [dmCategoryLength];
    UInt8 categoryUniqIDs
    [dmRecNumCategories];
    UInt8 lastUniqID;
    UInt8 padding;
} AppInfoType;
typedef AppInfoType *AppInfoPtr;
renamedCategories
| Used by CategorySetName as a bit field indicating which categories have been renamed. Usually cleared by a conduit. |
categoryLabels
| An array of strings containing the category names. |
dmRecNumCategories
| Number of categories in the list. |
dmCategoryLength
| Length of the category names. |
categoryUniqIDs
| Category IDs used for synchronization. Unique IDs generated by the device are between 0 - 127. Those from the PC are 128 - 255. |
lastUniqID
| Used for sorting and assigning unique IDs. |
  |
|
|
Constant | Value | Description |
---|---|---|
categoryHideEditCategory
| 10000 | Used as an argument to CategoryCreateList to suppress adding the "Edit Categories" item to the list. |
categoryDefaultEditCategoryString
| 10001 | Used as an argument to CategoryCreateList to show the default "Edit Categories" item in the list. |
categoryHideEditCategory
and categoryDefaultEditCategoryString
is present only if the 3.5 New Feature Set is present.
void CategoryCreateList (DmOpenRef db, ListType *listP, Uint16 currentCategory, Boolean showAll, Boolean showUneditables, UInt8 numUneditableCategories, UInt32 editingStrID, Boolean resizeList)
  |
|
Opened database containing category info. |
  |
|
A pointer to the list of category names. See ListType. |
  |
|
Category to select. |
  |
|
true to have an "All" category. |
  |
|
true to show uneditable categories. |
  |
|
The resource ID of a string to use with the "Edit Categories" list item. |
  |
|
|
  |
|
|
  |
|
|
  |
|
true to resize the list to the number of categories. Set to true for pop-ups, false otherwise. |
ListType
in listP
must be allocated outside this function. However, this function allocates some structs that are stored INSIDE the ListType
, so CategoryFreeList must be called when you are done with the list to free the memory block.
LstDrawList
or LstPopupList
. The category list is obtained from the AppInfoType structure of the database specified by the db
parameter.
showAll
parameter is true
, the "All" item is first in the list, followed by the editable categories in the database and then the categories that cannot be edited. The option to edit categories is last in the list and can be suppressed if desired. If the current selection is not in any category, it is marked "Unfiled".
categoryDefaultEditCategoryString
and categoryHideEditString
is available only if 3.5 New Feature Set is present. In earlier versions, you can suppress the Edit Categories string by passing 0 for the editingStrID
parameter, or include the item by passing categoryEditStrID
.
CategoryCreateListV10
void CategoryCreateListV10 (DmOpenRef db, ListType *lst, UInt16 currentCategory, Boolean showAll)
  |
|
Database containing categories to extract. |
  |
|
List object to load categories into. |
  |
|
Set as the current selection in the resulting list. |
  |
|
true if an "All" category should be included in the list. |
CategoryCreateList
.
NOTE:  Obsolete functions are provided ONLY for backward compatibility; for example, so a 1.0 application will work on 3.x OS releases. New code should not call these routines!
CategoryCreateList
CategorySelect
if the user chooses the Edit Category
line. (If the Edit Category line is present)
  |
|
Database containing the categories to be edited. |
  |
|
Set to the category selected when the dialog is done. |
  |
|
Title of the dialog bar. |
numUneditableCategories
parameter was added.
NOTE:  This enhancement is implemented only if 3.0 New Feature Set is present.
CategoryEditV20
,
CategoryEditV10
Boolean CategoryEdit (DmOpenRef db, UInt16 *categoryP, UInt32 titleStrID)
  |
|
Database containing the categories to be edited. |
  |
|
Set to the category selected when the dialog is done. |
  |
|
Title of the dialog bar. |
CategoryEdit
. Implemented only if 3.0 New Feature Set is present.
NOTE:  Obsolete functions are provided ONLY for backward compatibility. For example, so a 1.0 application will work on 3.x OS releases. New code should not call these routines!
CategoryEdit
,
CategoryEditV10
CategorySelect
if the user chooses the "Edit Category" line. (If the Edit Category line is present.) Boolean CategoryEditV10 (DmOpenRef db, UInt16 *categoryP)
  |
|
Database containing the categories to be edited. |
  |
|
Current category (index into the database). |
CategoryEdit
.
NOTE:  Obsolete functions are provided ONLY for backward compatibility; for example, so a 1.0 application will work on 3.x OS releases. New code should not call these routines!
CategoryEdit
,
CategoryEditV20
UIint16 CategoryFind (DmOpenRef db, const Char *name)
CategoryCreateList
.
void CategoryFreeList (DmOpenRef db, const ListType *listP, Boolean showAll, UInt32 editingStrID)
  |
|
Categories database. |
  |
|
Pointer to the category list. |
  |
|
true if the list was created with an "All" category. |
  |
|
The editingStrID should be the same as that passed to CategoryCreateList . The function will unlock the resource. |
ListType
structure.
void CategoryFreeListV10 (DmOpenRef db, const ListType *lst)
  |
|
Database containing the categories. |
  |
|
Pointer to the category list containing the memory to be freed. |
CategoryFreeList
.
NOTE:  Obsolete functions are provided ONLY for backward compatibility; for example, so a 1.0 application will work on 3.x OS releases. New code should not call these routines!
CategoryFreeList
void CategoryGetName (DmOpenRef db, UInt16 index, Char *name)
  |
|
Database that contains the categories. |
  |
|
Category index. |
  |
|
Buffer to hold category name. Buffer should be dmCategoryLength in size. |
name
buffer passed.
UInt16 CategoryGetNext (DmOpenRef db, UInt16 index)
Unfiled
as one category.
Unfiled
and empty records. That is, if a category contains no records, then its index will not be returned by this function.
void CategoryInitialize (AppInfoPtr appInfoP, UInt16 localizedAppInfoStrID)
  |
|
Application info pointer. See AppInfoType . |
  |
|
Resource ID of the localized category names. This must be a resource of the type appInfoStringsRsc . |
AppInfoType
, and to initialize category names.
Boolean CategorySelect (DmOpenRef db, const FormType *frm, UInt16 ctlID, UInt16 lstID, Boolean title, UInt16 *categoryP, char *categoryName, UInt8 numUneditableCategories, UInt32 editingStrID)
  |
|
Database that contains the categories. |
  |
|
Form that contains the category popup list. |
  |
|
ID of the popup trigger. |
  |
|
ID of the popup list. |
  |
|
Current category (pointer into db structure). |
  |
|
Name of the current category. |
  |
|
The resource ID of a string to use with the "Edit Categories" list item. |
  |
|
|
  |
|
|
  |
|
|
CategoryEdit
if the user selects the Edit Categories option in the list.
CategorySelectV10
Boolean CategorySelectV10 (DmOpenRef db, const FormType *frm, UInt16 ctlID, UInt16 lstID, Boolean title, UInt16 *categoryP, Char *categoryName)
  |
|
Database that contains the categories. |
  |
|
Form that contains the category popup list. |
  |
|
ID of the popup trigger. |
  |
|
ID of the popup list. |
  |
|
true if the popup trigger is on the title line. |
  |
|
Current category (index into db structure). |
  |
|
Name of the current category. |
CategorySelect
.
NOTE:  Obsolete functions are provided ONLY for backward compatibility; for example, so a 1.0 application will work on 3.x OS releases. New code should not call these routines!
NULL
pointer removes the category name.
void CategorySetName (DmOpenRef db, UInt16 index, const Char nameP)
  |
|
Database containing the categories to change. |
  |
|
Index of category to set. |
  |
|
A category name (null-terminated) or NULL pointer to remove the category. |
CategorySetTrigger
calls CategoryTruncateName
, with a default (system-provided) width.
void CategorySetTriggerLabel (ControlType *ctl, Char *name)
  |
|
Pointer to control object to relabel. |
  |
|
Pointer to the name of the new category. |
Ctl
points to the passed string when done. See CtlSetLabel
.
maxWidth
.
void CategoryTruncateName (Char *name, UInt16 maxWidth)
  |   |