SectionLineSearchPanel.h

00001 
00011 #ifndef SECTIONLINESEARCHPANEL_H
00012 #define SECTIONLINESEARCHPANEL_H
00013 
00014 #include "DoubleParameterValidator.h"
00015 #include "EpsilonControl.h"
00016 #include "InitialSectionControl.h"
00017 #include "InitialSectionValidator.h"
00018 #include "MethodPanelInfo.h"
00019 #include "ui_util.h"
00020 
00021 template <class T>
00022 class SectionLineSearchPanel: public wxPanel
00023 {
00024 public:
00025 
00026     SectionLineSearchPanel(wxWindow*                parent,
00027                            int                      id,
00028                            T*                       pMethod,
00029                            bool                     standalone,
00030                            const wxPoint&           pos=wxDefaultPosition,
00031                            const wxSize&            size=wxDefaultSize,
00032                            long                     style=0);
00033 
00038     static wxPanel*         CreatePanel(MethodPanelInfo     panelInfo);
00039 
00040 
00041 private:
00042     void do_layout();
00043 
00044 protected:
00045     EpsilonControl* mpEpsilonControl;
00046     InitialSectionControl* mpInitialSectionControl;
00047     DoubleParameter mLeftBound;
00048     DoubleParameter mRightBound;
00049 };
00050 
00051 template <class T>
00052 SectionLineSearchPanel<T>::SectionLineSearchPanel
00053                                 (wxWindow*                  parent,
00054                                  int                        id,
00055                                  T*                         pMethod,
00056                                  bool                       standalone,
00057                                  const wxPoint&             pos,
00058                                  const wxSize&              size,
00059                                  long                       style)
00060     : wxPanel(parent, id, pos, size, wxTAB_TRAVERSAL)
00061 {
00062 
00063     // Podpanele.
00064     mpEpsilonControl = new EpsilonControl(this, -1, pMethod->mEpsilon);
00065 
00066     if (standalone)
00067     {
00068         mLeftBound  = pMethod->mInitialA;
00069         mRightBound = pMethod->mInitialB;
00070         mpInitialSectionControl = new InitialSectionControl(
00071                 this, -1, mLeftBound, mRightBound);
00072 
00073         this->SetValidator(InitialSectionValidator(
00074                     dynamic_cast<SectionLineSearch*>(pMethod),
00075                     mLeftBound, mRightBound));
00076     }
00077     else
00078     {
00079         mpInitialSectionControl = NULL;
00080     }
00081 
00082     do_layout();
00083 
00084 }// SectionLineSearchPanel
00085 
00086 template <class T>
00087 void SectionLineSearchPanel<T>::do_layout()
00088 {
00089     wxBoxSizer* sizer_23 = new wxBoxSizer(wxVERTICAL);
00090     sizer_23->Add(mpEpsilonControl, 1, wxEXPAND, 0);
00091     if (mpInitialSectionControl != NULL)
00092         sizer_23->Add(mpInitialSectionControl, 1, wxEXPAND, 0);
00093     SetAutoLayout(true);
00094     SetSizer(sizer_23);
00095     sizer_23->Fit(this);
00096     sizer_23->SetSizeHints(this);
00097 }
00098 
00099 template <class T>
00100 /* static */ wxPanel*
00101 SectionLineSearchPanel<T>::CreatePanel(MethodPanelInfo   panelInfo)
00102 {
00103     T* p_method = dynamic_cast<T*>(panelInfo.pMethod());
00104     bool standalone = panelInfo.PanelType() == MethodPanelInfo::STANDALONE;
00105 
00106     return new SectionLineSearchPanel<T>(panelInfo.pParent(), -1, p_method,
00107             standalone);
00108 
00109 }// CreatePanel
00110 
00111 #endif // SECTIONLINESEARCHPANEL_H

Wygenerowano Fri Sep 29 21:04:49 2006 dla EduOptim2 programem  doxygen 1.4.6