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.

78 lines
2.6 KiB

  1. /*
  2. TrackBar
  3. All the useful information for a trackbar.
  4. */
  5. typedef struct {
  6. HWND hwnd; // our window handle
  7. HDC hdc; // current DC
  8. LONG lLogMin; // Logical minimum
  9. LONG lLogMax; // Logical maximum
  10. LONG lLogPos; // Logical position
  11. LONG lSelStart; // Logical selection start
  12. LONG lSelEnd; // Logical selection end
  13. UINT wThumbWidth; // Width of the thumb
  14. UINT wThumbHeight; // Height of the thumb
  15. int iSizePhys; // Size of where thumb lives
  16. RECT rc; // track bar rect.
  17. RECT Thumb; // Rectangle we current thumb
  18. DWORD dwDragPos; // Logical position of mouse while dragging.
  19. UINT Flags; // Flags for our window
  20. int Timer; // Our timer.
  21. UINT Cmd; // The command we're repeating.
  22. int nTics; // number of ticks.
  23. PDWORD pTics; // the tick marks.
  24. } TrackBar, *PTrackBar;
  25. // Trackbar flags
  26. #define TBF_NOTHUMB 0x0001 // No thumb because not wide enough.
  27. #define TBF_SELECTION 0x0002 // a selection has been established (draw the range)
  28. /*
  29. useful constants.
  30. */
  31. #define REPEATTIME 500 // mouse auto repeat 1/2 of a second
  32. #define TIMER_ID 1
  33. #define GWW_TRACKMEM 0 /* handle to track bar memory */
  34. #define EXTRA_TB_BYTES sizeof(PTrackBar) /* Total extra bytes. */
  35. /*
  36. Useful defines.
  37. */
  38. #ifdef WIN32
  39. #define TrackBarCreate(hwnd) SetWindowLong(hwnd,GWW_TRACKMEM,(LONG)LocalAlloc(LPTR,sizeof(TrackBar)))
  40. #define TrackBarDestroy(hwnd) LocalFree((HLOCAL)GetWindowLong(hwnd,GWW_TRACKMEM))
  41. #define TrackBarLock(hwnd) (PTrackBar)GetWindowLong(hwnd,GWW_TRACKMEM)
  42. #else
  43. #define TrackBarCreate(hwnd) SetWindowWord(hwnd,GWW_TRACKMEM,(WORD)LocalAlloc(LPTR,sizeof(TrackBar)))
  44. #define TrackBarDestroy(hwnd) LocalFree((HLOCAL)GetWindowWord(hwnd,GWW_TRACKMEM))
  45. #define TrackBarLock(hwnd) (PTrackBar)GetWindowWord(hwnd,GWW_TRACKMEM)
  46. #endif
  47. /*
  48. Function Prototypes
  49. */
  50. static void NEAR PASCAL DoTrack(PTrackBar, int, DWORD);
  51. static WORD NEAR PASCAL WTrackType(PTrackBar, LONG);
  52. static void NEAR PASCAL TBTrackInit(PTrackBar, LONG);
  53. static void NEAR PASCAL TBTrackEnd(PTrackBar, LONG);
  54. static void NEAR PASCAL TBTrack(PTrackBar, LONG);
  55. static void NEAR PASCAL DrawThumb(PTrackBar);
  56. static HBRUSH NEAR PASCAL SelectColorObjects(PTrackBar, BOOL);
  57. static void NEAR PASCAL SetTBCaretPos(PTrackBar);
  58. extern DWORD FAR PASCAL lMulDiv32(DWORD, DWORD, DWORD);