summaryrefslogtreecommitdiff
path: root/win/Steppop.cpp
diff options
context:
space:
mode:
authordocwhat1999-11-14 06:43:18 +0000
committerdocwhat1999-11-14 06:43:18 +0000
commitd71eec8062e852e56f03102ba4b4e87dc485821d (patch)
tree452368ad0e7e24627e517a0c88c2508d02cea6dc /win/Steppop.cpp
parent2046090b7ce8dd901ce43e650be5acf44016d714 (diff)
Initial revision
git-svn-id: http://svn.leocad.org/trunk@2 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'win/Steppop.cpp')
-rw-r--r--win/Steppop.cpp88
1 files changed, 88 insertions, 0 deletions
diff --git a/win/Steppop.cpp b/win/Steppop.cpp
new file mode 100644
index 0000000..38b4069
--- /dev/null
+++ b/win/Steppop.cpp
@@ -0,0 +1,88 @@
+// StepPop.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "leocad.h"
+#include "StepPop.h"
+#include "project.h"
+#include "globals.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CStepPopup
+
+CStepPopup::CStepPopup()
+{
+}
+
+CStepPopup::CStepPopup(CPoint pt, CWnd* pParentWnd)
+{
+ pt.x = min (pt.x, GetSystemMetrics(SM_CXSCREEN)-100);
+ pt.y = min (pt.y, GetSystemMetrics(SM_CYSCREEN)-45);
+
+ CString szClassName = AfxRegisterWndClass(CS_SAVEBITS|CS_HREDRAW|CS_VREDRAW, 0, (HBRUSH)GetStockObject(LTGRAY_BRUSH),0);
+ CWnd::CreateEx(0, szClassName, _T(""), WS_VISIBLE|WS_POPUP|WS_DLGFRAME,
+ pt.x, pt.y, 100, 45, pParentWnd->GetSafeHwnd(), 0, NULL);
+
+ m_Slider.Create (WS_CHILD|WS_VISIBLE|TBS_BOTH|TBS_HORZ|TBS_NOTICKS, CRect(5,10,90,30), this, 1000);
+
+ int from, to;
+ project->GetTimeRange(&from, &to);
+ m_Slider.SetRange(1, to);
+ m_Slider.SetPos(from);
+}
+
+CStepPopup::~CStepPopup()
+{
+}
+
+
+BEGIN_MESSAGE_MAP(CStepPopup, CWnd)
+ //{{AFX_MSG_MAP(CStepPopup)
+ ON_WM_NCDESTROY()
+ ON_WM_KILLFOCUS()
+ ON_WM_ACTIVATEAPP()
+ ON_WM_HSCROLL()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CStepPopup message handlers
+
+void CStepPopup::OnNcDestroy()
+{
+ AfxGetMainWnd()->SendMessage(WM_LC_POPUP_CLOSE);
+ CWnd::OnNcDestroy();
+ delete this;
+}
+
+void CStepPopup::OnKillFocus(CWnd* pNewWnd)
+{
+ CWnd::OnKillFocus(pNewWnd);
+
+ if (pNewWnd && (pNewWnd->m_hWnd != m_Slider.m_hWnd))
+ DestroyWindow();
+}
+
+void CStepPopup::OnActivateApp(BOOL bActive, HTASK hTask)
+{
+ CWnd::OnActivateApp(bActive, hTask);
+
+ if (!bActive)
+ DestroyWindow();
+}
+
+void CStepPopup::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+ int pos = m_Slider.GetPos();
+ if (pos > 0)
+ project->HandleCommand(LC_VIEW_STEP_SET, pos);
+
+ CWnd::OnHScroll(nSBCode, nPos, pScrollBar);
+}