Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
cWndProgressText.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cWndProgressText_H
7 #define _INC_cWndProgressText_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cWndControls2.h"
13 
14 #if defined(_WIN32)
15 #include "cWndGDI.h"
16 #include "cWindowHook.h"
17 
18 namespace GrayLib
19 {
20  class GRAYLIB_LINK cWndProgressText : public cWndProgressCtrl, public cWindowHook
21  {
26 
27  typedef cWndProgressCtrl SUPER_t;
28 
29  protected:
30  // variables for class
31  bool m_bShowPercent; // true = append m_nPos as percent complete text
32  cWndFont m_VerticalFont; // font for vertical progress bars
33  COLORREF m_crTextClr;
34  COLORREF m_crTextBkClr; // text colors
35  DWORD m_dwTextStyle; // alignment style for text
36 
37  COLORREF m_crBarClr;
38  COLORREF m_crBarBkClr; // bar colors. can be set but not get in default config.
39 
40  // Dupe params from cWndProgressCtrl
41  int m_nPos; // current position within range
42  int m_nStepSize; // current step size
43  int m_nMin;
44  int m_nMax; // minimum and maximum values of range
45 
46  protected:
47  // Generated message map functions
48  //{{AFX_MSG(cWndProgressText)
49  BOOL OnEraseBkgnd();
50  void OnPaint(HDC hDC);
51  //}}AFX_MSG
52 
53  // handlers for shell progress control standard messages
54  LRESULT OnSetRange(WPARAM, LPARAM lparamRange);
55  LRESULT OnSetPos(WPARAM nNewPos, LPARAM);
56  LRESULT OnOffsetPos(WPARAM nIncrement, LPARAM);
57  LRESULT OnSetStep(WPARAM nStepInc, LPARAM);
58  LRESULT OnStepIt(WPARAM, LPARAM);
59  LRESULT OnSetRange32(WPARAM nLowLim, LPARAM nHighLim);
60  LRESULT OnGetRange(WPARAM bWhichLimit, LPARAM pPBRange);
61  LRESULT OnGetPos(WPARAM, LPARAM);
62  LRESULT OnSetBarColor(WPARAM, LPARAM crBar);
63  LRESULT OnSetBarBkColor(WPARAM, LPARAM crBarBk);
64 
65  // helper functions
66  void CreateVerticalFont();
67  void SetDirty();
68  virtual LRESULT HookWindowProc(WINMSG_t message, WPARAM wParam, LPARAM lParam);
69 
70  public:
71  cWndProgressText();
72  ~cWndProgressText();
73 
74  bool AttachHwnd( HWND hWnd );
75  void SetTextPercent( const GChar_t* pszText, int iPercent=-1 );
76 
77  // Operations
78  public:
79  //COLORREF SetBarColor(COLORREF crBarClr = CLR_DEFAULT);
80  COLORREF GetBarColor() const;
81  //COLORREF SetBarBkColor(COLORREF crBarBkClr = CLR_DEFAULT);
82  COLORREF GetBarBkColor() const;
83  COLORREF SetTextColor(COLORREF crTextClr = CLR_DEFAULT);
84  COLORREF GetTextColor() const;
85  COLORREF SetTextBkColor(COLORREF crTextBkClr = CLR_DEFAULT);
86  COLORREF GetTextBkColor() const;
87 
88  bool SetShowPercent(bool bShow);
89  DWORD AlignText(DWORD dwAlignment = DT_CENTER);
90 
91  };
92 };
93 
94 #endif //_WIN32
95 #endif //_INC_cWndProgressText_H
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
UINT WINMSG_t
Supplement _WIN32 "windows.h".
Definition: WinTypes.h:111
UINT32 COLORREF
ABGR (high to low bits)
Definition: cVariantData.h:21
Definition: cMesh.h:22
char GChar_t
My version of TCHAR, _TCHAR.
Definition: StrConst.h:26