Esempio n. 1
0
//--------------------------------------------------------------
// Double Click == reset
//--------------------------------------------------------------
void RibbonControl::DoubleClick (UINT nFlags, CPoint point)
{
	m_value = 0.;
	m_phase = 0;
	if (m_bVisible) DrawIndicator(m_pOwner->GetDC());
	if (m_pAdjust) (*m_pAdjust)(m_pOwner,m_value);
}
Esempio n. 2
0
//
// 'TabControl::OnLButtonDown'
//
// @mfunc Handler that is called when the left mouse button is activated.
//        The handler examines whether we have initiated a drag 'n drop
//        process.
//
void TabControl::OnLButtonDown(UINT nFlags, CPoint point)
{
	if (DragDetectPlus(this, point))
	{
		// Yes, we're beginning to drag, so capture the mouse...
		m_bDragging = true;

		// Find and remember the source tab (the one we're going to move/drag 'n drop)
		TCHITTESTINFO hitinfo;
		hitinfo.pt = point;
		m_nSrcTab = HitTest(&hitinfo);
		m_nDstTab = m_nSrcTab;

		// Reset insert indicator
		m_InsertPosRect.SetRect(0,0,0,0);
		DrawIndicator(point);
		SetCapture();
	}
	else  
	{
		CTabCtrl::OnLButtonDown(nFlags, point);
	}

	// Note: We're not calling the base classes CTabCtrl::OnLButtonDown 
	//       everytime, because we want to be able to drag a tab without
	//       actually select it first (so that it gets the focus).
}
Esempio n. 3
0
//--------------------------------------------------------------
// Redraw the wheel
//--------------------------------------------------------------
void RibbonControl::Draw (CDC* pDC)
{
	CBrush br(m_color);
	pDC->FillRect(m_bbox,&br);
	pDC->DrawEdge(m_bbox,EDGE_RAISED,BF_RECT);
	CRect whr = m_bbox; whr.DeflateRect(4,4);
	pDC->DrawEdge(whr,EDGE_SUNKEN,BF_RECT);
	DrawIndicator(pDC);
}
Esempio n. 4
0
//--------------------------------------------------------------
// Drag == adjust
//--------------------------------------------------------------
void RibbonControl::Drag (UINT nFlags, CPoint point)
{
	CSize diff = point - m_lastMouse;
	m_lastMouse = point;
	int delta = (m_bbox.Width()>m_bbox.Height()) ? diff.cx : diff.cy;
	m_value += delta*m_sens;
	m_phase += delta; while (m_phase<0) m_phase += 8; m_phase %= 8;
	if (m_bVisible) DrawIndicator(m_pOwner->GetDC());
	if (m_pAdjust) (*m_pAdjust)(m_pOwner,m_value);
}
Esempio n. 5
0
//
// 'TabControl::OnMouseMove'
//
// @mfunc Handler that is called when the mouse is moved. This is used
//        to, when in a drag 'n drop process, to:
//
//        1) Draw the drop indicator of where the tab can be inserted.
//        2) Possible scroll the tab so more tabs is viewed.
//
void TabControl::OnMouseMove(UINT nFlags, CPoint point)
{
	CTabCtrl::OnMouseMove(nFlags, point);

	// This code added to do extra check - shouldn't be strictly necessary!
	if (!(nFlags & MK_LBUTTON))
		m_bDragging = false;

	if (m_bDragging)
	{
		// Draw the indicator
		DrawIndicator(point);

		// Get the up-down (spin) control that is associated with the tab control
		// and which contains scroll position information.
		if (!m_pSpinCtrl)
		{
			CWnd* pWnd = FindWindowEx(GetSafeHwnd(), 0, _T("msctls_updown32"), 0);
			if (pWnd)
			{
				// DevNote: It may be somewhat of an overkill to use the MFC version
				//          of the CSpinButtonCtrl since were actually only using it
				//          for retrieving the current scroll position (GetPos). A simple
				//          HWND could have been enough.
				m_pSpinCtrl = new CSpinButtonCtrl;
				m_pSpinCtrl->Attach(pWnd->GetSafeHwnd());
			}
		}

		CRect rect;
		GetClientRect(&rect);

		// Examine whether we should scroll left...
		if (point.x < rect.left && m_pSpinCtrl)
		{
			int nPos = LOWORD(m_pSpinCtrl->GetPos());
			if (nPos > 0)
			{
				InvalidateRect(&m_InsertPosRect, FALSE);
				ZeroMemory(&m_InsertPosRect, sizeof(m_InsertPosRect));
				SendMessage(WM_HSCROLL, MAKEWPARAM(SB_THUMBPOSITION, nPos - 1), 0);
			}
		}

		// Examine whether we should scroll right...
		if (point.x > rect.right && m_pSpinCtrl && m_pSpinCtrl->IsWindowVisible())
		{
			InvalidateRect(&m_InsertPosRect, FALSE);
			ZeroMemory(&m_InsertPosRect, sizeof(m_InsertPosRect));
			int nPos = LOWORD(m_pSpinCtrl->GetPos());
			SendMessage(WM_HSCROLL, MAKEWPARAM(SB_THUMBPOSITION, nPos + 1), 0);
		}
	}
}
Esempio n. 6
0
void LineGraph::RenderGraph(int eventsOfset)
{
	primitives_PaintRect16(m_surface, &m_surfaceRect, g_colorSet->GetColor(COLOR_BLACK));
	primitives_FrameRect16(m_surface, &m_surfaceRect, g_colorSet->GetColor(COLOR_WHITE));
	primitives_FrameRect16(m_surface, &m_graphRect, g_colorSet->GetColor(COLOR_WHITE));

	DrawThisStateImage(
		0,
		m_surface,
		&m_surfaceRect );

	LabelAxes();
	DrawLines(eventsOfset);
	if (m_hasIndicator) DrawIndicator();
}
Esempio n. 7
0
void AdornedRulerPanel::DrawAdornedRuler(
   wxDC * dc, ViewInfo * pViewInfo, bool text, bool indicator, bool bRecording)
{
   wxRect r;

   mViewInfo = pViewInfo;

   GetSize(&r.width, &r.height);
   r.x = 0;
   r.y = 0;

   DrawBorder(dc, r);

   if (pViewInfo->sel0 < pViewInfo->sel1)
      DrawSelection(dc, r);

   if( indicator )
      DrawIndicator(dc, bRecording);

   DrawMarks(dc, r, text);

}