home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / msysjour / vol05 / 03 / vlb / vlb.com / VLB.H < prev    next >
Text File  |  1990-04-23  |  5KB  |  104 lines

  1. /*
  2. **  VLB.H     Virtual List Box header file
  3. **
  4. **     Author: Robert A. Wood
  5. **             Executive Micro Systems
  6. **             1716 Azurite Trail
  7. **             Plano, TX 75075
  8. **
  9. **    Date: 03/19/90
  10. */
  11.  
  12. #define VLB_CALLBACK  lpVLB->CallBack
  13. #define VLBSTRLEN     255     // maximum virtual string length
  14. typedef LONG (FAR PASCAL * VLBPROC)( WORD, WORD, LONG FAR *, LPSTR );
  15.  
  16. //  VCB   Virtual CallBack function Messages
  17. //*******************************************************************
  18. #define VCB_CREATE      1   // listbox has just been created
  19. #define VCB_DESTROY     2   // listbox is to be destroyed
  20. #define VCB_SETFOCUS    3   // listbox has received focus
  21. #define VCB_KILLFOCUS   4   // listbox is to lose focus
  22. #define VCB_LENGTH      5   // request for total strings
  23. #define VCB_WIDTH       6   // request for vitual width
  24. #define VCB_FULLSTRING  7   // get the full string specified
  25. #define VCB_STRING      8   // get string specify by StringId
  26. #define VCB_VTHUMB      9   // get string specify by thumb
  27. #define VCB_SEARCH      10  // get string for search criteria
  28. #define VCB_FIRST       11  // get the first string
  29. #define VCB_LAST        12  // get the last string
  30. #define VCB_NEXT        13  // get the next string
  31. #define VCB_PREV        14  // get the previous string
  32. #define VCB_HTHUMB      15  // move str start specify thumb
  33. #define VCB_LEFT        16  // move str start left one char
  34. #define VCB_RIGHT       17  // move str start right one char
  35. #define VCB_PAGELEFT    18  // move str start left one col
  36. #define VCB_PAGERIGHT   19  // move str start right one col
  37.  
  38. //  VLB Messages Sent to the VLB Procedure
  39. //*******************************************************************
  40. #define VLB_GETCOUNT     WM_USER+1   // get total virtual strings
  41. #define VLB_GETSELCOUNT  WM_USER+2   // get total selected strings
  42. #define VLB_GETSTRLEN    WM_USER+3   // get total string length 
  43. #define VLB_GETSELSTR    WM_USER+4   // get the select String
  44. #define VLB_GETSELID     WM_USER+5   // get the select StringId(s)
  45. #define VLB_SETCURSEL    WM_USER+6   // selects the specify StringId
  46. #define VLB_SETSEL       WM_USER+7   // sets selection of a StringId
  47. #define VLB_RELOAD       WM_USER+8   // reload curr. display strings
  48.  
  49. // VLB_RELOAD wParam options
  50. //*******************************************************************
  51. #define RELOAD_STRINGS   0
  52. #define RELOAD_STRINGPOS 1
  53. #define RELOAD_STRINGID  2
  54.  
  55. // Notifications Sent to the VLB Parent by the VLB Procedure
  56. //*******************************************************************
  57. #define VLBN_DBLCLK     LBN_DBLCLK    // double clicked on a string
  58. #define VLBN_ERRSPACE   LBN_ERRSPACE  // can't allocate memory
  59. #define VLBN_SELCHANGE  LBN_SELCHANGE // selected string changed
  60.  
  61. // VLB Control Information
  62. //*******************************************************************
  63. typedef struct
  64. {
  65.    WORD ListBoxId;             // list box control id
  66.    BOOL MultiSelection;        // Single or Multi selection
  67.    RECT ClientRect;            // client area rectangle
  68.    WORD CharWidth;             // character width
  69.    WORD CharHeight;            // character height
  70.    BYTE DisplayStrings;        // max number of displayed strings
  71.    BYTE DisplayChars;          // max characters in displayed strings
  72.    LONG FocusString;           // string position of focus frame
  73.    LONG TotalStrings;          // number of virtual strings
  74.    LONG TotalWidth;            // number of virtual chars per string
  75.    LONG FirstDisplayString;    // number of first displayed string
  76.    LONG TotalSelectedStrings;  // number of selected strings
  77.    LONG MaxSelectedStrings;    // maximum number of selected strings
  78.    VLBPROC CallBack;           // VLB CallBack function
  79.    HANDLE hDisplayBuffer;      // handle to buffer of display strings
  80.    HANDLE hStringIds;          // handle - array of display StringIds
  81.    HANDLE hSelectedStringIds;  // handle - array of select StringIds
  82.    LONG SelectedStringId;      // Single selection selected StringId
  83.    int ScrollWindow;           // scroll lines for ScrollWindow()
  84. } VLB, FAR *LPVLB;             // 62 bytes
  85.  
  86. // Function called by application to initialize VLB
  87. //*******************************************************************
  88. BOOL FAR PASCAL InitVLB( HANDLE, HWND, WORD, VLBPROC );
  89.  
  90. // Internal functions
  91. //*******************************************************************
  92. LONG FAR PASCAL VLBProc( HWND hCtl, unsigned message, WORD wParam ,
  93.                          LONG lParam );
  94. BOOL FAR PASCAL LoadVLB( HWND hCtl, WORD wParam, LONG lParam );
  95. BOOL FAR PASCAL ScrollVLB( HWND hCtl, WORD wParam, int Scroll );
  96. VOID FAR PASCAL SetSelectedString( HWND hCtl, WORD wParam, LPVLB);
  97. VOID FAR PASCAL SetFocusString( WORD wParam, LPVLB lpVLB );
  98. VOID InvertSelectedStrings( HDC hCtl, LPVLB lpVLB, int StringPos );
  99. VOID FrameFocusString( HWND hCtl, LPVLB lpVLB, BOOL draw );
  100. VOID FAR PASCAL PaintVLB( HWND hCtl, LPVLB lpVLB );
  101. VOID FAR PASCAL GetVLBColors( HWND hCtl, HANDLE hDC );
  102.  
  103. //*** END OF VLB.H **************************************************
  104.