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.

197 lines
7.1 KiB

  1. // common stuff for the toolbar control
  2. #ifndef _TOOLBAR_H
  3. #define _TOOLBAR_H
  4. #define TBHIGHLIGHT_BACK
  5. #define TBHIGHLIGHT_GLYPH
  6. typedef struct { /* info for recreating the bitmaps */
  7. int nButtons;
  8. HINSTANCE hInst;
  9. UINT_PTR wID;
  10. } TBBMINFO, NEAR *PTBBMINFO;
  11. typedef struct _TBBUTTONDATA {
  12. union
  13. {
  14. // Someone wanted to conserve space. This is a union to make
  15. // the code easier to read.
  16. int iBitmap;
  17. int cxySep; // Used by separators
  18. }DUMMYUNIONNAME;
  19. int idCommand;
  20. BYTE fsState;
  21. BYTE fsStyle;
  22. WORD cx; // BUGBUG raymondc: Can we change this INT?
  23. DWORD_PTR dwData;
  24. INT_PTR iString;
  25. POINT pt; // top left corner of this button
  26. } TBBUTTONDATA, * LPTBBUTTONDATA;
  27. #define HIML_NORMAL 0
  28. #define HIML_HOT 1 // Image list for the hot-tracked image
  29. #define HIML_DISABLED 2 // Image list for the hot-tracked image
  30. #define HIML_MAX 2
  31. typedef struct {
  32. HIMAGELIST himl[3];
  33. } TBIMAGELISTS, *LPTBIMAGELISTS;
  34. typedef struct { /* instance data for toolbar window */
  35. CONTROLINFO ci;
  36. DWORD dwStyleEx;
  37. HDC hdcMono;
  38. HBITMAP hbmMono;
  39. LPTBBUTTONDATA Buttons; // Array of actual buttons
  40. LPTBBUTTONDATA pCaptureButton;
  41. POINT ptCapture;
  42. HWND hwndToolTips;
  43. LPTSTR pszTip; // store current tooltip string.
  44. HWND hdlgCust;
  45. HFONT hfontIcon;
  46. int nBitmaps;
  47. #ifdef GLYPHCACHE
  48. int nSelectedBM; // currently selected pBitmaps index
  49. #endif
  50. PTBBMINFO pBitmaps;
  51. #ifdef FACECACHE
  52. HBITMAP hbmCache;
  53. #endif
  54. PTSTR *pStrings;
  55. int nStrings;
  56. int nTextRows; // # Rows of text per button
  57. UINT uStructSize;
  58. int iDxBitmap;
  59. int iDyBitmap;
  60. int iButWidth;
  61. int iButHeight;
  62. int iButMinWidth; // The min and max width of the button. If the app does not
  63. int iButMaxWidth; // have an opinion on what the min and max should be, these will be 0
  64. int iYPos;
  65. int iNumButtons;
  66. int dyIconFont;
  67. int dxDDArrowChar;
  68. int xFirstButton;
  69. int xPad;
  70. int yPad;
  71. int iListGap; // space between icon and text on list-style buttons
  72. int iDropDownGap; // padding after text on list-style drop-down buttons
  73. SIZE szCached;
  74. HDRAGPROXY hDragProxy;
  75. UINT uDrawText;
  76. UINT uDrawTextMask;
  77. COLORSCHEME clrsc;
  78. TBIMAGELISTS* pimgs;
  79. int cPimgs;
  80. int iHot; // Index of the currently Hot Tracked Button
  81. int iPressedDD; // Index of the currently pressed dropdown button
  82. int iInsert; // Index of the insertion mark, or -1 if none
  83. COLORREF clrim; // current insert mark color
  84. RECT rcInvalid; // Saved invalid rectangle
  85. BITBOOL fHimlValid : 1;
  86. BITBOOL fHimlNative : 1;
  87. BITBOOL fFontCreated: 1;
  88. BITBOOL fNoStringPool :1;
  89. BITBOOL fTTNeedsFlush :1;
  90. BITBOOL fMouseTrack: 1; // Are we currently tracking Mouse over this toolbar ?
  91. BITBOOL fActive: 1;
  92. BITBOOL fAnchorHighlight: 1;// TRUE: anchor the highlight to current position
  93. // when mouse goes out of toolbar
  94. BITBOOL fRightDrag: 1; // TRUE if current drag is right drag
  95. BITBOOL fDragOutNotify: 1; // FALSE from start of drag until mouse leaves button
  96. // at which point it is TRUE until next drag
  97. BITBOOL fInsertAfter: 1; // insert after (TRUE) or before (FALSE) button at iInsert?
  98. BITBOOL fRedrawOff : 1; // did we get a WM_SETREDRAW = FALSE
  99. BITBOOL fInvalidate : 1; // did we get any paint messages whilst we were fRedrawOff
  100. BITBOOL fRecalc : 1; // did we try to call TBRecalc while we were fRedrawOff?
  101. BITBOOL fRequeryCapture :1; // app hack see comment on lbutton up
  102. BITBOOL fShowPrefix: 1; // Show the underline of an item. Set with WM_KEYBOARDCUES
  103. BITBOOL fItemRectsValid:1; // Are the cached button item rects valid?
  104. BITBOOL fAntiAlias: 1; // Turn off AntiAliasing durning the create of a drag image.
  105. RECT rc; // cache rc of toolbar. (used only for TBSTYLE_EX_MULTICOL and TBSTYLE_EX_HIDECLIPPEDBUTTONS)
  106. SIZE sizeBound; // largest bounding size in vertical multicolumn mode.
  107. } TBSTATE, NEAR *PTBSTATE;
  108. typedef struct {
  109. /*REVIEW: index, command, flag words, resource ids should be UINT */
  110. int iBitmap; /* index into bitmap of this button's picture */
  111. int idCommand; /* WM_COMMAND menu ID that this button sends */
  112. BYTE fsState; /* button's state */
  113. BYTE fsStyle; /* button's style */
  114. int idsHelp; /* string ID for button's status bar help */
  115. } OLDTBBUTTON, FAR* LPOLDTBBUTTON;
  116. typedef struct _TBDRAWITEM
  117. {
  118. TBSTATE * ptb;
  119. LPTBBUTTONDATA pbutton;
  120. UINT state;
  121. BOOL fHotTrack;
  122. // himl and image index
  123. int iIndex;
  124. int iImage;
  125. DWORD dwCustom;
  126. NMTBCUSTOMDRAW tbcd;
  127. } TBDRAWITEM, * PTBDRAWITEM;
  128. #ifdef __cplusplus
  129. extern "C" {
  130. #endif
  131. HIMAGELIST TBGetImageList(PTBSTATE ptb, int iMode, int iIndex);
  132. HIMAGELIST TBSetImageList(PTBSTATE ptb, int iMode, int iIndex, HIMAGELIST himl);
  133. #define GET_HIML_INDEX GET_Y_LPARAM
  134. #define GET_IMAGE_INDEX GET_X_LPARAM
  135. HBITMAP FAR PASCAL SelectBM(HDC hDC, PTBSTATE pTBState, int nButton);
  136. void FAR PASCAL DrawButton(HDC hdc, int x, int y, PTBSTATE pTBState, LPTBBUTTONDATA ptButton, BOOL fActive);
  137. void DrawFace(HDC hdc, int x, int y, int offx, int offy, int dxText,
  138. int dyText, TBDRAWITEM * ptbdraw);
  139. int FAR PASCAL TBHitTest(PTBSTATE pTBState, int xPos, int yPos);
  140. int FAR PASCAL PositionFromID(PTBSTATE pTBState, LONG_PTR id);
  141. void FAR PASCAL BuildButtonTemplates(void);
  142. void FAR PASCAL TBInputStruct(PTBSTATE ptb, LPTBBUTTONDATA pButtonInt, LPTBBUTTON pButtonExt);
  143. void NEAR PASCAL TBOutputStruct(PTBSTATE ptb, LPTBBUTTONDATA pButtonInt, LPTBBUTTON pButtonExt);
  144. BOOL FAR PASCAL SaveRestore(PTBSTATE pTBState, BOOL bWrite, LPTSTR FAR *lpNames);
  145. BOOL FAR PASCAL SaveRestoreFromReg(PTBSTATE ptb, BOOL bWrite, HKEY hkr, LPCTSTR pszSubKey, LPCTSTR pszValueName);
  146. void FAR PASCAL CustomizeTB(PTBSTATE pTBState, int iPos);
  147. void FAR PASCAL MoveButton(PTBSTATE pTBState, int nSource);
  148. BOOL FAR PASCAL DeleteButton(PTBSTATE ptb, UINT uIndex);
  149. BOOL FAR PASCAL TBReallocButtons(PTBSTATE ptb, UINT uButtons);
  150. BOOL FAR PASCAL TBInsertButtons(PTBSTATE ptb, UINT uWhere, UINT uButtons, LPTBBUTTON lpButtons, BOOL fNative);
  151. LRESULT FAR PASCAL SendItemNotify(PTBSTATE ptb, int iItem, int code);
  152. void TBInvalidateItemRects(PTBSTATE ptb);
  153. void PASCAL ReleaseMonoDC(PTBSTATE ptb);
  154. void InitTBDrawItem(TBDRAWITEM * ptbdraw, PTBSTATE ptb, LPTBBUTTONDATA pbutton,
  155. UINT state, BOOL fHotTrack, int dxText, int dyText);
  156. BOOL TBGetInfoTip(PTBSTATE ptb, LPTOOLTIPTEXT lpttt, LPTBBUTTONDATA pTBButton);
  157. extern const int g_dxButtonSep;
  158. BOOL TB_GetItemRect(PTBSTATE ptb, UINT uButton, LPRECT lpRect);
  159. #ifdef __cplusplus
  160. }
  161. #endif
  162. #endif // _TOOLBAR_H