Leaked source code of windows server 2003
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.

98 lines
2.4 KiB

  1. /*++
  2. Copyright (c) 1994-95 Microsoft Corporation
  3. Module Name:
  4. utils.h
  5. Abstract:
  6. Utilities.
  7. Author:
  8. Don Ryan (donryan) 04-Jan-1995
  9. Environment:
  10. User Mode - Win32
  11. Revision History:
  12. Jeff Parham (jeffparh) 12-Nov-1995
  13. Copied from LLSMGR, stripped Tv (Tree view) functions,
  14. removed OLE support
  15. --*/
  16. #ifndef _UTILS_H_
  17. #define _UTILS_H_
  18. #define LPSTR_TEXTCALLBACK_MAX 260
  19. //
  20. // List view utilities
  21. //
  22. #define LVID_SEPARATOR 0
  23. #define LVID_UNSORTED_LIST -1
  24. typedef struct _LV_COLUMN_ENTRY {
  25. int iSubItem; // column index
  26. int nStringId; // header string id
  27. int nRelativeWidth; // header width
  28. } LV_COLUMN_ENTRY, *PLV_COLUMN_ENTRY;
  29. #pragma warning(disable:4200)
  30. typedef struct _LV_COLUMN_INFO {
  31. BOOL bSortOrder; // sort order (ascending false)
  32. int nSortedItem; // column sorted (default none)
  33. int nColumns;
  34. LV_COLUMN_ENTRY lvColumnEntry[];
  35. } LV_COLUMN_INFO, *PLV_COLUMN_INFO;
  36. #pragma warning(default:4200)
  37. void LvInitColumns(CListCtrl* pListCtrl, PLV_COLUMN_INFO plvColumnInfo);
  38. void LvResizeColumns(CListCtrl* pListCtrl, PLV_COLUMN_INFO plvColumnInfo);
  39. void LvChangeFormat(CListCtrl* pListCtrl, UINT nFormatId);
  40. LPVOID LvGetSelObj(CListCtrl* pListCtrl);
  41. LPVOID LvGetNextObj(CListCtrl* pListCtrl, LPINT piItem, int nType = LVNI_ALL|LVNI_SELECTED);
  42. void LvSelObjIfNecessary(CListCtrl* pListCtrl, BOOL bSetFocus = FALSE);
  43. BOOL LvInsertObArray(CListCtrl* pListCtrl, PLV_COLUMN_INFO plvColumnInfo, CObArray* pObArray);
  44. BOOL LvRefreshObArray(CListCtrl* pListCtrl, PLV_COLUMN_INFO plvColumnInfo, CObArray* pObArray);
  45. void LvReleaseObArray(CListCtrl* pListCtrl);
  46. void LvReleaseSelObjs(CListCtrl* pListCtrl);
  47. #ifdef _DEBUG
  48. void LvDumpObArray(CListCtrl* pListCtrl);
  49. #endif
  50. #define IsItemSelectedInList(plv) (::LvGetSelObj((CListCtrl*)(plv)) != NULL)
  51. //
  52. // Other stuff...
  53. //
  54. void SetDefaultFont(CWnd* pWnd);
  55. DWORD
  56. CatUnicodeAndAnsiStrings(
  57. IN WCHAR const *pwszUnicode,
  58. IN CHAR const *pszAnsi,
  59. OUT CHAR **ppszStr);
  60. #ifdef _DEBUG
  61. #define VALIDATE_OBJECT(pOb, ObClass) \
  62. { ASSERT_VALID((pOb)); ASSERT((pOb)->IsKindOf(RUNTIME_CLASS(ObClass))); }
  63. #else
  64. #define VALIDATE_OBJECT(pOb, ObClass)
  65. #endif
  66. #endif // _UTILS_H_