home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / FERRAMEN / VB_SLIDE / SLIDER.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-03-04  |  6.3 KB  |  194 lines

  1. //---------------------------------------------------------------------------
  2. // Slider.h
  3. //---------------------------------------------------------------------------
  4. // Copyright (C) 1990-91,  Microsoft Corp.
  5. //                 All Rights Reserved
  6. // Information Contained Herein Is Proprietary and Confidential.
  7. //---------------------------------------------------------------------------
  8.  
  9. //---------------------------------------------------------------------------
  10. // Helpful Macros
  11. //---------------------------------------------------------------------------
  12. #define OFFSETIN( struc, field )  ( (USHORT)&( ((struc *)0)->field ) )
  13.  
  14.  
  15. //---------------------------------------------------------------------------
  16. // Resource ID's
  17. //---------------------------------------------------------------------------
  18. // Toolbox bitmap resource IDs numbers must be consecutive from N to N+5
  19. //---------------------------------------------------------------------------
  20. #define IDBMP_SLIDER        8000
  21. #define IDBMP_SLIDERDOWN    8001
  22. #define IDBMP_SLIDERMONO    8003
  23. #define IDBMP_SLIDERMONODOWN    8004
  24. #define IDBMP_SLIDEREGA     8006
  25. #define IDBMP_SLIDEREGADOWN    8007
  26.  
  27. #define IDBMP_SLIDE        9000
  28. #define IDBMP_BUTTON        9001
  29. #define IDBMP_MASK        9002
  30.  
  31.  
  32. #ifndef RC_INVOKED
  33. //---------------------------------------------------------------------------
  34. // SLIDER global data
  35. //---------------------------------------------------------------------------
  36. SHORT    sButtonWidth;
  37. SHORT    sButtonHeight;
  38. SHORT    sSlideWidth;
  39. SHORT    sSlideHeight;
  40.  
  41. HBITMAP hbmpSlide;
  42. HBITMAP hbmpButton;
  43. HBITMAP hbmpMask;
  44.  
  45.  
  46. //---------------------------------------------------------------------------
  47. // Slider control struct
  48. //---------------------------------------------------------------------------
  49. typedef struct tagSLIDER
  50. {
  51.     USHORT    fCapture:1;    // mouse down and captured
  52.     RECT    rectButton;    // button extent
  53.     SHORT    sHeight;    // pixel height of slider
  54.     SHORT    sYoff;        // relative mouse position at capture
  55. }
  56. SLIDER;
  57.  
  58. typedef SLIDER FAR * PSLIDER;
  59.  
  60. #define SLIDERDEREF( hctl )   CONTROLDEREF( SLIDER, hctl )
  61.  
  62.  
  63. //---------------------------------------------------------------------------
  64. // Control Procudure
  65. //---------------------------------------------------------------------------
  66. LONG _export SliderCtlProc( HCTL, HWND, USHORT, USHORT, LONG );
  67.  
  68.  
  69. //---------------------------------------------------------------------------
  70. // Property info
  71. //---------------------------------------------------------------------------
  72. #ifdef CTL_DATA
  73. PROPINFO CTL_DATA propinfoSliderValue =
  74. {
  75.     "Value",
  76.     DT_SHORT | PF_fGetMsg | PF_fSetMsg | PF_fSaveData,
  77.     0, 0
  78. };
  79. #endif    // CTL_DATA
  80.  
  81.  
  82. //---------------------------------------------------------------------------
  83. // Property list
  84. //---------------------------------------------------------------------------
  85. // Define the consecutive indicies for the properties
  86. //---------------------------------------------------------------------------
  87. #define IPROP_SLIDER_CTLNAME        0x0000
  88. #define IPROP_SLIDER_INDEX        0x0001
  89. #define IPROP_SLIDER_PARENT        0x0002
  90. #define IPROP_SLIDER_BACKCOLOR        0x0003
  91. #define IPROP_SLIDER_FORECOLOR        0x0004
  92. #define IPROP_SLIDER_LEFT        0x0005
  93. #define IPROP_SLIDER_TOP        0x0006
  94. #define IPROP_SLIDER_WIDTH        0x0007
  95. #define IPROP_SLIDER_HEIGHT        0x0008
  96. #define IPROP_SLIDER_ENABLED        0x0009
  97. #define IPROP_SLIDER_VISIBLE        0x000A
  98. #define IPROP_SLIDER_MOUSEPOINTER   0x000B
  99. #define IPROP_SLIDER_VALUE        0x000C
  100. #define IPROP_SLIDER_DRAGMODE        0x000D
  101. #define IPROP_SLIDER_DRAGICON        0x000E
  102. #define IPROP_SLIDER_TABINDEX        0x000F
  103. #define IPROP_SLIDER_TABSTOP        0x0010
  104. #define IPROP_SLIDER_TAG        0x0011
  105.  
  106. #ifdef CTL_DATA
  107. PPROPINFO CTL_DATA proplistSlider[] =
  108. {
  109.     PPROPINFO_STD_CTLNAME,
  110.     PPROPINFO_STD_INDEX,
  111.     PPROPINFO_STD_PARENT,
  112.     PPROPINFO_STD_BACKCOLOR,
  113.     PPROPINFO_STD_FORECOLOR,
  114.     PPROPINFO_STD_LEFT,
  115.     PPROPINFO_STD_TOP,
  116.     PPROPINFO_STD_WIDTH,
  117.     PPROPINFO_STD_HEIGHT,
  118.     PPROPINFO_STD_ENABLED,
  119.     PPROPINFO_STD_VISIBLE,
  120.     PPROPINFO_STD_MOUSEPOINTER,
  121.     &propinfoSliderValue,
  122.     PPROPINFO_STD_DRAGMODE,
  123.     PPROPINFO_STD_DRAGICON,
  124.     PPROPINFO_STD_TABINDEX,
  125.     PPROPINFO_STD_TABSTOP,
  126.     PPROPINFO_STD_TAG,
  127.     NULL
  128. };
  129. #endif    // CTL_DATA
  130.  
  131.  
  132. //---------------------------------------------------------------------------
  133. // Event procedure parameter prototypes
  134. //---------------------------------------------------------------------------
  135. #ifdef CTL_DATA
  136. EVENTINFO CTL_DATA eventinfoChange =
  137. {
  138.     "Change"
  139. };
  140. #endif    // CTL_DATA
  141.  
  142.  
  143. //---------------------------------------------------------------------------
  144. // Event list
  145. //---------------------------------------------------------------------------
  146. // Define the consecutive indicies for the events
  147. //---------------------------------------------------------------------------
  148. #define EVENT_SLIDER_CHANGE        0
  149. #define EVENT_SLIDER_DRAGDROP        1
  150. #define EVENT_SLIDER_DRAGOVER        2
  151. #define EVENT_SLIDER_GOTFOCUS        3
  152. #define EVENT_SLIDER_LOSTFOCUS        4
  153.  
  154. #ifdef CTL_DATA
  155. PEVENTINFO CTL_DATA eventlistSlider[] =
  156. {
  157.     &eventinfoChange,
  158.     PEVENTINFO_STD_DRAGDROP,
  159.     PEVENTINFO_STD_DRAGOVER,
  160.     PEVENTINFO_STD_GOTFOCUS,
  161.     PEVENTINFO_STD_LOSTFOCUS,
  162.     NULL
  163. };
  164. #endif    // CTL_DATA
  165.  
  166.  
  167. //---------------------------------------------------------------------------
  168. // Model struct
  169. //---------------------------------------------------------------------------
  170. // Define the control model (using the event and property structures).
  171. //---------------------------------------------------------------------------
  172. #ifdef CTL_DATA
  173. MODEL CTL_DATA modelSlider =
  174. {
  175.     VB_VERSION,             // VB version being used
  176.     MODEL_fFocusOk | MODEL_fWantArrows, // MODEL flags
  177.     (PCTLPROC)SliderCtlProc,        // Control procedure
  178.     CS_DBLCLKS | CS_HREDRAW
  179.      | CS_VREDRAW,                      // Class style
  180.     WS_CHILD,                // default Window style
  181.     sizeof(SLIDER),            // cbCtlExtra for SLIDER structure
  182.     IDBMP_SLIDER,            // palette bitmap ID
  183.     "Slider",                // default control name
  184.     "Slider",                // Visual Basic class name
  185.     NULL,                // parent class name
  186.     proplistSlider,            // Properties list
  187.     eventlistSlider            // Events list
  188. };
  189. #endif    // CTL_DATA
  190.  
  191. #endif  // RC_INVOKED
  192.  
  193. //---------------------------------------------------------------------------
  194.