summaryrefslogtreecommitdiff
path: root/win/cadbar.cpp
blob: d40466da683b2c7d698600125edd23cb78a32ba6 (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
// CADBar.cpp: implementation of the CCADStatusBar class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "leocad.h"
#include "CADBar.h"
#include "StepPop.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

BEGIN_MESSAGE_MAP(CCADStatusBar, CStatusBar)
	//{{AFX_MSG_MAP(CCADStatusBar)
	ON_WM_LBUTTONDOWN()
	ON_WM_RBUTTONDOWN()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CCADStatusBar::CCADStatusBar()
{
	m_pPopup = NULL;
}

CCADStatusBar::~CCADStatusBar()
{

}

void CCADStatusBar::OnLButtonDown(UINT nFlags, CPoint point)
{
	CRect rect;
	GetItemRect(CommandToIndex(ID_INDICATOR_STEP), rect);
	if (rect.PtInRect(point))
	{
		ClientToScreen(rect);
		m_pPopup = new CStepPopup(CPoint(rect.left, rect.top), this);
	}

	GetItemRect(CommandToIndex(ID_INDICATOR_SNAP), rect);
	if (rect.PtInRect(point))
	{
		ClientToScreen(&point);
		CMenu menuPopups;
		menuPopups.LoadMenu(IDR_POPUPS);
		CMenu* pMenu = menuPopups.GetSubMenu(7);
		pMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON, point.x, point.y, AfxGetMainWnd());
	}

	CStatusBar::OnLButtonDown(nFlags, point);
}

void CCADStatusBar::OnRButtonDown(UINT nFlags, CPoint point) 
{
	CRect rect;
	GetItemRect(CommandToIndex(ID_INDICATOR_STEP), rect);
	if (rect.PtInRect(point))
		AfxGetMainWnd()->PostMessage(WM_COMMAND, ID_VIEW_STEP_CHOOSE);
	
	CStatusBar::OnRButtonDown(nFlags, point);
}