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

Editor_VColor.h

00001 #ifndef EDITOR_VCOLOR_H
00002 #define EDITOR_VCOLOR_H
00003 
00004 #include "Panel.h"
00005 #include "Color.h"
00006 #include "AbstractEditor.h"
00007 #include "Panel_VColor.h"
00008 
00009 class VEditor_VColor : public VAbstractEditor
00010 {
00011 protected:
00012         VColor* m_pColor;
00013         VPanel_VColor* m_pPanel;
00014 
00015 public:
00016         VEditor_VColor(VColor* pColor)
00017         {
00018                 m_pPanel = NULL;
00019                 m_pColor = pColor;
00020         }
00021 
00022         ~VEditor_VColor()
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_VColor(pParent);
00035                 if (m_pPanel)
00036                 {
00037                         m_pPanel->Create(IDD_PANEL_COLOR, pParent);
00038                         m_pPanel->EnableWindow(TRUE);
00039 
00040                         m_pPanel->m_R = m_pColor->GetRed();
00041                         m_pPanel->m_G = m_pColor->GetGreen();
00042                         m_pPanel->m_B = m_pColor->GetBlue();
00043                         m_pPanel->m_bOpaque = m_pColor->IsOpaque();
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 
00058                         m_pColor->SetRed( m_pPanel->m_R );
00059                         m_pColor->SetGreen( m_pPanel->m_G );
00060                         m_pColor->SetBlue( m_pPanel->m_B );
00061 
00062                         m_pColor->SetOpaque( m_pPanel->m_bOpaque );
00063 
00064                         m_pPanel->DestroyWindow();
00065                         delete m_pPanel;
00066                         m_pPanel = NULL;
00067                 }
00068         }
00069 
00070 };
00071 
00072 
00073 
00074 #endif

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