home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / ctlhtmlc / devui.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-05  |  6.9 KB  |  208 lines

  1. /*---------------------------------------------------------------------------*\
  2.  | DevUI.h      - DevUI(tm) library header file                              |
  3.  |                From Developing User Interfaces for Microsoft Windows      |
  4.  |                Copyright (c) 1999, Everett N. McKay                       |
  5. \*---------------------------------------------------------------------------*/
  6.  
  7. #include "resource.h"
  8.  
  9. // constants and structures
  10.  
  11. const int MaxRGB = 255;
  12. const int MaxHSL = 240;
  13. const int MaxPropSheetButtons = 16;
  14.  
  15. enum ZoomSpeed { ZoomSlow, ZoomMedium, ZoomFast };
  16.  
  17. struct McButtonList
  18. {
  19.    CString Name;
  20.    int     ID;
  21.    BOOL    IsDefault;
  22. };
  23.  
  24. struct McHSL
  25. {
  26.    int      Hue;
  27.    int      Saturation;
  28.    int      Luminosity;
  29. };
  30.  
  31. // classes
  32.  
  33. class CMcPropertySheet : public CPropertySheet
  34. {
  35.     DECLARE_DYNCREATE(CMcPropertySheet)
  36.  
  37. public:
  38.                CMcPropertySheet  ();
  39.                CMcPropertySheet  (UINT titleID, CWnd* pParent = 0, UINT selectPage = 0);
  40.                CMcPropertySheet  (LPCTSTR titleText, CWnd* pParent = 0, UINT selectPage = 0);
  41. virtual  BOOL  OnInitDialog      ();
  42.          void  RemoveApplyButton ()    { m_RemoveApply  = TRUE; }
  43.          void  RemoveCancelButton()    { m_RemoveCancel = TRUE; }
  44.          void  SetButtons        (McButtonList *pButtonList) { m_pButtonList = pButtonList; }
  45.  
  46. protected:
  47.    BOOL     m_RemoveApply;
  48.    BOOL     m_RemoveCancel;
  49.    McButtonList *m_pButtonList;
  50.    CButton  m_Buttons[MaxPropSheetButtons];
  51.  
  52.    DECLARE_MESSAGE_MAP()
  53. };
  54.  
  55. class CMcMRUList : public CStringList
  56. {
  57. public:
  58.                CMcMRUList        (int maxSize = -1, BOOL isCaseSensitive = FALSE);
  59.          void  AddString         (LPCTSTR newString);
  60.          BOOL  GetClosestMatch   (LPCTSTR text, LPTSTR match, int matchBufSize);
  61.          HRESULT  SetProfile     (LPCTSTR section, LPCTSTR entryPrefix);
  62.          HRESULT  GetProfile     (LPCTSTR section, LPCTSTR entryPrefix);
  63.  
  64.    int      m_MaxSize;
  65.    BOOL     m_IsCaseSensitive;
  66. protected:
  67.          BOOL  GetClosestMatchOffset (LPCTSTR text, POSITION &pos, BOOL &exactMatch);
  68. };
  69.  
  70. class CMcColor
  71. {
  72. public:
  73.                CMcColor    (UINT value1, UINT value2, UINT value3, BOOL useRGB);
  74.                CMcColor    (COLORREF rgb);
  75.                CMcColor    (McHSL hsl);
  76.  
  77.          void  SetRGB      (UINT  red, UINT  green, UINT  blue);
  78.          void  SetRGB      (COLORREF  rgb);
  79.          void  GetRGB      (UINT &red, UINT &green, UINT &blue);
  80.          void  GetRGB      (COLORREF &rgb);
  81.  
  82.          void  SetHSL      (UINT  hue, UINT  saturation, UINT  luminosity);
  83.          void  SetHSL      (McHSL hsl);
  84.          void  GetHSL      (UINT &hue, UINT &saturation, UINT &luminosity);
  85.          void  GetHSL      (McHSL &hsl);
  86.  
  87. static   HRESULT RGBtoHSL  (COLORREF rgb, McHSL &hsl);
  88. static   HRESULT HSLtoRGB  (McHSL hsl, COLORREF &rgb);
  89.  
  90. protected:
  91. static   int     HueToRGB  (int n1, int n2, int hue);
  92.    COLORREF m_RGB;
  93.    McHSL    m_HSL;
  94. };
  95.  
  96. class CMcWindowPlacement : public WINDOWPLACEMENT
  97. {
  98. public:
  99.          HRESULT SetProfile (LPCTSTR section, LPCTSTR entry);
  100.          HRESULT GetProfile (LPCTSTR section, LPCTSTR entry, BOOL checkValues = TRUE);
  101.          HRESULT SaveWindowPlacement (LPCTSTR section, LPCTSTR entry, 
  102.                                       CWnd *pWnd);
  103.          HRESULT RestoreWindowPlacement (LPCTSTR section, LPCTSTR entry, 
  104.                                          CWnd *pWnd, BOOL checkValues = TRUE);
  105. };
  106.  
  107. class CMcTooltip : public CWnd
  108. {
  109.     DECLARE_DYNCREATE(CMcTooltip)
  110.  
  111. public:
  112.                CMcTooltip (const CPoint &cursorPos, LPCTSTR tipText, 
  113.                            const CRect &boundingRect, CWnd *pParent = 0, 
  114.                            int timeoutSeconds = 10);
  115.                CMcTooltip (const CPoint &cursorPos, UINT tipID, 
  116.                            const CRect &boundingRect, CWnd *pParent = 0, 
  117.                            int timeoutSeconds = 10);
  118.          void  Create     ();
  119.          void  SetTipText (LPCTSTR tipText, BOOL resetTimer = TRUE); 
  120.  
  121. protected:
  122.          void SetWindowRect   ();
  123. virtual  void SetClientRect   (const CRect &screenRect, CRect &clientRect);
  124. virtual  void PostNcDestroy   ();
  125.  
  126. afx_msg  void OnDestroy    ();
  127. afx_msg  void OnTimer      (UINT eventID);
  128. afx_msg  void OnPaint      ();
  129.  
  130.    CPtrList m_TextList;
  131.    CPtrList m_FormatList;
  132.    CRect    m_WindowRect;
  133.    CTime    m_StartTime;
  134.    CPoint   m_CursorPos;
  135.    CString  m_TipText;
  136.    CRect    m_BoundingRect;
  137.    CWnd    *m_pParent;
  138.    int      m_TimeoutSeconds;
  139.    BOOL     m_UseHtml;
  140.    BOOL     m_InitFont;
  141.    CFont    m_Font;
  142.  
  143.    DECLARE_MESSAGE_MAP()
  144. };
  145.  
  146. class CMcProgressDialog : public CDialog
  147. {
  148.     DECLARE_DYNCREATE(CMcProgressDialog)
  149.  
  150. public: 
  151.                CMcProgressDialog (BOOL &wasCanceled, LPCTSTR messageText, 
  152.                                   LPCTSTR titleText = 0, CWnd *pParent = 0);
  153.                CMcProgressDialog (BOOL &wasCanceled, UINT messageID, 
  154.                                   UINT titleID = 0, CWnd *pParent = 0);
  155. virtual       ~CMcProgressDialog (); 
  156.          void  Close       (); 
  157.          void  SetPercentComplete (UINT percentComplete); 
  158.          void  SetMessageText (LPCTSTR messageText); 
  159.          BOOL  Pump        (); 
  160.  
  161. protected:
  162.          void  CommonConstruct (LPCTSTR messageText, LPCTSTR titleText, 
  163.                                 CWnd *pParent);
  164. virtual  void  OnCancel    (); 
  165.  
  166.    CWnd  *m_pParent;
  167.    BOOL  &m_WasCanceled;
  168.  
  169.    DECLARE_MESSAGE_MAP()
  170. };
  171.  
  172. class CMcProgressStatusBar
  173. {
  174. public: 
  175.                CMcProgressStatusBar (BOOL &wasCanceled, CStatusBar *pStatusBar, 
  176.                                      LPCTSTR messageText, UINT statusBarPane = 0, 
  177.                                      int paneTextSize = -1); 
  178.                CMcProgressStatusBar (BOOL &wasCanceled, CStatusBar *pStatusBar, 
  179.                                      UINT messageID, UINT statusBarPane = 0, 
  180.                                      int paneTextSize = -1); 
  181. virtual       ~CMcProgressStatusBar (); 
  182.          void  Close       (); 
  183.          void  SetPercentComplete (UINT percentComplete); 
  184.          void  SetMessageText (LPCTSTR messageText); 
  185.          BOOL  Pump        (); 
  186.  
  187. protected:
  188.          void  CommonConstruct (LPCTSTR messageText, int paneTextSize);
  189.  
  190.    BOOL         &m_WasCanceled;
  191.    CProgressCtrl m_Progress;
  192.    CStatusBar   *m_pStatusBar;
  193.    UINT          m_StatusBarPane;
  194. };
  195.  
  196. void McShowZoomRect (const CRect &startRect, const CRect &endRect, ZoomSpeed speed);
  197.  
  198. HRESULT McSetProfileStringList (LPCTSTR section, LPCTSTR entryPrefix, 
  199.                       const CStringList &list);
  200. HRESULT McGetProfileStringList (LPCTSTR section, LPCTSTR entryPrefix, 
  201.                       CStringList &list);
  202.  
  203. // global variable access functions
  204.  
  205. void McSetMessageBoxZoomRect  (const CRect &zoomRect);
  206. void McSetMessageBoxZoomSpeed (ZoomSpeed zoomSpeed);
  207. CMcTooltip ** McGetTooltipPtrAddress ();
  208.