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

Editor_Int.h

00001 #ifndef EDITOR_INT_H
00002 #define EDITOR_INT_H
00003 
00004 #include "Panel.h"
00005 #include "AbstractEditor.h"
00006 #include "Panel_Int.h"
00007 
00008 class VEditor_Int : public VAbstractEditor
00009 {
00010 protected:
00011         int* m_pValue;
00012         VPanel_Int* m_pPanel;
00013         CString m_sLabel;
00014 
00015 public:
00016         VEditor_Int(int* pValue) : m_sLabel("")
00017         {
00018                 m_pPanel = NULL;
00019                 m_pValue = pValue;
00020         }
00021 
00022         ~VEditor_Int()
00023         {
00024                 if (m_pPanel != NULL)
00025                         EndPanel();
00026         }
00027 
00029         void CreatePanel(CWnd* pParent, CRect rcWindowLocation)
00030         {
00031                 if (m_pPanel != NULL) // there already is a panel open
00032                         EndPanel();
00033 
00034                 m_pPanel = new VPanel_Int(pParent);
00035                 if (m_pPanel)
00036                 {
00037                         m_pPanel->Create(IDD_PANEL_NUMBER, pParent);
00038                         m_pPanel->EnableWindow(TRUE);
00039 
00040                         m_pPanel->m_NUM = *m_pValue;
00041                         m_pPanel->m_LabelText = m_sLabel;
00042 
00043                         m_pPanel->UpdateData(FALSE);
00044                         m_pPanel->ShowWindow(SW_SHOW);
00045                         // move the window to fit the space
00046                         m_pPanel->MoveWindow(rcWindowLocation.left, rcWindowLocation.top, rcWindowLocation.Width(), rcWindowLocation.Height(), FALSE);
00047                 }
00048         }
00049 
00051         void SetLabel(CString sLabel)
00052         {
00053                 m_sLabel = sLabel; // copy the new label
00054 
00055                 if (m_pPanel != NULL) // if a panel exists, push the new label
00056                 {
00057                         m_pPanel->m_LabelText = m_sLabel;
00058                         m_pPanel->UpdateData(FALSE);
00059                 }
00060         }
00061 
00063         void EndPanel()
00064         {
00065                 if (m_pPanel != NULL) { 
00066                         m_pPanel->UpdateData(TRUE);
00067                         *m_pValue = m_pPanel->m_NUM;
00068                         m_pPanel->DestroyWindow();
00069                         delete m_pPanel;
00070                         m_pPanel = NULL;
00071                 }
00072         }
00073 
00074 };
00075 
00076 
00077 #endif

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