Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

Editor_Degrees.h

00001 #ifndef EDITOR_DEGREES_H
00002 #define EDITOR_DEGREES_H
00003 
00004 #include "Panel.h"
00005 #include "AbstractEditor.h"
00006 #include "Panel_Int.h"
00007 
00008 #include "stdafx.h"
00009 
00011 class VEditor_Degrees : public VAbstractEditor
00012 {
00013 protected:
00014         float* m_pValue; // internal value is in radians, but the editor is in degrees
00015         VPanel_Int* m_pPanel;
00016 
00017 public:
00018         VEditor_Degrees(float* pValue)
00019         {
00020                 m_pPanel = NULL;
00021                 m_pValue = pValue;
00022         }
00023 
00024         ~VEditor_Degrees()
00025         {
00026                 if (m_pPanel != NULL)
00027                         EndPanel();
00028         }
00029 
00031         void CreatePanel(CWnd* pParent, CRect rcWindowLocation)
00032         {
00033                 if (m_pPanel != NULL) // there already is a panel open
00034                         EndPanel();
00035 
00036                 m_pPanel = new VPanel_Int(pParent);
00037                 if (m_pPanel != NULL)
00038                 {
00039                         m_pPanel->Create(IDD_PANEL_NUMBER, pParent);
00040                         m_pPanel->EnableWindow(TRUE);
00041 
00042                         m_pPanel->m_NUM = (int) (*m_pValue * 180 / PI); //rads to degrees
00043                         m_pPanel->m_LabelText = L"°";
00044 
00045                         m_pPanel->UpdateData(FALSE);
00046                         m_pPanel->ShowWindow(SW_SHOW);
00047                         // move the window to fit the space
00048                         m_pPanel->MoveWindow(rcWindowLocation.left, rcWindowLocation.top, rcWindowLocation.Width(), rcWindowLocation.Height(), FALSE);
00049                 }
00050         }
00051 
00053         void EndPanel()
00054         {
00055                 if (m_pPanel != NULL) { 
00056                         m_pPanel->UpdateData(TRUE);
00057                         *m_pValue =  (float) ((PI * m_pPanel->m_NUM) / 180);
00058                         m_pPanel->DestroyWindow();
00059                         delete m_pPanel;
00060                         m_pPanel = NULL;
00061                 }
00062         }
00063 
00064 };
00065 
00066 
00067 #endif

Generated at Wed Aug 29 19:58:55 2001 for Pocket Animator by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001