00001 #if !defined(AFX_LINENUMBEREDIT_H__CAB7A465_709C_42B8_80D0_2B0AF6D25AD4__INCLUDED_)
00002 #define AFX_LINENUMBEREDIT_H__CAB7A465_709C_42B8_80D0_2B0AF6D25AD4__INCLUDED_
00003
00005
00006
00007 class CLineNumberStatic : public CStatic
00008 {
00009
00010 public:
00011 CLineNumberStatic();
00012 virtual ~CLineNumberStatic();
00013
00014
00015 public:
00016 void SetFgColor( COLORREF col, BOOL redraw );
00017 void SetBgColor( COLORREF col, BOOL redraw );
00018 void SetTopAndBottom( int topline, int bottomline );
00019 void SetTopMargin( int topmargin );
00020 void SetLineNumberFormat( CString format );
00021
00022 protected:
00023 afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00024 afx_msg void OnPaint();
00025 afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
00026 DECLARE_MESSAGE_MAP()
00027
00028 private:
00029
00030 COLORREF m_fgcol;
00031 COLORREF m_bgcol;
00032 CString m_format;
00033
00034 int m_topmargin;
00035 int m_topline;
00036 int m_bottomline;
00037 };
00038
00039
00041
00042
00043 class CLineNumberEdit : public CEdit
00044 {
00045
00046 public:
00047 CLineNumberEdit();
00048 virtual ~CLineNumberEdit();
00049
00050
00051 public:
00052 void SetMarginForegroundColor( COLORREF col, BOOL redraw = TRUE, BOOL bEnabled = TRUE );
00053 void SetMarginBackgroundColor( COLORREF col, BOOL redraw = TRUE, BOOL bEnabled = TRUE );
00054 void SetLineNumberFormat( CString format );
00055 void SetLineNumberRange( UINT nMin, UINT nMax = 0 );
00056 void UseSystemColours( BOOL bUseEnabled = TRUE, BOOL bUseDisabled = TRUE );
00057
00058 int GetLineHeight() {return m_zero.cy;}
00059
00060 protected:
00061 virtual void PreSubclassWindow();
00062
00063 virtual afx_msg void OnEnable( BOOL bEnable );
00064 virtual afx_msg void OnSysColorChange();
00065 virtual afx_msg void OnChange();
00066 virtual afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
00067 virtual afx_msg void OnVscroll();
00068 virtual afx_msg void OnSize(UINT nType, int cx, int cy);
00069 virtual afx_msg LRESULT OnSetFont(WPARAM wParam, LPARAM lParam);
00070 virtual afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
00071 virtual afx_msg LRESULT OnLineScroll(WPARAM wParam, LPARAM lParam);
00072 virtual afx_msg LRESULT OnSelectLine(WPARAM wParam, LPARAM lParam);
00073 DECLARE_MESSAGE_MAP()
00074
00075 private:
00076 void Prepare();
00077 int CalcLineNumberWidth();
00078 void UpdateTopAndBottom();
00079
00080
00081 void SetWindowColour( BOOL bEnable = TRUE );
00082
00083
00084 BOOL m_bUseEnabledSystemColours;
00085 COLORREF m_EnabledFgCol;
00086 COLORREF m_EnabledBgCol;
00087 BOOL m_bUseDisabledSystemColours;
00088 COLORREF m_DisabledFgCol;
00089 COLORREF m_DisabledBgCol;
00090
00091 CLineNumberStatic m_line;
00092 CSize m_zero;
00093 int m_maxval;
00094 CString m_format;
00095 int m_LineDelta;
00096
00097 };
00098
00099 #endif