Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   Related Pages  

wxRefinableObj.h

00001 /*
00002 * LibCryst++ : a Crystallographic computing library in C++
00003 *
00004 *  (c) 2000 Vincent FAVRE-NICOLIN
00005 *           Laboratoire de Cristallographie
00006 *           24, quai Ernest-Ansermet, CH-1211 Geneva 4, Switzerland
00007 *  Contact: Vincent.Favre-Nicolin@cryst.unige.ch
00008 *           Radovan.Cerny@cryst.unige.ch
00009 *
00010 */
00011 /*
00012 *  header file for the RefinablePar and RefinableObj classes
00013 *
00014 * This is still in early development stages !! Not secure !
00015 *
00016 */
00017 
00018 #ifndef _VFN_WX_REFINABLE_OBJ_H_
00019 #define _VFN_WX_REFINABLE_OBJ_H_
00020 
00021 namespace ObjCryst
00022 {
00023 template<class T> class WXRegistry;
00024 class WXFieldOption;
00025 } //namespace
00026 
00027 #include "wxCryst/wxCryst.h"
00028 
00029 // We should not have to put this here. !! :TODO:
00030 #include "RefinableObj/RefinableObj.h"
00031 
00032 namespace ObjCryst
00033 {
00034 
00037 template<class T> T* WXDialogChooseFromRegistry(ObjRegistry<T> &reg,wxWindow*parent,
00038                                                 const string &message,int &);
00041 template<class T> const T* WXDialogChooseFromRegistry(const ObjRegistry<T> &reg,
00042                                                       wxWindow*parent, const string &message,
00043                                                       int &);
00044 
00048 class WXFieldRefPar:public WXField
00049 {
00050    public:
00051       WXFieldRefPar(wxWindow *parent,const string& label, 
00052                     RefinablePar *refpar,const int hsize=50);
00055       void OnUpdateUI(wxUpdateUIEvent & WXUNUSED(event));
00060       void OnEnter(wxCommandEvent & WXUNUSED(event));
00062       void OnToggleFix(wxCommandEvent & WXUNUSED(event));
00064       void OnPopupMenu(wxCommandEvent & event);
00066       void OnPopupMenuChoice(wxMenuEvent& event);
00069       void CrystUpdate();
00071       RefinablePar& GetRefPar();
00072       void Revert();
00073    protected:
00074       double mValue;
00075       wxCheckBox *mpButtonFix;
00076       wxTextCtrl *mpField;
00077       RefinablePar *mpRefPar;
00078       double mValueOld;
00079       wxMenu *mpPopUpMenu;
00080    DECLARE_EVENT_TABLE()
00081 };
00082 
00083 class RefObjOpt;// Declared in RefinableObj.h
00085 class WXFieldOption:public WXField
00086 {
00087    public:
00088       WXFieldOption(wxWindow *parent,const int field_id,
00089                     RefObjOpt* option);
00090       virtual ~WXFieldOption();
00091       void OnUpdateUI(wxUpdateUIEvent & WXUNUSED(event));
00095       void OnChoice(wxCommandEvent & WXUNUSED(event));
00096       virtual void CrystUpdate();
00097       void Revert();
00098    protected:
00099       int mChoice;
00100       int mChoiceOld;
00101       RefObjOpt* mpOption;
00102       wxChoice *mpList;
00103    DECLARE_EVENT_TABLE()
00104 };
00105 
00107 class WXCostFunction:public WXField
00108 {
00109    public:
00110       WXCostFunction(wxWindow *parent,RefinableObj *obj, const int field_id,
00111                      const int funcNum,double * weight);
00112       void OnUpdateUI(wxUpdateUIEvent & WXUNUSED(event));
00113       void OnEnter(wxCommandEvent & WXUNUSED(event));
00114       virtual void CrystUpdate();
00115       virtual void Revert();
00116    protected:
00117       wxTextCtrl *mpValue;
00118       double mValue;
00119       RefinableObj *mpObj;
00120       const int mFuncNum;
00121       WXFieldPar<double> *mpWeight;
00122    DECLARE_EVENT_TABLE()
00123 };
00124 
00125 
00127 template<class T> class WXRegistry:public WXCrystObj
00128 {
00129    public:
00130       WXRegistry(wxWindow *parent,ObjRegistry<T>* reg);
00131       ~WXRegistry();
00132       void Add(WXCrystObjBasic *obj);
00133       void Remove(WXCrystObjBasic *obj);
00134       virtual bool OnChangeName(const int id);
00135    private:
00136       ObjRegistry<T> *mpRegistry;
00137 };
00138                                                       
00141 class WXRefinableObj: public WXCrystObj
00142 {
00143    public:
00144       WXRefinableObj(wxWindow *parent, RefinableObj*);
00145       ~WXRefinableObj();
00146       bool Layout();
00147       virtual void CrystUpdate();
00148       virtual bool OnChangeName(const int id);
00149       void OnMenuSave(wxCommandEvent & WXUNUSED(event));
00150       void OnMenuLoad(wxCommandEvent & WXUNUSED(event));
00151       void OnMenuFixAllPar(wxCommandEvent & WXUNUSED(event));
00152       void OnMenuUnFixAllPar(wxCommandEvent & WXUNUSED(event));
00153       void OnMenuParRandomize(wxCommandEvent & WXUNUSED(event));
00154    protected:
00155       WXCrystMenuBar* mpMenuBar;
00156    private:
00157       RefinableObj* mpRefinableObj;
00158    DECLARE_EVENT_TABLE()
00159 };
00160 } //namespace
00161 
00162 #endif //_VFN_WX_REFINABLE_OBJ_H_

Generated on Wed Nov 14 19:48:36 2001 for ObjCryst++ by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001