ProgressBar.h
上传用户:xp758258
上传日期:2007-01-02
资源大小:40k
文件大小:3k
源码类别:

状态条

开发平台:

Visual C++

  1. // ProgressBar.h : header file
  2. //
  3. // Drop-in status bar progress control
  4. //
  5. // Written by Chris Maunder (chrismaunder@codeguru.com)
  6. // Copyright (c) 1998.
  7. //
  8. // This code may be used in compiled form in any way you desire. This
  9. // file may be redistributed unmodified by any means PROVIDING it is 
  10. // not sold for profit without the authors written consent, and 
  11. // providing that this notice and the authors name is included. If 
  12. // the source code in this file is used in any commercial application 
  13. // then an email to me would be nice.
  14. //
  15. // This file is provided "as is" with no expressed or implied warranty.
  16. // The author accepts no liability if it causes any damage to your
  17. // computer, causes your pet cat to fall ill, increases baldness or
  18. // makes you car start emitting strange noises when you start it up.
  19. //
  20. // Expect bugs.
  21. // 
  22. // Please use and enjoy. Please let me know of any bugs/mods/improvements 
  23. // that you have found/implemented and I will fix/incorporate them into this
  24. // file. 
  25. //
  26. // Version 1.1  Chris Maunder (chrismaunder@codeguru.com)
  27. //
  28. // Version 1.2  Michael Martin 07 Aug 1998 mmartin@netspace.net.au
  29. //              Added code to enable progress bar to appear in any pane
  30. //              of the status bar.
  31. //
  32. //              Chris Maunder 17 Aug 1998 
  33. //              Fixed Pane text restoration, and general cleanup.
  34. //
  35. /////////////////////////////////////////////////////////////////////////////
  36. #ifndef _INCLUDE_PROGRESSBAR_H_
  37. #define _INCLUDE_PROGRESSBAR_H_
  38. /////////////////////////////////////////////////////////////////////////////
  39. // CProgressBar -  status bar progress control
  40. //
  41. // Copyright (c) Chris Maunder, 1997
  42. // Please feel free to use and distribute.
  43. class CProgressBar: public CProgressCtrl
  44. // Creates a ProgressBar in the status bar
  45. {
  46. public:
  47. CProgressBar();
  48. CProgressBar(LPCTSTR strMessage, int nSize=100, int MaxValue=100, 
  49.                  BOOL bSmooth=FALSE, int nPane=0);
  50. ~CProgressBar();
  51. BOOL Create(LPCTSTR strMessage, int nSize=100, int MaxValue=100, 
  52.                 BOOL bSmooth=FALSE, int nPane=0);
  53. DECLARE_DYNCREATE(CProgressBar)
  54. // operations
  55. public:
  56. BOOL SetRange(int nLower, int nUpper, int nStep = 1);
  57. BOOL SetText(LPCTSTR strMessage);
  58. BOOL SetSize(int nSize);
  59. COLORREF SetBarColour(COLORREF clrBar);
  60. COLORREF SetBkColour(COLORREF clrBk);
  61. int  SetPos(int nPos);
  62. int  OffsetPos(int nPos);
  63. int  SetStep(int nStep);
  64. int  StepIt();
  65. void Clear();
  66. // Overrides
  67. //{{AFX_VIRTUAL(CProgressBar)
  68. //}}AFX_VIRTUAL
  69. // implementation
  70. protected:
  71. int m_nSize; // Percentage size of control
  72. int m_nPane; // ID of status bar pane progress bar is to appear in
  73. CString m_strMessage; // Message to display to left of control
  74.     CString m_strPrevText;  // Previous text in status bar
  75. CRect m_Rect; // Dimensions of the whole thing
  76. CStatusBar *GetStatusBar();
  77. BOOL Resize();
  78. // Generated message map functions
  79. protected:
  80. //{{AFX_MSG(CProgressBar)
  81. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  82. //}}AFX_MSG
  83. DECLARE_MESSAGE_MAP()
  84. };
  85. #endif
  86. /////////////////////////////////////////////////////////////////////////////