📄 skinprogress.h
字号:
// Convert a bitmap to a specified device context
BOOL ConvBitmap
(
CBitmap* o_poBitmap,
CBitmap* i_poBitmap,
CDC* i_poDC = NULL
);
// *** PROGRESS INTERFACE ***
// Set the new range
BOOL SetRange
(
int i_nLower,
int i_nUpper,
int i_nStep = 1,
BOOL i_bResamble = false
#ifndef dCSP_TIMED_REDRAW
,BOOL i_bDisplay = true
#endif // dCSP_TIMED_REDRAW
);
// Set <m_nRight> value
int SetPos
(
int i_nPos
#ifndef dCSP_TIMED_REDRAW
,BOOL i_bDisplay = true
#endif // dCSP_TIMED_REDRAW
);
// Forward of <i_nOffset> value
int OffsetPos
(
int i_nOffset
#ifndef dCSP_TIMED_REDRAW
,BOOL i_bDisplay = true
#endif // dCSP_TIMED_REDRAW
);
// Set <m_nStep> value
int SetStep
(
int i_nStep
);
// Forward of <m_nStep> value
int StepIt
(
#ifndef dCSP_TIMED_REDRAW
BOOL i_bDisplay = true
#endif // dCSP_TIMED_REDRAW
);
// *** EXTENDED PROGRESS INTERFACE ***
// Set size of the progress bar
BOOL SetSize
(
int i_nSize
#ifndef dCSP_TIMED_REDRAW
,BOOL i_bDisplay = true
#endif // dCSP_TIMED_REDRAW
);
// Get width or height of the progress bar in pixel, mostly used in CSkinSlider
int GetSize
(
);
// Get <m_nRight> value
int GetPos
(
BOOL i_bPercent = false
);
// Get <m_nStep> value
int GetStep
(
);
// Get <m_nLower> value
int GetLower
(
);
// Get <m_nUpper> value
int GetUpper
(
);
#ifdef dCSP_SLIDERBAR_METHOD
// Set <m_nLeft> value
int SetStart
(
int i_nStart
#ifndef dCSP_TIMED_REDRAW
,BOOL i_bDisplay = true
#endif // dCSP_TIMED_REDRAW
);
// Get <m_nLeft> value
int GetStart
(
BOOL i_bPercent = false
);
#endif // dCSP_SLIDERBAR_METHOD
// Restart the progress bar
void Reset
(
#ifndef dCSP_TIMED_REDRAW
BOOL i_bDisplay = true
#endif // dCSP_TIMED_REDRAW
);
// *** TEXT INTERFACE ***
// Set the new text
BOOL SetText
(
LPCTSTR i_poStrMessage
#ifndef dCSP_TIMED_REDRAW
,BOOL i_bDisplay = true
#endif // dCSP_TIMED_REDRAW
);
// Set progress text
BOOL SetProgress
(
int i_nProgress
#ifndef dCSP_TIMED_REDRAW
,BOOL i_bDisplay = true
#endif // dCSP_TIMED_REDRAW
);
// Get <m_nProgressText> value
int GetProgress
(
);
// *** UPDATE PROCESS ***
// Recalc the layout of the panes and refresh them, must be used in [OnSizing(...)] of the parent function
BOOL RefreshPanes
(
);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSkinProgress)
//}}AFX_VIRTUAL
// Implementation
protected: // --- PROTECTED -----------------------------------------------
// Attributes
#ifdef dCSP_VERTICAL_BAR
BOOL m_bVertical; // true if vertical *NEVER USE IN CSkinProgress for Status Bar*
#endif // dCSP_VERTICAL_BAR
int m_nSize; // Percentage size of control (if <0, autosize with the text if in pane 0)
int m_nPane; // ID of status bar pane progress bar is to appear in
CString m_oStrMessage; // Message to display in pane 0
CString m_oStrPrevMessage; // Message to display in pane 0
CString m_oStrPrevText; // Previous text in pane m_nPane
int m_nProgressText; // Settings of the Progress text
int m_nLower; // Min value
int m_nUpper; // Max value
int m_nStep; // Step increment
#ifdef dCSP_SLIDERBAR_METHOD
int m_nPrevLeftAff; // For 'OnPaint'
int m_nLeftAff; // For 'OnPaint'
int m_nPrevLeft; // Previous position (m_nLower <= m_nPrevLeft <= m_nUpper)
int m_nLeft; // Current position (m_nLower <= m_nLeft <= m_nUpper)
#endif // dCSP_SLIDERBAR_METHOD
int m_nPrevRightAff; // For 'OnPaint'
int m_nRightAff; // For 'OnPaint'
int m_nPrevRight; // Previous position (m_nLower <= m_nPrevRight <= m_nUpper)
int m_nRight; // Current position (m_nLower <= m_nRight <= m_nUpper)
int m_nPrevEndAff; // For 'OnPaint'
int m_nEndAff; // For 'OnPaint'
#ifdef dCSP_SLIDERBAR_METHOD
BOOL m_bReverse; // Reverse display, start from the end to the beginning of the progress bar
#endif // dCSP_SLIDERBAR_METHOD
int m_nBmpWidth; // Width of each m_BarImgLst element
int m_nBmpHeight; // Height of each m_BarImgLst element
CRect m_oRectPane; // Position of the progress bar used in [RefreshPanes()]
CRect m_oRectPaint; // Dimension of the progress bar used in [OnPaint()]
CBitmap* m_poBaseBmp; // The base bitmap
CBitmap* m_poCompatibleBmp; // The client DC compatible base bitmap
CBitmap* m_poStretchBmp ; // The stretched picture to adapt it to the bar size
CImageList m_oBarImgLst; // The ImageList that contains all the progress bar picture elements
CBitmap* m_poProgressBmp; // The progress bar, created, modified and displayed in [OnPaint()]
#ifdef dCSP_DIALOG_PROGRESS
CWnd* m_poWndProgress; // The base CWnd used to create the progress bar
CWnd* m_poWndMessage; // The base CWnd used to create the text pane
#endif // dCSP_DIALOG_PROGRESS
SYSTEMTIME m_sStartTimeSystem; // Creation time of the SkinProgress
LONGLONG m_nStartTimeLongLong; // Same for 'GetTimed'
// Operations
// *** CLEANER ***
// Deletion of the progress bar, restoration of the context
void Clear
(
);
// *** SYSTEM INTERFACE ***
// Get the window's status bar handler
CStatusBar* GetStatusBar
(
);
// Get the target CRect of the progress bar
BOOL GetTargetRect
(
CRect* o_poProgressRect
);
// *** INITIALIZATORS ***
// I have put here 'Create...', to avoid to call them twice on an existing CSkinProgress !
BOOL CreateCommon
(
LPCTSTR i_poStrMessage,
int i_nUpper = 100,
int i_nProgress = cSPT_PERCENT,
CBitmap* i_poBitmap = NULL
#ifdef dCSP_SLIDERBAR_METHOD
,BOOL i_bReverse = false
#endif // dCSP_SLIDERBAR_METHOD
);
// Specific Create for Status Bar
BOOL ProgressInStatusBar
(
LPCTSTR i_poStrMessage,
int i_nUpper = 100,
int i_nProgress = cSPT_PERCENT,
int i_nPane = 0,
int i_nSize = 200,
CBitmap* i_poBitmap = NULL
#ifdef dCSP_SLIDERBAR_METHOD
,BOOL i_bReverse = false
#endif // dCSP_SLIDERBAR_METHOD
);
#ifdef dCSP_DIALOG_PROGRESS
// Specific Create for Dialog
BOOL ProgressInDialog
(
CWnd* i_poWndProgress,
int i_nUpper = 100,
CBitmap* i_poBitmap = NULL,
#ifdef dCSP_SLIDERBAR_METHOD
BOOL i_bReverse = false,
#endif // dCSP_SLIDERBAR_METHOD
CWnd* i_poWndMessage = NULL,
LPCTSTR i_poStrMessage = NULL,
int i_nProgress = cSPT_NONE
);
#endif // dCSP_DIALOG_PROGRESS
// *** DATA PROCESS ***
// Calculation of the '...' text that fits in the (i_nMaxWidth + i_nAddWidth) place
int CompactText
(
CString* io_pString,
CDC* i_pDC,
int i_nMaxWidth,
int i_nAddWidth = 0
);
// Get the complete timed message (64 bits calculation inside)
BOOL GetTimed
(
CString* o_poTimed
);
// *** UPDATE PROCESS ***
// Update of the progress bar values
BOOL UpdateProgress
(
CRect* o_poRectPaint = NULL
);
// *** WINDOWS MAPPED PROCESSING ***
// Generated message map functions
//{{AFX_MSG(CSkinProgress)
afx_msg BOOL OnEraseBkgnd(CDC* i_pDC);
afx_msg void OnPaint();
afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnTimer(UINT nIDEvent);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SKINPROGRESS_H__1DF43017_611B_44BD_822A_FAA0E01B2257__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -