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.

154 lines
6.0 KiB

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