| 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 | |
|---|
| 37 | #ifndef _INCLUDE_PROGRESSBAR_H_ |
|---|
| 38 | #define _INCLUDE_PROGRESSBAR_H_ |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | ///////////////////////////////////////////////////////////////////////////// |
|---|
| 42 | // CProgressBar - status bar progress control |
|---|
| 43 | // |
|---|
| 44 | // Copyright (c) Chris Maunder, 1997 |
|---|
| 45 | // Please feel free to use and distribute. |
|---|
| 46 | |
|---|
| 47 | class CProgressBar: public CProgressCtrl |
|---|
| 48 | // Creates a ProgressBar in the status bar |
|---|
| 49 | { |
|---|
| 50 | public: |
|---|
| 51 | CProgressBar(); |
|---|
| 52 | CProgressBar(LPCTSTR strMessage, int nSize=100, int MaxValue=100, |
|---|
| 53 | BOOL bSmooth=FALSE, int nPane=0); |
|---|
| 54 | ~CProgressBar(); |
|---|
| 55 | BOOL Create(LPCTSTR strMessage, int nSize=100, int MaxValue=100, |
|---|
| 56 | BOOL bSmooth=FALSE, int nPane=0, BOOL bVisible=TRUE); |
|---|
| 57 | |
|---|
| 58 | DECLARE_DYNCREATE(CProgressBar) |
|---|
| 59 | |
|---|
| 60 | // operations |
|---|
| 61 | public: |
|---|
| 62 | BOOL SetRange(int nLower, int nUpper, int nStep = 1); |
|---|
| 63 | BOOL SetText(LPCTSTR strMessage); |
|---|
| 64 | BOOL SetSize(int nSize); |
|---|
| 65 | COLORREF SetBarColour(COLORREF clrBar); |
|---|
| 66 | COLORREF SetBkColour(COLORREF clrBk); |
|---|
| 67 | int SetPos(int nPos); |
|---|
| 68 | int OffsetPos(int nPos); |
|---|
| 69 | int SetStep(int nStep); |
|---|
| 70 | int StepIt(); |
|---|
| 71 | void Clear(); |
|---|
| 72 | |
|---|
| 73 | // Overrides |
|---|
| 74 | //{{AFX_VIRTUAL(CProgressBar) |
|---|
| 75 | //}}AFX_VIRTUAL |
|---|
| 76 | |
|---|
| 77 | // implementation |
|---|
| 78 | protected: |
|---|
| 79 | int m_nSize; // Percentage size of control |
|---|
| 80 | int m_nPane; // ID of status bar pane progress bar is to appear in |
|---|
| 81 | CString m_strMessage; // Message to display to left of control |
|---|
| 82 | CString m_strPrevText; // Previous text in status bar |
|---|
| 83 | CRect m_Rect; // Dimensions of the whole thing |
|---|
| 84 | |
|---|
| 85 | CStatusBar *GetStatusBar(); |
|---|
| 86 | BOOL Resize(); |
|---|
| 87 | |
|---|
| 88 | // Generated message map functions |
|---|
| 89 | protected: |
|---|
| 90 | //{{AFX_MSG(CProgressBar) |
|---|
| 91 | afx_msg BOOL OnEraseBkgnd(CDC* pDC); |
|---|
| 92 | //}}AFX_MSG |
|---|
| 93 | DECLARE_MESSAGE_MAP() |
|---|
| 94 | |
|---|
| 95 | }; |
|---|
| 96 | |
|---|
| 97 | #endif |
|---|
| 98 | ///////////////////////////////////////////////////////////////////////////// |
|---|