PointLineSearchPanel.h

00001 
00011 #ifndef POINTLINESEARCHPANEL_H
00012 #define POINTLINESEARCHPANEL_H
00013 
00014 #include "DoubleParameterValidator.h"
00015 #include "MethodPanelInfo.h"
00016 #include "PointControl.h"
00017 #include "ui_util.h"
00018 
00019 template <class T>
00020 class PointLineSearchPanel: public wxPanel
00021 {
00022 public:
00023 
00024     PointLineSearchPanel(wxWindow*              parent,
00025                          int                    id,
00026                          T*                     pMethod,
00027                          const wxPoint&         pos=wxDefaultPosition,
00028                          const wxSize&          size=wxDefaultSize,
00029                          long                   style=0);
00030 
00035     static wxPanel*         CreatePanel(MethodPanelInfo     panelInfo);
00036 
00037 
00038 private:
00039     void do_layout();
00040 
00041 protected:
00042     wxStaticText* mpEpsilonLabel;
00043     wxTextCtrl* mpEpsilonTextCtrl;
00044 };
00045 
00046 template <class T>
00047 PointLineSearchPanel<T>::PointLineSearchPanel
00048                                 (wxWindow*              parent,
00049                                  int                    id,
00050                                  T*                     pMethod,
00051                                  const wxPoint&         pos,
00052                                  const wxSize&          size,
00053                                  long                   style)
00054     : wxPanel(parent, id, pos, size, wxTAB_TRAVERSAL)
00055 {
00056     // Tworzenie kontrolek.
00057     mpEpsilonLabel = new wxStaticText(this, -1, _("Stop condition (\x03B5):"));
00058     mpEpsilonTextCtrl = new wxTextCtrl(this, -1, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_RIGHT);
00059 
00060     do_layout();
00061 
00062     // Walidator.
00063     mpEpsilonTextCtrl->SetValidator(DoubleParameterValidator(pMethod->mEpsilon));
00064 
00065 }// PointLineSearchPanel
00066 
00067 template <class T>
00068 void PointLineSearchPanel<T>::do_layout()
00069 {
00070     wxBoxSizer* sizer_23 = new wxBoxSizer(wxVERTICAL);
00071     wxGridSizer* grid_sizer_2 = new wxGridSizer(1, 2, 0, 0);
00072     grid_sizer_2->Add(mpEpsilonLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 2);
00073     grid_sizer_2->Add(mpEpsilonTextCtrl, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL|wxADJUST_MINSIZE, 0);
00074     sizer_23->Add(grid_sizer_2, 0, wxEXPAND, 0);
00075     SetAutoLayout(true);
00076     SetSizer(sizer_23);
00077     sizer_23->Fit(this);
00078     sizer_23->SetSizeHints(this);
00079 }
00080 
00081 template <class T>
00082 /* static */ wxPanel*
00083 PointLineSearchPanel<T>::CreatePanel(MethodPanelInfo   panelInfo)
00084 {
00085     T* p_method = dynamic_cast<T*>(panelInfo.pMethod());
00086 
00087     if (panelInfo.PanelType() == MethodPanelInfo::STANDALONE)
00088     {
00089         // Tworzy panel z panelu metody w kierunku oraz kontrolki
00090         // ustawiania odcinka początkowego.
00091         PointControl* p_starting_point = new PointControl(panelInfo.pParent(),
00092                 -1, wxDefaultPosition, wxDefaultSize, 0, _("Starting point"));
00093         p_starting_point->Init((panelInfo.pProblem())->Variables(),
00094                /*p_method->mStartingPoint*/p_method->mInitialStartingPoint);
00095 
00096         return CreatePanelOfTwo(
00097                 panelInfo.pParent(),
00098                 new PointLineSearchPanel<T>(panelInfo.pParent(), -1, p_method),
00099                 p_starting_point);
00100     }
00101     else
00102     {
00103         return new PointLineSearchPanel(panelInfo.pParent(), -1, p_method);
00104     }
00105 }// CreatePanel
00106 
00107 #endif // SECTIONLINESEARCHPANEL_H

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