home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / Includes_and_Autodocs_3.5 / include / gadgets / listbrowser.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-19  |  14.4 KB  |  501 lines

  1. #ifndef GADGETS_LISTBROWSER_H
  2. #define GADGETS_LISTBROWSER_H
  3. /*
  4. **    $VER: listbrowser.h 44.1 (19.10.1999)
  5. **    Includes Release 44.1
  6. **
  7. **  Definitions for the ListBrowser BOOPSI class
  8. **
  9. **    (C) Copyright 1987-1999 Amiga, Inc.
  10. **        All Rights Reserved
  11. */
  12.  
  13. /*****************************************************************************/
  14.  
  15. #ifndef REACTION_REACTION_H
  16. #include <reaction/reaction.h>
  17. #endif
  18.  
  19. #ifndef INTUITION_GADGETCLASS_H
  20. #include <intuition/gadgetclass.h>
  21. #endif
  22.  
  23. /*****************************************************************************/
  24.  
  25. /* LBM_ADDNODE creates a listbrowser node and inserts it to the currently
  26.  * attached list. The number of columns is automatically set according to the
  27.  * object's column number. If the node would become visible, it is automatically
  28.  * rendered. This method returns the address of the new node. (V41)
  29.  */
  30. #define LBM_ADDNODE (0x580001L)
  31.  
  32. struct lbAddNode
  33. {
  34.     ULONG MethodID;                    /* LBM_ADDNODE */
  35.     struct GadgetInfo *lba_GInfo;    /* to provide rendering info */
  36.     struct Node *lba_Node;          /* Insert() after this node */
  37.     struct TagItem *lba_NodeAttrs;    /* LBNA taglist */
  38. };
  39.  
  40.  
  41. /* LBM_REMNODE removes and frees the chosen node. If the node was visible, the
  42.  * display is updated. The method returns 1 if the operation was successful.
  43.  * (V41)
  44.  */
  45. #define LBM_REMNODE (0x580002L)
  46.  
  47. struct lbRemNode
  48. {
  49.     ULONG MethodID;                    /* LBM_REMNODE */
  50.     struct GadgetInfo *lbr_GInfo;    /* to provide rendering info */
  51.     struct Node *lbr_Node;            /* Remove() this node */
  52. };
  53.  
  54.  
  55. /* LBM_EDITNODE changes the chosen node's attributes and renders the
  56.  * changes. The method returns 1 if the operation was successful. (V41)
  57.  */
  58. #define LBM_EDITNODE (0x580003L)
  59.  
  60. struct lbEditNode
  61. {
  62.     ULONG MethodID;                    /* LBM_EDITNODE */
  63.     struct GadgetInfo *lbe_GInfo;    /* to provide rendering info */
  64.     struct Node *lbe_Node;            /* modify this node */
  65.     struct TagItem *lbe_NodeAttrs;    /* according to this taglist */
  66. };
  67.  
  68.  
  69. /* LBM_SORT
  70.  */
  71. #define LBM_SORT (0x580004L)
  72.  
  73. struct lbSort
  74. {
  75.     ULONG MethodID;                    /* LBM_SORT */
  76.     struct GadgetInfo *lbs_GInfo;    /* to provide rendering info */
  77.     ULONG lbs_Column;                /* Column to sort by */
  78.     ULONG lbs_Reverse;                /* Reverse sort */
  79.     struct Hook *lbs_CompareHook;    /* Optional hook to compare items */
  80. };
  81.  
  82.  
  83. /* LBM_SHOWCHILDREN
  84.  */
  85. #define LBM_SHOWCHILDREN (0x580005L)
  86.  
  87. struct lbShowChildren
  88. {
  89.     ULONG MethodID;                    /* LBM_SHOWCHILDREN */
  90.     struct GadgetInfo *lbsc_GInfo;    /* to provide rendering info */
  91.     struct Node *lbsc_Node;            /* Starting ParentNode, NULL means start at root. */
  92.     WORD lbsc_Depth;                /* Depth to Show */
  93. };
  94.  
  95.  
  96. /* LBM_HIDECHILDREN
  97.  */
  98. #define LBM_HIDECHILDREN (0x580006L)
  99.  
  100. struct lbHideChildren
  101. {
  102.     ULONG MethodID;                    /* LBM_HIDECHILDREN */
  103.     struct GadgetInfo *lbhc_GInfo;    /* to provide rendering info */
  104.     struct Node *lbhc_Node;            /* Starting ParentNode, NULL means start at root. */
  105.     WORD lbhc_Depth;                /* Depth to Hide */
  106. };
  107.  
  108.  
  109. /*****************************************************************************/
  110.  
  111. /* ListBrowser Node attributes.
  112.  */
  113. #define LBNA_Dummy            (TAG_USER+0x5003500)
  114.  
  115. #define    LBNA_Selected        (LBNA_Dummy+1)
  116.     /* (BOOL) If the node is to be selected.  Defaults to FALSE. */
  117.  
  118. #define    LBNA_Flags            (LBNA_Dummy+2)
  119.     /* (ULONG) Flags for the node.  Defaults to 0. */
  120.  
  121. #define    LBNA_UserData        (LBNA_Dummy+3)
  122.     /* (ULONG) User data.  Defaults to NULL. */
  123.  
  124. #define    LBNA_Column            (LBNA_Dummy+4)
  125.     /* (WORD) Column in the node that the attributes below effect.   Defaults
  126.      * to 0.*/
  127.  
  128. #define    LBNCA_Text            (LBNA_Dummy+5)
  129.     /* (STRPTR) Text to display in the column.  Defaults to NULL. */
  130.  
  131. #define    LBNCA_Integer        (LBNA_Dummy+6)
  132.     /* (LONG *) Pointer to an integer to display in the column.  Defaults to NULL. */
  133.  
  134. #define    LBNCA_FGPen            (LBNA_Dummy+7)
  135.     /* (WORD) Column foreground pen. */
  136.  
  137. #define    LBNCA_BGPen            (LBNA_Dummy+8)
  138.     /* (WORD) Column background pen. */
  139.  
  140. #define    LBNCA_Image            (LBNA_Dummy+9)
  141.     /* (struct Image *) Image to display in the column.  Defaults to NULL. */
  142.  
  143. #define    LBNCA_SelImage        (LBNA_Dummy+10)
  144.     /* (struct Image *) Image to display in column when selected.  Defaults
  145.      * to NULL. */
  146.  
  147. #define    LBNCA_HorizJustify    (LBNA_Dummy+11)
  148. #define LBNCA_Justification    LBNCA_HorizJustify
  149.     /* (ULONG) Column justification.  Defaults to LCJ_LEFT. */
  150.  
  151. #define    LBNA_Generation        (LBNA_Dummy+12)
  152.     /* Node generation.  Defaults to 0. */
  153.  
  154. #define    LBNCA_Editable        (LBNA_Dummy+13)
  155.     /* (BOOL) If this column is editable.  Requires LBNCA_CopyText. Defaults
  156.      * to FALSE. */
  157.  
  158. #define    LBNCA_MaxChars        (LBNA_Dummy+14)
  159.     /* (WORD) Maximum characters in an editable entry.  Required when using
  160.      * LBNCA_Editable. */
  161.  
  162. #define    LBNCA_CopyText        (LBNA_Dummy+15)
  163.     /* Copy the LBNCA_Text contents to an internal buffer. */
  164.  
  165. #define    LBNA_CheckBox        (LBNA_Dummy+16)
  166.     /* (BOOL) this is a checkbox node */
  167.  
  168. #define    LBNA_Checked        (LBNA_Dummy+17)
  169.     /* (BOOL) is checked if true */
  170.  
  171. #define    LBNA_NodeSize        (LBNA_Dummy+18)
  172.     /* (ULONG) size of custom node and optimzie mempool puddles */
  173.  
  174. #define    LBNCA_EditTags        (LBNA_Dummy+19)
  175.     /* (struct TagItem *) taglist sent to editable string */
  176.  
  177. #define    LBNCA_RenderHook    (LBNA_Dummy+20)
  178.     /* (struct Hook *) effectivly the same as gadtools listview hook */
  179.  
  180. #define    LBNCA_HookHeight    (LBNA_Dummy+22)
  181.     /* (WORD) height in pixels of the hook function rendering */
  182.  
  183. #define    LBNA_MemPool    (LBNA_Dummy+23)
  184.     /* (APTR) exec memory pool to use */
  185.  
  186. #define    LBNA_NumColumns    (LBNA_Dummy+24)
  187.     /* (WORD) for GetListBrowserNodeAttrs() only! */
  188.  
  189. #define    LBNA_Priority    (LBNA_Dummy+25)
  190.     /* (UBYTE) Sets the exec node->ln_Pri */
  191.  
  192. #define    LBNCA_CopyInteger    (LBNA_Dummy+26)
  193.     /* (BOOL) AllocListBrowserNodeAttrs() or SetListBrowserNodeAttrs() only! */
  194.  
  195. #define    LBNCA_WordWrap        (LBNA_Dummy+27)
  196.     /* (BOOL) WordWrap this node's LBNCA_Text data */
  197.  
  198. #define    LBNCA_VertJustify    (LBNA_Dummy+28)
  199.     /* (ULONG) Row justification.  Defaults to LRJ_BOTTOM. */
  200.  
  201.  
  202. /* Flags for the LBNA_Flags node attribute.
  203.  */
  204. #define LBFLG_READONLY 1
  205. #define LBFLG_CUSTOMPENS 2
  206. #define LBFLG_HASCHILDREN 4
  207. #define LBFLG_SHOWCHILDREN 8
  208. #define LBFLG_HIDDEN 16
  209.  
  210.  
  211. /* Justification modes for the LBNA_HorizJustify node column attribute.
  212.  */
  213. #define LCJ_LEFT 0
  214. #define LCJ_CENTER 1
  215. #define LCJ_RIGHT 2
  216.  
  217. #define LCJ_CENTRE LCJ_CENTER
  218.  
  219.  
  220. /* Justification modes for the LBNA_VertJustify node column attribute.
  221.  */
  222. #define LRJ_BOTTOM 0
  223. #define LRJ_CENTER 1
  224. #define LRJ_TOP 2
  225.  
  226. #define LRJ_CENTRE LRJ_CENTER
  227.  
  228.  
  229. /* These definitions are for the LBNCA_RenderHook tag.
  230.  */
  231.  
  232. /* The different types of messages that a listview callback hook can see.
  233.  */
  234. #define LB_DRAW 0x202L                    /* Draw yourself, with state */
  235.  
  236. /* Possible return values from a render hook.
  237.  */
  238. #define LBCB_OK 0                        /* callback understands this message type */
  239. #define LBCB_UNKNOWN 1                    /* callback does not understand this message */
  240.  
  241. /* States for LBDrawMsg.lbdm_State.
  242.  */
  243. #define LBR_NORMAL 0                    /* The usual */
  244. #define LBR_SELECTED 1                    /* For selected gadgets    */
  245.  
  246. /* Structure of LB_DRAW messages, object is a (struct Node *).
  247.  */
  248. struct LBDrawMsg
  249. {
  250.     ULONG lbdm_MethodID;                /* LV_DRAW */
  251.     struct RastPort *lbdm_RastPort;        /* Where to render to */
  252.     struct DrawInfo *lbdm_DrawInfo;        /* Useful to have around */
  253.     struct Rectangle lbdm_Bounds;        /* Limits of where to render */
  254.     ULONG lbdm_State;                    /* How to render */
  255. };
  256.  
  257.  
  258. /* Sort Hook Data Structure.
  259.  */
  260. struct LBSortMsg
  261. {
  262.     ULONG lbsm_TypeA;
  263.     union
  264.     {
  265.         LONG Integer;
  266.         STRPTR Text;
  267.     } lbsm_DataA;
  268.     APTR lbsm_UserDataA;
  269.  
  270.     ULONG lbsm_TypeB;
  271.     union
  272.     {
  273.         LONG Integer;
  274.         STRPTR Text;
  275.     } lbsm_DataB;
  276.     APTR lbsm_UserDataB;
  277. };
  278.  
  279.  
  280.  
  281. /*****************************************************************************/
  282.  
  283. /* Information for columns of the list browser.
  284.  */
  285. struct ColumnInfo
  286. {
  287.     WORD ci_Width;
  288.     STRPTR ci_Title;
  289.     ULONG ci_Flags;
  290. };
  291.  
  292. /* Possible ColumnInfo Flags
  293.  */
  294. #define CIF_WEIGHTED 0    /* weighted width column */
  295. #define CIF_FIXED 1        /* fixed pixel width column */
  296. #define CIF_DRAGGABLE 2
  297. #define CIF_NOSEPARATORS 4
  298. #define CIF_SORTABLE 8
  299.  
  300.  
  301. /*****************************************************************************/
  302.  
  303. /* Additional attributes defined by the List Browser class
  304.  */
  305. #define LISTBROWSER_Dummy            (REACTION_Dummy+0x0003000)
  306.  
  307. #define    LISTBROWSER_Top                (LISTBROWSER_Dummy+1)
  308.     /* (LONG) Top position node. Defauts to 0. */
  309.  
  310. #define    LISTBROWSER_Reserved1        (LISTBROWSER_Dummy+2)
  311.     /* RESERVED */
  312.  
  313. #define    LISTBROWSER_Labels            (LISTBROWSER_Dummy+3)
  314.     /* (struct List *) Defaults to ~0. */
  315.  
  316. #define    LISTBROWSER_Selected        (LISTBROWSER_Dummy+4)
  317.     /* (LONG) numeric index of node currently selected; Defaults to -1. */
  318.  
  319. #define    LISTBROWSER_SelectedNode    (LISTBROWSER_Dummy+5)
  320.     /* (struct Node *) node currently seleted */
  321.  
  322. #define    LISTBROWSER_MultiSelect        (LISTBROWSER_Dummy+6)
  323.     /* (BOOL) Defaults to FALSE. */
  324.  
  325. #define LISTBROWSER_VertSeparators    (LISTBROWSER_Dummy+7)
  326. #define LISTBROWSER_Separators        LISTBROWSER_VertSeparators
  327.     /* (BOOL) Render column separators. Defaults to TRUE. */
  328.  
  329. #define LISTBROWSER_ColumnInfo        (LISTBROWSER_Dummy+8)
  330.     /* (struct ColumnInfo *) Defaults to NULL. */
  331.  
  332. #define LISTBROWSER_MakeVisible        (LISTBROWSER_Dummy+9)
  333.     /* (LONG) Defaults to 0. */
  334.  
  335. #define LISTBROWSER_VirtualWidth    (LISTBROWSER_Dummy+10)
  336.     /* (WORD) Defaults to 0. */
  337.  
  338. #define LISTBROWSER_Borderless        (LISTBROWSER_Dummy+11)
  339.     /* (BOOL) Defaults to FALSE. */
  340.  
  341. #define LISTBROWSER_VerticalProp    (LISTBROWSER_Dummy+12)
  342.     /* (BOOL) Defaults to TRUE. */
  343.  
  344. #define LISTBROWSER_HorizontalProp    (LISTBROWSER_Dummy+13)
  345.     /* (BOOL) Defaults to FALSE. */
  346.  
  347. #define    LISTBROWSER_Left            (LISTBROWSER_Dummy+14)
  348.     /* (WORD) Defaults to 0. */
  349.  
  350. #define    LISTBROWSER_Reserved2        (LISTBROWSER_Dummy+15)
  351.     /* RESERVED */
  352.  
  353. #define    LISTBROWSER_AutoFit            (LISTBROWSER_Dummy+16)
  354.     /* (BOOL) Defaults to FALSE. */
  355.  
  356. #define    LISTBROWSER_ColumnTitles    (LISTBROWSER_Dummy+17)
  357.     /* (BOOL) Defaults to FALSE. */
  358.  
  359. #define    LISTBROWSER_ShowSelected    (LISTBROWSER_Dummy+18)
  360.     /* (BOOL) Defaults to FALSE. */
  361.  
  362. #define    LISTBROWSER_VPropTotal        (LISTBROWSER_Dummy+19)
  363. #define    LISTBROWSER_VPropTop        (LISTBROWSER_Dummy+20)
  364. #define    LISTBROWSER_VPropVisible    (LISTBROWSER_Dummy+21)
  365.     /* State of the vertical prop gadget (if any). */
  366.  
  367. #define    LISTBROWSER_HPropTotal        (LISTBROWSER_Dummy+22)
  368. #define    LISTBROWSER_HPropTop        (LISTBROWSER_Dummy+23)
  369. #define    LISTBROWSER_HPropVisible    (LISTBROWSER_Dummy+24)
  370.     /* State of the horizontal prop gadget (if any). */
  371.  
  372. #define    LISTBROWSER_MouseX            (LISTBROWSER_Dummy+25)
  373. #define    LISTBROWSER_MouseY            (LISTBROWSER_Dummy+26)
  374.     /* (WORD) Returns position of mouse release. */
  375.  
  376. #define    LISTBROWSER_Hierarchical    (LISTBROWSER_Dummy+27)
  377.     /* (BOOL) Enables ListTree mode. Defaults to FALSE. */
  378.  
  379. #define    LISTBROWSER_ShowImage        (LISTBROWSER_Dummy+28)
  380.     /* (struct Image *) ListTree expanded branchh custom image. Defaults to NULL. */
  381.  
  382. #define    LISTBROWSER_HideImage        (LISTBROWSER_Dummy+29)
  383.     /* (struct Image *) ListTree colapsed branch custom image. Defaults to NULL. */
  384.  
  385. #define    LISTBROWSER_LeafImage        (LISTBROWSER_Dummy+30)
  386.     /* (struct Image *) ListTree branch item custom image. Defaults to NULL. */
  387.  
  388. #define    LISTBROWSER_ScrollRaster    (LISTBROWSER_Dummy+31)
  389.     /* (BOOL) See autodocs for Intuition V37 bug.  Defaults to TRUE. */
  390.  
  391. #define    LISTBROWSER_Spacing            (LISTBROWSER_Dummy+32)
  392.     /* (WORD) Defaults to 0. */
  393.  
  394. #define    LISTBROWSER_Editable        (LISTBROWSER_Dummy+33)
  395.     /* (WORD) Defaults to FALSE. */
  396.  
  397. #define    LISTBROWSER_EditNode        (LISTBROWSER_Dummy+35)
  398.     /* (LONG) Specify a node to edit. */
  399.  
  400. #define    LISTBROWSER_EditColumn        (LISTBROWSER_Dummy+36)
  401.     /* (WORD) Specify a column to edit */
  402.  
  403. #define    LISTBROWSER_EditTags        (LISTBROWSER_Dummy+39)
  404.     /* (struct TagItem *) Taglist passed to editible node string gadget.
  405.        Defaults to NULL. */
  406.  
  407. #define    LISTBROWSER_Position        (LISTBROWSER_Dummy+34)
  408.     /* (ULONG) See possible values below. */
  409.  
  410. #define    LISTBROWSER_RelEvent        (LISTBROWSER_Dummy+37)
  411.     /* (ULONG) See possible values below. */
  412.  
  413. #define    LISTBROWSER_NumSelected        (LISTBROWSER_Dummy+38)
  414.     /* (LONG) Number of selected nodes. */
  415.  
  416. #define    LISTBROWSER_RelColumn        (LISTBROWSER_Dummy+40)
  417.     /* (WORD) Column number clicked on. */
  418.  
  419. #define    LISTBROWSER_HorizSeparators    (LISTBROWSER_Dummy+41)
  420.     /* (BOOL) Show horizontal node separators */
  421.  
  422. #define    LISTBROWSER_CheckImage        (LISTBROWSER_Dummy+42)
  423.     /* (struct Image *) Custom checkbox image, Checked state. */
  424.  
  425. #define    LISTBROWSER_UncheckedImage    (LISTBROWSER_Dummy+43)
  426.     /* (struct Image *) Custom checkbox image, UnChecked state. */
  427.  
  428. #define    LISTBROWSER_TotalNodes        (LISTBROWSER_Dummy+44)
  429.     /* (LONG) Total node count. */
  430.  
  431. #define    LISTBROWSER_MinNodeSize        (LISTBROWSER_Dummy+45)
  432.     /* (LONG) Minimum Node size for custom MemPool custom node optimization */
  433.  
  434. #define    LISTBROWSER_TitleClickable    (LISTBROWSER_Dummy+46)
  435.     /* (BOOL) Allow column-title bar clicking. */
  436.  
  437. #define    LISTBROWSER_MinVisible        (LISTBROWSER_Dummy+47)
  438.     /* (LONG) Minimum visible node count. This is a causes the
  439.      * minimum domain to be large enough to hold the specified number of
  440.      * nodes using the the estimated average node height. Note, ESTIMATED,
  441.      * this is not garanteed results. The result may be slightly more or
  442.      * less than specified, and potentially alot greater if other objects
  443.      * within the layout group cause the listbrowser to layout larger
  444.      * than its minimum domain.
  445.      */
  446.  
  447. #define    LISTBROWSER_Reserved6        (LISTBROWSER_Dummy+48)
  448.     /* RESERVED */
  449.  
  450. #define    LISTBROWSER_Reserved7        (LISTBROWSER_Dummy+49)
  451.     /* RESERVED */
  452.  
  453. #define    LISTBROWSER_PersistSelect    (LISTBROWSER_Dummy+50)
  454.     /* (LONG) When set TRUE, SHIFT key is NOT required for multi-select. */
  455.  
  456. #define    LISTBROWSER_CursorSelect    (LISTBROWSER_Dummy+51)
  457.     /* (LONG) Keyboard Cursor Selected Node Number */
  458.  
  459. #define    LISTBROWSER_CursorNode        (LISTBROWSER_Dummy+52)
  460.     /* (struct Node *) Keyboard Cursor Selected Node */
  461.  
  462. #define    LISTBROWSER_FastRender        (LISTBROWSER_Dummy+53)
  463.     /* (BOOL) Causes use of mask planes, and turns off custom pen support */
  464.     /* The improvement with deep ECS or AGA display is *HUGE*. */
  465.  
  466. #define    LISTBROWSER_TotalVisibleNodes    (LISTBROWSER_Dummy+54)
  467.     /* (LONG) Total visible node count. */
  468.  
  469. #define    LISTBROWSER_WrapText    (LISTBROWSER_Dummy+55)
  470.     /* (BOOL) Enable word wrap of text nodes */
  471.  
  472.  
  473. /* Possible values for LISTBROWSER_Position.
  474.  */
  475. #define LBP_LINEUP 1
  476. #define LBP_LINEDOWN 2
  477. #define LBP_PAGEUP 3
  478. #define LBP_PAGEDOWN 4
  479. #define LBP_TOP 5
  480. #define LBP_BOTTOM 6
  481. #define LBP_SHIFTLEFT 10
  482. #define LBP_SHIFTRIGHT 11
  483. #define LBP_LEFTEDGE 12
  484. #define LBP_RIGHTEDGE 13
  485.  
  486. /* Possible values for LISTBROWSER_RelEvent.
  487.  */
  488. #define LBRE_NORMAL 1
  489. #define LBRE_HIDECHILDREN 2
  490. #define LBRE_SHOWCHILDREN 4
  491. #define LBRE_EDIT 8
  492. #define LBRE_DOUBLECLICK 16
  493. #define LBRE_CHECKED 32
  494. #define LBRE_UNCHECKED 64
  495. #define LBRE_TITLECLICK 128
  496. #define LBRE_COLUMNADJUST 256
  497.  
  498. /*****************************************************************************/
  499.  
  500. #endif /* GADGETS_LISTBROWSER_H */
  501.