home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pmstabar.zip / superclass.h < prev   
C/C++ Source or Header  |  2002-01-27  |  4KB  |  90 lines

  1. //===========================================================================
  2. // superclass.h : simple example of a static bar control implemented via
  3. //                superclassing
  4. // 10-01-2002 * by Alessandro Cantatore * v. 0.1
  5. //===========================================================================
  6.  
  7.  
  8. #ifndef _APIEX_BAR_H_
  9.    #define _APIEX_BAR_H_
  10.  
  11.  
  12. // class name
  13. #define WC_BAR     "SUPERCLASSED_BAR"
  14. /*
  15.  Bar control styles:
  16.  we plan to use the following DT_* flags:
  17.  #define DT_CENTER                  0x00000100
  18.  #define DT_RIGHT                   0x00000200
  19.  #define DT_MNEMONIC                0x00002000
  20.  so we define :
  21. */
  22.  
  23. #define BARS_HORIZONTAL        SS_GROUPBOX  // it must behave as a group box
  24. #define BARS_VERTICAL          (SS_GROUPBOX | 0x10)   // unused SS_* flag
  25. #define BARS_DEPRESSED         0x0000
  26. #define BARS_RAISED            0x0020                 // unused SS_* flag
  27. #define BARS_THICK             DT_ERASERECT // we can consider this available
  28. #define BARS_LEFT              DT_LEFT
  29. #define BARS_CENTER            DT_CENTER
  30. #define BARS_RIGHT             DT_RIGHT
  31. #define BARS_MNEMONIC          DT_MNEMONIC
  32. #define BARS_AUTOSIZE          SS_AUTOSIZE
  33.  
  34. /*
  35.  orientation :
  36.  BARS_HORIZONTAL     (default) is rendered as an horizontal bar
  37.  BARS_VERTICAL       is rendered as a vertical bar
  38.  appearance :
  39.  BARS_DEPRESSED      (default) paints the bar in a depressed look
  40.  BARS_RAISED         paints a raised bar
  41.  BARS_THICK          paints a thick (4 pixels) bar
  42.  text alignment (valid only for the horizontal bar) :
  43.  BARS_LEFT           (default) left aligned text
  44.  BARS_CENTER         centered text
  45.  BARS_RIGHT          right aligned text
  46.  various :
  47.  BARS_MNEMONIC       displays an underlined character, when the corresponding
  48.                      keystroke is pressed the focus is shifted to the next
  49.                      control
  50.  BARS_AUTOSIZE       sets the bar size to its thickness if the bar style is
  51.                      BARS_VERTICAL or if it is BARS_HORIZONTAL with no text,
  52.                      otherwise sets it to the text height
  53.  Note:
  54.  BARS_HORIZONTAL and BARS_VERTICAL are to be considered static styles
  55.  i.e. a change to the style flags via WinSetWindowULong() will not change
  56.  the control.
  57.  The control thickness can be set only to 2 or 4 pixels. To set it to a
  58.  different thickness you must send the BARM_SETTHICKNESS message.
  59.  BARS_DOUBLE flag stae modifications via WinSetWindowULong() are ignored.
  60. */
  61.  
  62. // MESSAGES: it is safe to re-use the WC_STATIC message definitions
  63.  
  64. // This allow to change the bar thickness (the control is resized if necessary)
  65. // The new control thickness must be set as mp1, while mp2 is ignored
  66. // The return value is BOOL : TRUE/FALSE -> success/error
  67. #define BARM_SETTHICKNESS      SM_SETHANDLE
  68. // This message allow to retrieve the current bar thickness. The current
  69. // thickness is returned as message result, while both mp1 and mp2 are ignored
  70. // The return value is the control thickness or 0xffff in case of error
  71. #define BARM_QUERYTHICKNESS    SM_QUERYHANDLE
  72.  
  73. // macros
  74. #define WinBarThicknessSet(hwnd, thkns) \
  75.    ((BOOL)(WinSendMsg((hwnd), BARM_SETTHICKNESS, (MPARAM)(thkns), MPVOID)))
  76. #define DlgBarThicknessSet(hwnd, id, thkns) \
  77.    ((BOOL)(WinSendDlgItemMsg((hwnd), (id), BARM_SETTHICKNESS, \
  78.                              (MPARAM)(thkns), MPVOID)))
  79. #define WinBarThickness(hwnd) \
  80.    ((SHORT)(WinSendMsg((hwnd), BARM_QUERYTHICKNESS, MPVOID, MPVOID))) 
  81. #define DlgBarThickness(hwnd, id) \
  82.    ((SHORT)(WinSendDlgItemMsg((hwnd), (id), BARM_QUERYTHICKNESS, \
  83.                               MPVOID, MPVOID)))
  84.                               
  85. // macro used to check the orientation style
  86. #define BarIsVertical(style)   ((style) & 0x10)
  87.  
  88.  
  89. #endif // #ifndef _APIEX_BAR_H_
  90.