Welcome to mirror list, hosted at ThFree Co, Russian Federation.

LineNumberEdit.h « mplayerc « apps « src - github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0fa541ffcee6cbd8a21f5dacf76f9022268f2b4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#if !defined(AFX_LINENUMBEREDIT_H__CAB7A465_709C_42B8_80D0_2B0AF6D25AD4__INCLUDED_)
#define AFX_LINENUMBEREDIT_H__CAB7A465_709C_42B8_80D0_2B0AF6D25AD4__INCLUDED_

/////////////////////////////////////////////////////////////////////////////
// CLineNumberStatic window

class CLineNumberStatic : public CStatic
{
// Construction/destruction
public:
	CLineNumberStatic();
	virtual ~CLineNumberStatic();

// Operations
public:
	void SetFgColor( COLORREF col, BOOL redraw );
	void SetBgColor( COLORREF col, BOOL redraw );
	void SetTopAndBottom( int topline, int bottomline );
	void SetTopMargin( int topmargin );
	void SetLineNumberFormat( CString format );

protected:
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnPaint();
	afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
	DECLARE_MESSAGE_MAP()

private:
// Attributes
	COLORREF			m_fgcol;
	COLORREF			m_bgcol;
	CString				m_format;

	int m_topmargin;	// Current top margin
	int m_topline;		// Current top line number
	int m_bottomline;	// Current bottom line number
};


/////////////////////////////////////////////////////////////////////////////
// CLineNumberEdit window

class CLineNumberEdit : public CEdit
{
// Construction/destruction
public:
	CLineNumberEdit();
	virtual ~CLineNumberEdit();

// Operations
public:
	void SetMarginForegroundColor( COLORREF col, BOOL redraw = TRUE, BOOL bEnabled = TRUE );
	void SetMarginBackgroundColor( COLORREF col, BOOL redraw = TRUE, BOOL bEnabled = TRUE );
	void SetLineNumberFormat( CString format );
	void SetLineNumberRange( UINT nMin, UINT nMax = 0 );
	void UseSystemColours( BOOL bUseEnabled = TRUE, BOOL bUseDisabled = TRUE );

	int GetLineHeight()
	{
		return m_zero.cy;
	}

protected:
	virtual void PreSubclassWindow();

	virtual afx_msg void OnEnable( BOOL bEnable );
	virtual afx_msg void OnSysColorChange();
	virtual afx_msg void OnChange();
	virtual afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	virtual afx_msg void OnVscroll();
	virtual afx_msg void OnSize(UINT nType, int cx, int cy);
	virtual afx_msg LRESULT OnSetFont(WPARAM wParam, LPARAM lParam); // Maps to WM_SETFONT
	virtual afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam); // Maps to WM_SETTEXT
	virtual afx_msg LRESULT OnLineScroll(WPARAM wParam, LPARAM lParam); // Maps to EM_LINESCROLL
	virtual afx_msg LRESULT OnSelectLine(WPARAM wParam, LPARAM lParam);
	DECLARE_MESSAGE_MAP()

private:
	void Prepare();
	int CalcLineNumberWidth();
	void UpdateTopAndBottom();

	// Method to set window colour only
	void SetWindowColour( BOOL bEnable = TRUE );

// Attributes
	BOOL				m_bUseEnabledSystemColours;
	COLORREF			m_EnabledFgCol;
	COLORREF			m_EnabledBgCol;
	BOOL				m_bUseDisabledSystemColours;
	COLORREF			m_DisabledFgCol;
	COLORREF			m_DisabledBgCol;

	CLineNumberStatic	m_line;
	CSize				m_zero;
	int					m_maxval;
	CString				m_format;
	int                 m_LineDelta; // Introduced to provide an offset to the first line number

};

#endif // !defined(AFX_LINENUMBEREDIT_H__CAB7A465_709C_42B8_80D0_2B0AF6D25AD4__INCLUDED_)