prsprogresswnd.h

来自「采用文档类方法实现的一种串口通讯协议。可以借鉴参考」· C头文件 代码 · 共 130 行

H
130
字号
//////////////////////////////////////////////////////////////////////
// FileName:	PrsProgressWnd.h
// Version:
// Copyright (c) 2003 RAE Systems Inc		
// Purpose:		interface of the CPrsProgressWnd class
//				use for show progress bar and waiting animal picture
// Created by	Jianbin Kang on 07/8/2003
// Modification:
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_PRSPROGRESSWND_H__428DC25D_846F_42BF_8486_10CEAEC1D995__INCLUDED_)
#define AFX_PRSPROGRESSWND_H__428DC25D_846F_42BF_8486_10CEAEC1D995__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "PictureEx.h"
#define PRS_STR_EMPTY _T("")
const int PRS_WAIT_PROMPT_MINWIDTH = 180;
const int PRS_WAIT_PROGRESS_MINHEIGHT = 20;
const int PRS_WAIT_PROGRESS_MINWIDTH = 150;
const int PRS_WAIT_WINDOWS_MINWIDTH = 390;
const int PRS_WAIT_MARGIN = 10;

class CPrsProgressWnd : public CWnd
{
// Construction/Destruction
public:
    CPrsProgressWnd();
    CPrsProgressWnd(CWnd* I_pParent, LPCTSTR I_pszTitle, BOOL I_bSmooth = FALSE);
    virtual ~CPrsProgressWnd();

    BOOL Create(CWnd* I_pParent, LPCTSTR I_pszTitle, BOOL I_bSmooth = FALSE);
    BOOL GoModal(LPCTSTR I_pszTitle =_T("Progress"), BOOL I_bSmooth = FALSE);

protected:
    void CommonConstruct();

// Operations
public:
    void SetRange(int I_nLower, int I_nUpper, int I_nStep = 1);
                                                    // Set range and step size
    int OffsetPos(int I_nPos);                        // Same as CProgressCtrl
    int StepIt();                                   //    "
    int SetStep(int I_nStep);                         //    "
    int SetPos(int I_nPos);                           //    "

    void SetText(LPCTSTR I_strfmt, ...);                 // Set text in text area

    void Clear();                                   // Clear text, reset bar
    void Hide();                                    // Hide window
    void Show();                                    // Show window

    BOOL Cancelled() { return m_bCancelled; }       // Was "Cancel" hit?

	void SetWindowSize(int I_nNumTextLines, int I_nWindowWidth = PRS_WAIT_WINDOWS_MINWIDTH);

    void PeekAndPump(BOOL I_bCancelOnESCkey = TRUE);  // Message pumping for modal operation   
    
	//set the GIF File name and check it is valid or not.
	BOOL SetGIFInfo(CString I_strGIF, BOOL I_bProgressBarShow = TRUE);
	void SetCancelLabel(CString I_strCancelLabel = PRS_STR_EMPTY);
	void SetWindowTotal(CString I_strTotal = "ProRAE Studio");

// Implementation
protected:
    void GetPreviousSettings();
    void SaveCurrentSettings();

	void GetShowFlag();
	void GetGUISize(int I_nNumTextLines, int I_nWindowWidth);

protected:
    CWnd * m_wRenenableWnd; //the window that we will want to remember for reenabling

    BOOL m_bCancelled;		//The Flag for save the cancel button click info
    BOOL m_bModal;			//The Flag for window show type, is modal or not
    BOOL m_bPersistantPosition; //The falg for saves and restores position automatically
    int  m_nPrevPos;		//the last time posiotn of progress bar
	int	 m_nPrevPercent;	//the last time Percent of progress bar
    int  m_nStep;			//The progress bar step
    int  m_nMaxValue;		//A reference to an integer receiving the upper limit of the progress bar control
	int  m_nMinValue;		//A reference to an integer receiving the lower limit of the progress bar control
    int  m_nNumTextLines;	//label controller can contain text lines number

    CStatic       m_lblPrompt; //the label controller's map object
    CProgressCtrl m_wndProgress; //the progress bar controller's map object
    CButton       m_CancelButton;//The Cancel button controller's map object
    CString       m_strTitle;	//The window show captail's content
    CString       m_strCancelLabel;//the calcel button show content
    CFont         m_font;		//The window use font object

	CString		  m_strPrompt; //the label prompt content

	CPictureEx    m_CPictureEx;	//the object for show GIF
	CString		  m_strGIFFileName; //the GIF file name
	BOOL m_bProgressBarShow; //the progress bar show flag
	/*
	bit0:  =1, progress bar show; = 0 hide
	bit1:  =1, cancel botton show; = 0 hide
	bit2:  =1, prompt label show; = 0 hide
	bit3:  =1, GIF label show; = 0 hide
	*/
	int m_byShowFlag;	//the window show type
	CSize m_sizePic;	//the picture's size
	CSize m_sizeCancel;	//The size of cancel button
	CSize m_sizeWindow; //the size of window self
	CRect m_RectPrompt;	//the prompt label show position

// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CProgressWnd)
	public:
	virtual BOOL DestroyWindow();
	//}}AFX_VIRTUAL

// Generated message map functions
protected:
    //{{AFX_MSG(CProgressWnd)
    afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	//}}AFX_MSG
    afx_msg void OnCancel();
    DECLARE_MESSAGE_MAP()
};


#endif // !defined(AFX_PRSPROGRESSWND_H__428DC25D_846F_42BF_8486_10CEAEC1D995__INCLUDED_)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?