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.

154 lines
6.0 KiB

  1. typedef struct
  2. { // ti
  3. RECT rc; // for hit testing and drawing
  4. int iImage; // image index
  5. int xLabel; // position of the text for drawing (relative to rc)
  6. int yLabel; // (relative to rc)
  7. int cxLabel; // width of the label. this is needed if we're drawing in vertical mode
  8. int xImage; // Position of the icon for drawing (relative to rc)
  9. int yImage;
  10. int iRow; // what row is it in?
  11. LPTSTR pszText;
  12. DWORD dwState;
  13. UINT etoRtlReading;
  14. union
  15. {
  16. LPARAM lParam;
  17. BYTE abExtra[1];
  18. }DUMMYUNIONNAME;
  19. } TABITEM, *LPTABITEM;
  20. typedef struct
  21. {
  22. CCONTROLINFO ci;
  23. HWND hwndArrows; // Hwnd Arrows.
  24. HDPA hdpa; // item array structure
  25. UINT flags; // TCF_ values (internal state bits)
  26. int cbExtra; // extra bytes allocated for each item
  27. DWORD dwStyleEx; // set by TCM_SETEXTENDEDSTYLE
  28. HFONT hfontLabel; // font to use for labels
  29. int iSel; // index of currently-focused item
  30. int iNewSel; // index of next potential selection
  31. int cxItem; // width of all tabs
  32. int cxMinTab; // width of minimum tab
  33. int cyTabs; // height of a row of tabs
  34. int cxTabs; // The right hand edge where tabs can be painted.
  35. int cxyArrows; // width and height to draw arrows
  36. int iFirstVisible; // the index of the first visible item.
  37. // wont fit and we need to scroll.
  38. int iLastVisible; // Which one was the last one we displayed?
  39. int cxPad; // Padding space between edges and text/image
  40. int cyPad; // should be a multiple of c?Edge
  41. int iTabWidth; // size of each tab in fixed width mode
  42. int iTabHeight; // settable size of each tab
  43. int iLastRow; // number of the last row.
  44. int iLastTopRow; // the number of the last row that's on top (SCROLLOPPOSITE mode)
  45. int cyText; // where to put the text vertically
  46. int cyIcon; // where to put the icon vertically
  47. HIMAGELIST himl; // images,
  48. HWND hwndToolTips;
  49. HIMC hPrevImc; // previous input context handle
  50. HDRAGPROXY hDragProxy;
  51. DWORD dwDragDelay; // delay for auto page-change during drag
  52. int iDragTab; // last tab dragged over
  53. int tmHeight; // text metric height
  54. BOOL fMinTabSet:1; // have they set the minimum tab width
  55. BOOL fTrackSet:1;
  56. int iHot;
  57. HTHEME hTheme; // Theme support
  58. int iPartId; // Theme support
  59. int iStateId; // Theme support
  60. } TC, *PTC;
  61. #ifndef TCS_MULTISELECT
  62. #define TCS_MULTISELECT 0x0004
  63. #endif
  64. #define HASIMAGE(ptc, pitem) (ptc->himl && pitem->iImage != -1)
  65. // tab control flag values
  66. #define TCF_FOCUSED 0x0001
  67. #define TCF_MOUSEDOWN 0x0002
  68. #define TCF_DRAWSUNKEN 0x0004
  69. #define TCF_REDRAW 0x0010 /* Value from WM_SETREDRAW message */
  70. #define TCF_BUTTONS 0x0020 /* draw using buttons instead of tabs */
  71. #define TCF_FONTSET 0x0040 /* if this is set, they set the font */
  72. #define TCF_FONTCREATED 0x0080
  73. #define ID_ARROWS 1
  74. #define TAB_DRAGDELAY 500
  75. // Some helper macros for checking some of the flags...
  76. #define Tab_RedrawEnabled(ptc) (ptc->flags & TCF_REDRAW)
  77. #define Tab_Count(ptc) DPA_GetPtrCount((ptc)->hdpa)
  78. #define Tab_GetItemPtr(ptc, i) ((LPTABITEM)DPA_GetPtr((ptc)->hdpa, (i)))
  79. #define Tab_FastGetItemPtr(ptc, i) ((LPTABITEM)DPA_FastGetPtr((ptc)->hdpa, (i)))
  80. #define Tab_IsItemOnBottom(ptc, pitem) ((BOOL)pitem->iRow > ptc->iLastTopRow)
  81. #define Tab_DrawSunken(ptc) ((BOOL)(ptc)->flags & TCF_DRAWSUNKEN)
  82. #define Tab_DrawButtons(ptc) ((BOOL)(ptc->ci.style & TCS_BUTTONS))
  83. #define Tab_MultiLine(ptc) ((BOOL)(ptc->ci.style & TCS_MULTILINE))
  84. #define Tab_RaggedRight(ptc) ((BOOL)(ptc->ci.style & TCS_RAGGEDRIGHT))
  85. #define Tab_FixedWidth(ptc) ((BOOL)(ptc->ci.style & TCS_FIXEDWIDTH))
  86. #define Tab_Vertical(ptc) ((BOOL)(ptc->ci.style & TCS_VERTICAL))
  87. #define Tab_Bottom(ptc) ((BOOL)(ptc->ci.style & TCS_BOTTOM))
  88. #define Tab_ScrollOpposite(ptc) ((BOOL)(ptc->ci.style & TCS_SCROLLOPPOSITE))
  89. #define Tab_ForceLabelLeft(ptc) ((BOOL)(ptc->ci.style & TCS_FORCELABELLEFT))
  90. #define Tab_ForceIconLeft(ptc) ((BOOL)(ptc->ci.style & TCS_FORCEICONLEFT))
  91. #define Tab_FocusOnButtonDown(ptc) ((BOOL)(ptc->ci.style & TCS_FOCUSONBUTTONDOWN))
  92. #define Tab_OwnerDraw(ptc) ((BOOL)(ptc->ci.style & TCS_OWNERDRAWFIXED))
  93. #define Tab_FocusNever(ptc) ((BOOL)(ptc->ci.style & TCS_FOCUSNEVER))
  94. #define Tab_HotTrack(ptc) ((BOOL)(ptc->ci.style & TCS_HOTTRACK))
  95. #define Tab_MultiSelect(ptc) ((BOOL)(ptc->ci.style & TCS_MULTISELECT))
  96. #define Tab_FlatButtons(ptc) ((BOOL)((ptc)->ci.style & TCS_FLATBUTTONS))
  97. #define Tab_FlatSeparators(ptc) ((BOOL)((ptc)->dwStyleEx & TCS_EX_FLATSEPARATORS))
  98. #ifdef __cplusplus
  99. extern "C"
  100. {
  101. #endif
  102. LRESULT CALLBACK Tab_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  103. void Tab_InvalidateItem(PTC ptc, int iItem, BOOL bErase);
  104. void Tab_CalcPaintMetrics(PTC ptc, HDC hdc);
  105. void Tab_OnHScroll(PTC ptc, HWND hwndCtl, UINT code, int pos);
  106. void Tab_OnAdjustRect(PTC ptc, BOOL fGrow, LPRECT prc);
  107. BOOL Tab_FreeItem(PTC ptc, TABITEM* pitem);
  108. void Tab_UpdateArrows(PTC ptc, BOOL fSizeChanged);
  109. int ChangeSel(PTC ptc, int iNewSel, BOOL bSendNotify, BOOL bUpdateCursorPos);
  110. BOOL RedrawAll(PTC ptc, UINT uFlags);
  111. BOOL Tab_Init(HINSTANCE hinst);
  112. void UpdateToolTipRects(PTC ptc);
  113. BOOL Tab_OnGetItem(PTC ptc, int iItem, TC_ITEM* ptci);
  114. int Tab_OnHitTest(PTC ptc, int x, int y, UINT *lpuFlags);
  115. //
  116. // ANSI <=> UNICODE thunks
  117. //
  118. TC_ITEMW * ThunkItemAtoW (PTC ptc, TC_ITEMA * pItemA);
  119. BOOL ThunkItemWtoA (PTC ptc, TC_ITEMW * pItemW, TC_ITEMA * pItemA);
  120. BOOL FreeItemW (TC_ITEMW *pItemW);
  121. #ifdef __cplusplus
  122. }
  123. #endif