#pragma once #include "GlwSubclassWnd.h" class TARCH_EXP GlwSkin : public GlwSubclassWnd { private: bool m_bHasName; // 是否显示第二行title bool m_bInit; // 是否初始化? BOOL m_bActive; // 是否active CString m_sTitle; // title 字符串 bool m_bSizable; // 能否 resize bool m_bCaption; // 是否有caption int m_nTopHeight; // 标题框宽 int m_nLBorderW; // 左框宽 int m_nRBorderW; // 右框宽 int m_nBBorderW; // 底框宽 CSize m_szMin; // resize 最小尺寸 HBRUSH m_hBrush; // 背景画刷 HRGN m_hRgn; CFont m_font; // 字体对象 bool m_bCBtnMoveon, m_bCBtnClick;// 关闭按钮状态 bool m_bCornerTitle; // 圆角 caption CRect m_reOldWnd; // 窗口收缩前的大小 DWORD m_dwOldLong; // 窗口透明前的 style bool m_bNcLBDCaption; // 当鼠标点中标题栏时置 true bool m_bNcLBDBorder; // 当鼠标点左/右/下栏时置 true bool m_bDragTrans; // 拖拽窗口是否令窗口透明? COLORREF m_colorDlg; //窗口颜色 public: CRect GetNoClientArea() {return CRect(m_nLBorderW, m_nTopHeight, m_nRBorderW, m_nBBorderW);} bool HasCaption(){return m_bCaption;} bool HasLabel(){return m_bHasName;} BOOL Hook( CWnd * wnd ); BOOL IsInited() { return m_bInit; } void SetFont(LPCTSTR name, int fHeight); void SetMinSize(CSize sz){m_szMin = sz;} CRect GetCloseBtnRect(bool bScreen); HRGN GetRegion(); void SetLabel(bool bset); bool IsCaptionLButtonDown(){return m_bNcLBDCaption;} bool IsBorderLButtonDown(){return m_bNcLBDBorder;} void SetDragTransparent(bool bValue){m_bDragTrans = bValue;} void SerColorDlg(COLORREF colorDlg); GlwSkin(); virtual ~GlwSkin(); private: LRESULT OnSetText( WPARAM wp, LPARAM lp ); void OnActivate(UINT nState,CWnd* pWndOther, BOOL bMinimized ); BOOL OnEraseBkgnd( CDC *pDC); void OnGetMinMaxInfo( MINMAXINFO* lpMMI ); void OnNcMouseMove( UINT nHitTest, CPoint point ); void OnNcLButtonUp( UINT nHitTest, CPoint point ); void OnNcLButtonDown( UINT nHitTest, CPoint point ); void OnNcLButtonDblClk( UINT nHitTest, CPoint point ); UINT OnNcHitTest( CPoint point ); BOOL OnNcActivate( BOOL bActive ); void OnSize(UINT nType, int cx, int cy ); void OnNcCalcSize( BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp); void OnNcPaint( HRGN rgn ); HBRUSH OnCtlColorDlg(HWND hwnd, CDC *pDc, HWND hDlg); virtual LRESULT WindowProc(UINT msg, WPARAM wp, LPARAM lp); };