📄 libuidk.h
字号:
HBITMAP m_hbmpBKH;
HBITMAP m_hbmpBKS;
HBITMAP m_hbmpBKD;
CString m_strUIWndName;
CFont m_fontText;
UINT m_uHorAlig;
UINT m_uVerAlig;
int m_nBtnWidth; // Width of the drop button with drop down list style
BOOL m_bMouseOver;
};
/////////////////////////////////////////////////////////////////////////////
// CSkinEdit window
class CSkinEdit : public CEdit
{
// Construction
public:
CSkinEdit();
// Attributes
public:
void SetUIWndName(LPCSTR lpszUIWndName);
BOOL SetBkColor(COLORREF clrBkgnd);
COLORREF GetBkColor();
BOOL SetTextColor( COLORREF clrText );
COLORREF GetTextColor();
protected:
BOOL InitProperties();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSkinEdit)
protected:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CSkinEdit();
// Generated message map functions
protected:
//{{AFX_MSG(CSkinEdit)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnPaint();
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
//}}AFX_MSG
afx_msg LRESULT OnSetSel(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
protected:
CString m_strUIPath;
CFont m_fontText;
COLORREF m_clrText; // text
COLORREF m_clrBkgnd; // text bkgnd
UINT m_uHorAlig;
UINT m_uVerAlig;
HBITMAP m_hbmpBkN;
HBITMAP m_hbmpBkH;
HBITMAP m_hbmpBkS;
HBITMAP m_hbmpBkD;
HBRUSH m_brushN;
CString m_strUIWndName;
};
/////////////////////////////////////////////////////////////////////////////
// CSkinSliderCtrl window
class CSkinSliderCtrl : public CSliderCtrl
{
// Construction
public:
CSkinSliderCtrl();
// Attributes
public:
void SetUIWndName(LPCSTR lpszUIWndName);
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSkinSliderCtrl)
//}}AFX_VIRTUAL
// Implementation
public:
int InitBitmaps();
virtual ~CSkinSliderCtrl();
// Generated message map functions
protected:
BOOL IsMouseOverThumb();
//{{AFX_MSG(CSkinSliderCtrl)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
afx_msg void OnCustomdraw(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
afx_msg LRESULT OnGetThumbRect(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
protected:
CBrush m_brush;
CBitmap m_bmpBkH;
HBITMAP m_hbmpBkN;
HBITMAP m_hbmpBkH;
HBITMAP m_hbmpThumbN;
HBITMAP m_hbmpThumbH;
HBITMAP m_hbmpThumbS;
HBITMAP m_hbmpThumbD;
CString m_strUIWndName;
BOOL m_bUseMark;
BOOL m_bVert; // Is has TBS_VERT style
int m_nSplit;
};
/////////////////////////////////////////////////////////////////////////////
// CSkinStatic window
class CSkinStatic : public CStatic
{
// Construction
public:
CSkinStatic();
// Attributes
public:
void SetTextColor(COLORREF crN, COLORREF crD);
void GetTextColor(COLORREF *pcrN, COLORREF *pcrD);
void SetTextFont(CFont *pFontN, CFont *pFontD);
void GetTextFont(CFont **pFontN, CFont **pFontD);
void SetTextOffsetN(int nHOffsetN, int nVOffsetN); // Set the text offset with normal state
void GetTextOffsetN(int *pnHOffsetN, int *pnVOffsetN);
void SetTextOffsetD(int nHOffsetD, int nVOffsetD); // Set the text offset with disable state
void GetTextOffsetD(int *pnHOffsetD, int *pnVOffsetD);
// Set a foreground bitmap for the static control from nXSrc and nYSrc with rcMask for transparent
void SetForegroundBitmap(HBITMAP hBmpForeground, int nXSrc, int nYSrc, COLORREF rcMask = RGB(255, 0, 255), BOOL bReDraw = TRUE);
void SetToolTips(LPCSTR lpszToolTips);
void SetUIWndName(LPCSTR lpszUIWndName);
// Operations
public:
protected:
BOOL InitProperties();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSkinStatic)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CSkinStatic();
// Generated message map functions
protected:
//{{AFX_MSG(CSkinStatic)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnPaint();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
protected:
CString m_strUIWndName;
UINT m_uHorAligN;
UINT m_uHorAligD;
UINT m_uVerAligN;
UINT m_uVerAligD;
BOOL m_bNoWrap;
// for font
CFont m_FontN;
CFont m_FontD;
LOGFONT m_lfN;
LOGFONT m_lfD;
BOOL m_bDSameNFont;
// for color
COLORREF m_crN;
COLORREF m_crD;
BOOL m_bDSameNColor;
CToolTipCtrl m_wndToolTip;
HBITMAP m_hBmpForeground;
COLORREF m_rcMask;
int m_nXSrc;
int m_nYSrc;
};
/////////////////////////////////////////////////////////////////////////////
// CUIWnd window: the parent window for all controls
class CUIWnd : public CWnd
{
// Construction
public:
CUIWnd();
// Attributes
public:
virtual void GetUIWindowName();
DWORD GetLastCreateError(); // Get the error value of return by OnCreate function
int GetID(LPCSTR lpszIDs);
// Operations
public:
protected:
virtual void WindowID() = 0; // init the m_strUIWndName in derive class
protected:
virtual void OnDraw(CDC *pMemDC);
BOOL CreateChildControls();
int InitGdiObject();
void ReleaseGdiObject();
void InitPath();
BOOL DestroyChildControls();
RECT MAKERECT(LPCSTR lpszRect);
BOOL AdjustChildControls();
int Init();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CUIWnd)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
//}}AFX_VIRTUAL
// Implementation
public:
CString StringIDFromInt(int nID);
virtual ~CUIWnd();
// Generated message map functions
protected:
//{{AFX_MSG(CUIWnd)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnDestroy();
afx_msg void OnPaint();
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
//}}AFX_MSG
afx_msg LRESULT OnGetBkBitmap(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnChangeSkin(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
private:
CString m_strUIWndName;
protected:
BOOL InitProperties();
UINT IDD;
CString m_strUIPath;
CString m_strResourcePath;
CString m_strPath; // the path not include file name
// for mask bitmap
int m_nRValue;
int m_nGValue;
int m_nBValue;
BOOL m_bUseMaskColor;
CBitmap m_bmpBK; // the base bitmap background( there is no control on it )
CBitmap m_bmpBKN; // normal
CBitmap m_bmpBKD; // disable
CBitmap m_bmpBKH; // highlight
CBitmap m_bmpBKS; // selected( push down )
// the following variables for return WM_GETBKBITMAP message
// CBitmap m_bmpMemBK;
// CBitmap m_bmpMemBKN;
// CBitmap m_bmpMemBKD;
// CBitmap m_bmpMemBKH;
// CBitmap m_bmpMemBKS;
struct CHILDINFO
{
CWnd *pWnd;
CRect rect;
};
std::vector<CHILDINFO> m_vChildWndList;
DWORD m_dwLastError;
};
//////////////////////////////////////////////////////////////////////////
// the CUIMgr manage the path of the UI project
class CUIMgr
{
public:
CUIMgr();
virtual ~CUIMgr();
// Set the relative or Absolute path of *.ui project file, such as "\\skins\\the.ui"
// return 0 if successful, otherwise nonzero.
static int SetUIPath(LPCSTR lpszUIPath);
// Get the path of the *.ui project file
static CString GetUIPath();
// Get the the "Resource.h" file's path
static CString GetUIResourcePath();
// Get the path of the *.ui file, but not include the *.ui name, such as "\\skins"
static CString GetUIPathWithoutTitle();
private:
static CString m_strUIPath;
static CString m_strUIPathWithoutTitle;
static CString m_strUIResourcePath;
};
#endif //_CONTROLS_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -