Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
4.6 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. // Book Tab Control Name
  3. //////////////////////////////////////////////////////////////////////////////
  4. #define BOOK_TAB_CONTROL TEXT("BOOKTAB")
  5. //////////////////////////////////////////////////////////////////////////////
  6. // Book Tab specific input messages
  7. //////////////////////////////////////////////////////////////////////////////
  8. //
  9. // message wParam lParam return action
  10. // ------- ------ ------ ------ ------
  11. // BT_ADDITEM -- pItem index adds tab at next avail. spot
  12. // BT_INSERTITEM index pItem index adds a new item at index
  13. // BT_DELETEITEM index -- <nothing> deletes the tab at index
  14. // BT_DELETEALLITEMS -- -- <nothing> deletes all tabs
  15. // BT_SETITEM index pItem succ/fail replaces text on tab
  16. // BT_GETITEM index pItem succ/fail retrieves text on tab
  17. // BT_SETCURSEL index -- succ/fail sets the current selection
  18. // BT_GETCURSEL -- -- index
  19. // BT_GETITEMCOUNT -- -- item count
  20. // BT_SETITEMDATA index data succ/fail store a DWORD with a tab
  21. // BT_GETITEMDATA index -- data retrieve the DWORD from a tab
  22. // BT_PUTINBACK -- -- <nothing> solves focus problem
  23. //
  24. //
  25. #define BT_BASE WM_USER + 777
  26. #define BT_ADDITEM BT_BASE + 0
  27. #define BT_INSERTITEM BT_BASE + 1
  28. #define BT_DELETEITEM BT_BASE + 2
  29. #define BT_DELETEALLITEMS BT_BASE + 3
  30. #define BT_SETITEM BT_BASE + 4
  31. #define BT_GETITEM BT_BASE + 5
  32. #define BT_SETCURSEL BT_BASE + 6
  33. #define BT_GETCURSEL BT_BASE + 7
  34. #define BT_GETITEMCOUNT BT_BASE + 8
  35. #define BT_SETITEMDATA BT_BASE + 9
  36. #define BT_GETITEMDATA BT_BASE + 10
  37. #define BT_PUTINBACK BT_BASE + 11
  38. //////////////////////////////////////////////////////////////////////////////
  39. // Book Tab specific notification messages
  40. //////////////////////////////////////////////////////////////////////////////
  41. // message wParam lParam meaning
  42. // ------- ------ ------ -------
  43. // BTN_SELCHANGE index my hwnd the current selection has changed
  44. // (please note that this notfification WILL NOT BE
  45. // SENT if the selection is changed by the
  46. // BT_SETCURSEL message).
  47. //
  48. #define BTN_SELCHANGE BT_BASE + 100
  49. //////////////////////////////////////////////////////////////////////////////
  50. // Book Tab functions for all to see
  51. //////////////////////////////////////////////////////////////////////////////
  52. void BookTab_Initialize(HINSTANCE hInstance);
  53. //////////////////////////////////////////////////////////////////////////////
  54. // Book Tab macros to make messages look like functions
  55. //////////////////////////////////////////////////////////////////////////////
  56. #define BookTab_AddItem(hwndCtl, text) ((UINT)(DWORD)SendMessage((hwndCtl), BT_ADDITEM, (WPARAM)(0), (LPARAM)(LPCTSTR)(text) ))
  57. #define BookTab_InsertItem(hwndCtl, index, text) ((UINT)(DWORD)SendMessage((hwndCtl), BT_INSERTITEM, (WPARAM)(UINT)(index), (LPARAM)(LPCTSTR)(text) ))
  58. #define BookTab_DeleteItem(hwndCtl, index) ((void)(DWORD)SendMessage((hwndCtl), BT_DELETEITEM, (WPARAM)(UINT)(index), (LPARAM)(0) ))
  59. #define BookTab_DeleteAllItems(hwndCtl) ((void)(DWORD)SendMessage((hwndCtl), BT_DELETEALLITEMS, (WPARAM)(0), (LPARAM)(0) ))
  60. #define BookTab_SetItem(hwndCtl, index, text) ((BOOL)(DWORD)SendMessage((hwndCtl), BT_SETITEM, (WPARAM)(UINT)(index), (LPARAM)(LPCTSTR)(text) ))
  61. #define BookTab_GetItem(hwndCtl, index, text) ((BOOL)(DWORD)SendMessage((hwndCtl), BT_GETITEM, (WPARAM)(UINT)(index), (LPARAM)(LPCTSTR)(text) ))
  62. #define BookTab_SetCurSel(hwndCtl, index) ((BOOL)(DWORD)SendMessage((hwndCtl), BT_SETCURSEL, (WPARAM)(UINT)(index), (LPARAM)(0) ))
  63. #define BookTab_GetCurSel(hwndCtl) ((UINT)(DWORD)SendMessage((hwndCtl), BT_GETCURSEL, (WPARAM)(0), (LPARAM)(0) ))
  64. #define BookTab_GetItemCount(hwndCtl) ((UINT)(DWORD)SendMessage((hwndCtl), BT_GETITEMCOUNT, (WPARAM)(0), (LPARAM)(0) ))
  65. #define BookTab_SetItemData(hwndCtl, index, data) ((BOOL)(DWORD)SendMessage((hwndCtl), BT_SETITEMDATA, (WPARAM)(UINT)(index), (LPARAM)(DWORD)(data) ))
  66. #define BookTab_GetItemData(hwndCtl, index) ((DWORD)(DWORD)SendMessage((hwndCtl), BT_GETITEMDATA, (WPARAM)(UINT)(index), (LPARAM)(0) ))
  67. #define BookTab_PutInBack(hwndCtl) ((DWORD)(DWORD)PostMessage((hwndCtl), BT_PUTINBACK, (WPARAM)(0), (LPARAM)(0) ))