Beispiel #1
0
GutterCtrl::GutterCtrl(EditorCtrl& parent, wxWindowID id): 
	wxControl(&parent, id, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE),
	m_editorCtrl(parent), 
	m_mdc(), m_bitmap(1,1), m_width(0), m_gutterLeft(true), 
	m_showBookmarks(true), 
	m_showFolds(true), m_currentFold(NULL), m_posBeforeFoldClick(-1),
	m_theme(m_editorCtrl.GetTheme()),
	m_currentSel(-1)
{
	m_mdc.SelectObject(m_bitmap);
	if (!m_mdc.Ok()) wxLogError(wxT("wxMemoryDC() constructor was failed in creating!"));

	UpdateTheme(true);

// FIXME Do not set max values as CalcLayout would get another idea of width
#if 0
	// Calculate width of control
	m_max_digits = 1;
	const int width = m_digit_width*m_max_digits + 7;

	// Make sure sizes get the right min/max sizes
	SetSizeHints(width, -1, width, -1);
#endif

	// Set to standard cursor (otherwise it will inherit from editorCtrl)
	SetCursor(*wxSTANDARD_CURSOR);
}
Beispiel #2
0
GutterCtrl::GutterCtrl(EditorCtrl& parent, wxWindowID id)
	: wxControl(&parent, id, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE),
	  m_editorCtrl(parent), m_mdc(), m_bitmap(1,1), m_width(0), m_gutterLeft(true), m_showBookmarks(true), m_showFolds(true), m_currentFold(NULL), m_posBeforeFoldClick(-1),
  m_theme(m_editorCtrl.m_theme), m_bgcolor(m_theme.gutterColor),
  m_currentSel(-1)
{
	m_mdc.SelectObject(m_bitmap);
	if (!m_mdc.Ok()) wxLogError(wxT("wxMemoryDC() constructor was failed in creating!"));

	// Initialize the memoryDC for dubblebuffering
	UpdateTheme();

	// Set the colors
	//m_bgcolor.Set(192, 192, 255); // Pastel purple
	//m_hlightcolor.Set(172, 172, 235); // Pastel purple (slightly darker)
	//m_edgecolor.Set(92, 92, 155); // Pastel purple (darker)
	//m_numbercolor.Set(52, 52, 115); // Pastel purple (even darker)

	// Get the width of a single digit
	wxCoord w;
	wxCoord h;
	m_mdc.GetTextExtent(wxT('0'), &w, &h);
	m_digit_width = w;

// FIXME Do not set max values as CalcLayout would get another idea of width
#if 0
	// Calculate width of control
	m_max_digits = 1;
	const int width = m_digit_width*m_max_digits + 7;

	// Make sure sizes get the right min/max sizes
	SetSizeHints(width, -1, width, -1);
#endif

	// Set to standard cursor (otherwise it will inherit from editorCtrl)
	SetCursor(*wxSTANDARD_CURSOR);
}