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.

210 lines
5.9 KiB

  1. //#define WINVER 0x400
  2. #define _3DSTUFF
  3. #define BUILDDLL
  4. #ifndef STRICT
  5. #define STRICT
  6. #endif
  7. /* disable "non-standard extension" warnings in our code
  8. */
  9. #ifndef RC_INVOKED
  10. #if 0
  11. #pragma warning(disable:4001)
  12. #endif
  13. #endif
  14. #include <windows.h>
  15. #ifdef WIN32
  16. #include <win32.h>
  17. #else // WIN32
  18. #define GETWINDOWID(hwnd) GetWindowWord(hwnd, GWW_ID)
  19. #endif
  20. #define NOUPDOWN
  21. #define NOSTATUSBAR
  22. #define NOMENUHELP
  23. #define NOBTNLIST
  24. #define NODRAGLIST
  25. #define NOPROGRESS
  26. #include "commctrl.h"
  27. #ifdef WIN32
  28. #define SETWINDOWPOINTER(hwnd, name, p) SetWindowLong(hwnd, 0, (LONG)p)
  29. #define GETWINDOWPOINTER(hwnd, name) ((name)GetWindowLong(hwnd, 0))
  30. #else // WIN32
  31. #define SETWINDOWPOINTER(hwnd, name, p) SetWindowWord(hwnd, 0, (WORD)p)
  32. #define GETWINDOWPOINTER(hwnd, name) ((name)GetWindowWord(hwnd, 0))
  33. #endif
  34. #define ALLOCWINDOWPOINTER(name, size) ((name)LocalAlloc(LPTR, size))
  35. #define FREEWINDOWPOINTER(p) LocalFree((HLOCAL)p)
  36. BOOL WINAPI MyGetPrivateProfileStruct(LPCTSTR, LPCTSTR, LPVOID, UINT, LPCTSTR);
  37. BOOL WINAPI MyWritePrivateProfileStruct(LPCTSTR, LPCTSTR, LPVOID, UINT, LPCTSTR);
  38. extern HINSTANCE hInst;
  39. BOOL FAR PASCAL InitToolbarClass(HINSTANCE hInstance);
  40. BOOL FAR PASCAL InitStatusClass(HINSTANCE hInstance);
  41. BOOL FAR PASCAL InitHeaderClass(HINSTANCE hInstance);
  42. BOOL FAR PASCAL InitButtonListBoxClass(HINSTANCE hInstance);
  43. BOOL FAR PASCAL InitTrackBar(HINSTANCE hInstance);
  44. BOOL FAR PASCAL InitUpDownClass(HINSTANCE hInstance);
  45. BOOL FAR PASCAL InitProgressClass(HINSTANCE hInstance);
  46. void FAR PASCAL NewSize(HWND hWnd, int nClientHeight, LONG style,
  47. int left, int top, int width, int height);
  48. #define IDS_SPACE 0x0400
  49. /* System MenuHelp
  50. */
  51. #define MH_SYSMENU (0x8000 - MINSYSCOMMAND)
  52. #define IDS_SYSMENU (MH_SYSMENU-16)
  53. #define IDS_HEADER (MH_SYSMENU-15)
  54. #define IDS_HEADERADJ (MH_SYSMENU-14)
  55. #define IDS_TOOLBARADJ (MH_SYSMENU-13)
  56. /* Cursor ID's
  57. */
  58. #define IDC_SPLIT 100
  59. #define IDC_MOVEBUTTON 102
  60. #define IDC_STOP 103
  61. #define IDC_COPY 104
  62. #define IDC_MOVE 105
  63. /* Icon ID's
  64. */
  65. #define IDI_INSERT 150
  66. /* AdjustDlgProc stuff
  67. */
  68. #define ADJUSTDLG 200
  69. #define IDC_BUTTONLIST 201
  70. #define IDC_RESET 202
  71. #define IDC_CURRENT 203
  72. #define IDC_REMOVE 204
  73. #define IDC_HELP 205
  74. #define IDC_MOVEUP 206
  75. #define IDC_MOVEDOWN 207
  76. /* bitmap IDs
  77. */
  78. #define IDB_THUMB 300
  79. /* These are the internal structures used for a status bar. The header
  80. * bar code needs this also
  81. */
  82. typedef struct tagSTRINGINFO
  83. {
  84. DWORD dwString;
  85. UINT uType;
  86. int right;
  87. } STRINGINFO, *PSTRINGINFO;
  88. typedef struct tagSTATUSINFO
  89. {
  90. HFONT hStatFont;
  91. BOOL bDefFont;
  92. int nFontHeight;
  93. int nMinHeight;
  94. int nBorderX, nBorderY, nBorderPart;
  95. STRINGINFO sSimple;
  96. int nParts;
  97. STRINGINFO sInfo[1];
  98. } STATUSINFO, *PSTATUSINFO;
  99. #define SBT_NOSIMPLE 0x00ff /* Flags to indicate normal status bar */
  100. /* This is the default status bar face name
  101. */
  102. extern TCHAR szSansSerif[];
  103. /* Note that window procedures in protect mode only DLL's may be called
  104. * directly.
  105. */
  106. void FAR PASCAL PaintStatusWnd(HWND hWnd, PSTATUSINFO pStatusInfo,
  107. PSTRINGINFO pStringInfo, int nParts, int nBorderX, BOOL bHeader);
  108. LRESULT CALLBACK StatusWndProc(HWND hWnd, UINT uMessage, WPARAM wParam,
  109. LPARAM lParam);
  110. /* toolbar.c */
  111. typedef struct tagTBBMINFO { /* info for recreating the bitmaps */
  112. int nButtons;
  113. HINSTANCE hInst;
  114. WORD wID;
  115. HBITMAP hbm;
  116. } TBBMINFO, NEAR *PTBBMINFO;
  117. typedef struct tagTBSTATE { /* instance data for toolbar window */
  118. PTBBUTTON pCaptureButton;
  119. HWND hdlgCust;
  120. HWND hwndCommand;
  121. int nBitmaps;
  122. PTBBMINFO pBitmaps;
  123. HBITMAP hbmCache;
  124. PTSTR *pStrings;
  125. int nStrings;
  126. UINT uStructSize;
  127. int iDxBitmap;
  128. int iDyBitmap;
  129. int iButWidth;
  130. int iButHeight;
  131. int iYPos;
  132. int iBarHeight;
  133. int iNumButtons;
  134. int nSysColorChanges;
  135. WORD wButtonType;
  136. TBBUTTON Buttons[1];
  137. } TBSTATE, NEAR *PTBSTATE;
  138. typedef struct tagOLDTBBUTTON
  139. {
  140. /*REVIEW: index, command, flag words, resource ids should be UINT */
  141. int iBitmap; /* index into bitmap of this button's picture */
  142. int idCommand; /* WM_COMMAND menu ID that this button sends */
  143. BYTE fsState; /* button's state */
  144. BYTE fsStyle; /* button's style */
  145. int idsHelp; /* string ID for button's status bar help */
  146. } OLDTBBUTTON;
  147. typedef OLDTBBUTTON FAR* LPOLDTBBUTTON;
  148. static HBITMAP FAR PASCAL SelectBM(HDC hDC, PTBSTATE pTBState, int nButton);
  149. static void FAR PASCAL DrawButton(HDC hdc, int x, int y, int dx, int dy,PTBSTATE pTBState, PTBBUTTON ptButton, BOOL bCache);
  150. static int FAR PASCAL TBHitTest(PTBSTATE pTBState, int xPos, int yPos);
  151. static int FAR PASCAL PositionFromID(PTBSTATE pTBState, int id);
  152. static void FAR PASCAL BuildButtonTemplates(void);
  153. static void FAR PASCAL TBInputStruct(PTBSTATE pTBState, LPTBBUTTON pButtonInt, LPTBBUTTON pButtonExt);
  154. static void FAR PASCAL TBOutputStruct(PTBSTATE pTBState, LPTBBUTTON pButtonInt, LPTBBUTTON pButtonExt);
  155. /* tbcust.c */
  156. extern BOOL FAR PASCAL SaveRestore(HWND hWnd, PTBSTATE pTBState, BOOL bWrite,
  157. LPTSTR FAR *lpNames);
  158. extern void FAR PASCAL CustomizeTB(HWND hWnd, PTBSTATE pTBState, int iPos);
  159. extern void FAR PASCAL MoveButton(HWND hwndToolbar, PTBSTATE pTBState,
  160. int nSource);
  161. /* cutils.c */
  162. void FAR PASCAL NewSize(HWND hWnd, int nHeight, LONG style, int left, int top, int width, int height);
  163. BOOL FAR PASCAL CreateDitherBrush(BOOL bIgnoreCount); /* creates hbrDither */
  164. BOOL FAR PASCAL FreeDitherBrush(void);
  165. void FAR PASCAL CreateThumb(BOOL bIgnoreCount);
  166. void FAR PASCAL DestroyThumb(void);
  167. void FAR PASCAL CheckSysColors(void);
  168. extern HBRUSH hbrDither;
  169. extern HBITMAP hbmThumb;
  170. extern int nSysColorChanges;
  171. extern DWORD rgbFace; // globals used a lot
  172. extern DWORD rgbShadow;
  173. extern DWORD rgbHilight;
  174. extern DWORD rgbFrame;