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.

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