home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / k / knob.zip / ROTARY.H < prev    next >
Text File  |  1992-11-17  |  2KB  |  59 lines

  1. /*
  2.     Rotary.h
  3. */
  4.  
  5. // resource ids
  6.  
  7. #define IDR_CONTROL     200
  8.  
  9. // control window dimensions
  10.  
  11. #define ROTARY_WIDTH    100     // rotary control width
  12. #define ROTARY_HEIGHT   100     // rotary control height
  13.  
  14. // define the control range
  15.  
  16. #define MIN_UNITS       1
  17. #define MAX_UNITS       11
  18.  
  19. // colors for things
  20.  
  21. #define BLUE RGB(0, 0, 255) 
  22. #define RED  RGB(255, 0, 0)
  23. #define GREEN RGB(0, 255, 0)
  24.  
  25. // private data structure for each rotary window instance
  26.  
  27. typedef struct _RINFO {
  28.     WORD wMin;              // minimum control value
  29.     WORD wMax;              // maximum control value
  30.     WORD wPos;              // current control value
  31.     HBITMAP hbmBkGnd;       // background bitmap image
  32.     char szUnits[16];       // label for units (e.g. Hz, WPM ...)
  33. } RINFO, *NPRINFO;
  34.  
  35. // messages to rotary controls
  36.  
  37. #define RC_BASE     WM_USER
  38. #define RC_SETMIN   RC_BASE+1
  39. #define RC_SETMAX   RC_BASE+2
  40. #define RC_SETPOS   RC_BASE+3
  41. #define RC_GETPOS   RC_BASE+4
  42. #define RC_SETUNITS RC_BASE+5
  43. #define RC_LAST     RC_BASE+5
  44.  
  45. // macros to talk to rotary controls
  46.  
  47. #define rcSetMin(hWnd, w) SendMessage(hWnd, RC_SETMIN, w, NULL)
  48. #define rcSetMax(hWnd, w) SendMessage(hWnd, RC_SETMAX, w, NULL)
  49. #define rcSetPos(hWnd, w) SendMessage(hWnd, RC_SETPOS, w, NULL)
  50. #define rcGetPos(hWnd) SendMessage(hWnd, RC_GETPOS, NULL, NULL)
  51. #define rcSetUnits(hWnd,szUnits) SendMessage(hWnd, RC_SETUNITS, 0, (LONG)(LPSTR)(szUnits))
  52.  
  53. // messages from rotary controls
  54.  
  55. #define RCN_BASE    RC_LAST+1
  56. #define RCN_DRAG    RCN_BASE+1
  57. #define RCN_RELEASE RCN_BASE+2
  58.  
  59.