00001
00010 #ifndef VARIANTEDMETHODWITHLINESEARCHPANEL_H
00011 #define VARIANTEDMETHODWITHLINESEARCHPANEL_H
00012
00013 #include <wx/valgen.h>
00014
00015 #include "DoubleParameterValidator.h"
00016 #include "LineSearchControl.h"
00017 #include "LineSearchValidator.h"
00018 #include "MethodPanelInfo.h"
00019 #include "MethodPanelFactory.h"
00020 #include "MethodWithLineSearchPanel.h"
00021 #include "PointControl.h"
00022 #include "StopConditionControl.h"
00023 #include "StopConditionValidator.h"
00024
00025 template <class T>
00026 class VariantedMethodWithLineSearchPanel
00027 : public MethodWithLineSearchPanel<T>
00028 {
00029 public:
00030
00033 VariantedMethodWithLineSearchPanel
00034 (wxWindow* parent,
00035 int id,
00036 T* pMethod,
00037 const ProblemBase& problem,
00038 const wxPoint& pos=wxDefaultPosition,
00039 const wxSize& size=wxDefaultSize,
00040 long style=0);
00041
00046 static wxPanel* CreatePanel(MethodPanelInfo panelInfo);
00047
00048 private:
00049
00050 void do_layout();
00051
00052 protected:
00053
00054
00055
00056
00057 wxBoxSizer* mpModificationSizer;
00058 wxCheckBox* mpModificationCheckBox;
00059 };
00060
00061 template <class T>
00062 VariantedMethodWithLineSearchPanel<T>::VariantedMethodWithLineSearchPanel
00063 (wxWindow* parent,
00064 int id,
00065 T* pMethod,
00066 const ProblemBase& problem,
00067 const wxPoint& pos,
00068 const wxSize& size,
00069 long style)
00070 : MethodWithLineSearchPanel<T>
00071 (parent, id, pMethod, problem, pos, size, style)
00072 {
00073
00074
00075 mpModificationSizer = new wxBoxSizer
00076 (wxVERTICAL);
00077
00078 mpModificationCheckBox = new wxCheckBox(this,
00079 -1,
00080 _("Use modification"),
00081 wxDefaultPosition,
00082 wxDefaultSize,
00083 0,
00084 wxDefaultValidator
00085
00086 );
00087
00088 do_layout();
00089
00090
00091 mpModificationCheckBox->SetValidator
00092 (wxGenericValidator(&(pMethod->mModification)));
00093
00094 }
00095
00096
00097 template <class T>
00098 wxPanel*
00099 VariantedMethodWithLineSearchPanel<T>::CreatePanel(MethodPanelInfo panelInfo)
00100 {
00101 return new VariantedMethodWithLineSearchPanel(
00102 panelInfo.pParent(),
00103 -1,
00104 dynamic_cast<T*>(panelInfo.pMethod()),
00105 *panelInfo.pProblem());
00106
00107 }
00108
00109 template <class T>
00110 void
00111 VariantedMethodWithLineSearchPanel<T>::do_layout()
00112 {
00113
00114 MethodWithLineSearchPanel<T>::do_layout();
00115
00116 mpModificationSizer->Add(mpModificationCheckBox, 0, wxEXPAND, 0);
00117
00118 MethodWithLineSearchPanel<T>::mpMainSizer->Insert
00119 (0, mpModificationSizer, 0, wxEXPAND, 0);
00120
00121 wxPanel::SetAutoLayout(true);
00122 SetSizer(MethodWithLineSearchPanel<T>::mpMainSizer);
00123 MethodWithLineSearchPanel<T>::mpMainSizer->Fit(this);
00124 MethodWithLineSearchPanel<T>::mpMainSizer->SetSizeHints(this);
00125
00126 }
00127
00128 #endif // VARIANTEDMETHODWITHLINESEARCHPANEL_H