Vlaxicon

objectbase.h

00001 #ifndef __OBJECTSBASE__
00002 #define __OBJECTSBASE__
00003 #ifndef WX_PRECOMP
00004 #include <wx/wx.h>
00005 #endif //WX_PRECOMP
00006 
00007 #include "wx/wxsf/wxShapeFramework.h"
00008 #include "interfaces/interface.h"
00009 class ObjectBaseShape:public wxSFControlShape {
00010 public:
00011         enum OBJECT_ID {
00012                 ID_UNIVERSAL_TOOL,
00013                 ID_PLOT_TOOL,
00014                 ID_CHOICE_TOOL,
00015                 ID_CHECKBOX_TOOL,
00016                 ID_STATICTEXT_TOOL,
00017                 ID_SLIDER_TOOL
00018         };
00019 
00020         XS_DECLARE_CLONABLE_CLASS(ObjectBaseShape);
00021         
00023         ObjectBaseShape();
00024         
00027         ObjectBaseShape(const ObjectBaseShape& obj);
00028 
00030         void ClearProperties();
00031 
00034         void SetType(const OBJECT_ID& Type) {
00035                 this->m_Type = Type;
00036         }
00037         
00040         const OBJECT_ID& GetType() const {
00041                 return m_Type;
00042         }
00043         
00046         void SetSVISA(const wxString& sVISAAddr) {
00047                 this->sVISA = sVISAAddr;
00048         }
00049         
00052         const wxString& GetSVISA() const {
00053                 return sVISA;
00054         }
00055         
00058         void SetSSCPI(const wxString& sSCPICom) {
00059                 this->sSCPI = sSCPICom;
00060         }
00061         
00064         const wxString& GetSSCPI() const {
00065                 return sSCPI;
00066         }
00067         
00070         void SetSOutType(const wxString& sOut) {
00071                 this->sOutType = sOut;
00072         }
00073         
00076         const wxString& GetSOutType() const {
00077                 return sOutType;
00078         }
00079         
00082         void SetSComPlugin(const wxString& sPlugin) {
00083                 this->sComPlugin = sPlugin;
00084         }
00085         
00088         const wxString& GetSComPlugin() const {
00089                 return sComPlugin;
00090         }
00091         
00094         void SetDRangeFrom(double dRange) {
00095                 this->dRangeFrom = dRange;
00096         }
00097         
00100         void SetDRangeTo(double dRange) {
00101                 this->dRangeTo = dRange;
00102         }
00103         
00106         void SetDStep(double dStepVal) {
00107                 this->dStep = dStepVal;
00108         }
00109         
00112         double GetDRangeFrom() const {
00113                 return dRangeFrom;
00114         }
00115         
00118         double GetDRangeTo() const {
00119                 return dRangeTo;
00120         }
00121         
00124         double GetDStep() const {
00125                 return dStep;
00126         }
00127         
00130         void SetArrChoices(const wxArrayString& choices) {
00131                 this->arrChoices = choices;
00132         }
00133         
00136         const wxArrayString& GetArrChoices() const {
00137                 return arrChoices;
00138         }
00139         
00142         void SetSLabel(const wxString& label) {
00143                 this->sLabel = label;
00144         }
00145         
00148         void SetSParFalse(const wxString& sPar) {
00149                 this->sParFalse = sPar;
00150         }
00151         
00154         void SetSParTrue(const wxString& sPar) {
00155                 this->sParTrue = sPar;
00156         }
00157         
00160         const wxString& GetSLabel() const {
00161                 return sLabel;
00162         }
00163         
00166         const wxString& GetSParFalse() const {
00167                 return sParFalse;
00168         }
00169         
00172         const wxString& GetSParTrue() const {
00173                 return sParTrue;
00174         }
00175         
00178         void SetCurCheckbox(bool bCheckbox) {
00179                 this->cur_checkbox = bCheckbox;
00180         }
00181         
00184         bool GetCurCheckbox() const {
00185                 return cur_checkbox;
00186         }
00187         
00190         void SetCurChoice(const wxString& choice) {
00191                 this->cur_choice = choice;
00192         }
00193         
00196         const wxString& GetCurChoice() const {
00197                 return cur_choice;
00198         }
00199         
00202         void SetCurSlider(int slider) {
00203                 this->cur_slider = slider;
00204         }
00205         
00208         int GetCurSlider() const {
00209                 return cur_slider;
00210         }
00211 protected:
00212         OBJECT_ID m_Type;
00213         wxString sVISA;
00214         wxString sSCPI;
00215         wxString sOutType;
00216         wxString sComPlugin;
00217         double dRangeFrom, dRangeTo, dStep;
00218         wxArrayString arrChoices;
00219         wxString sLabel;
00220         wxString sParTrue, sParFalse;
00221         bool cur_checkbox;
00222         wxString cur_choice;
00223         int cur_slider;
00224 
00225 
00226 };
00227 
00228 class ObjectBase:public wxScrolledWindow {
00229 public:
00230         
00239         ObjectBase(wxWindow* parent, ObjectBaseShape* parentShape, wxWindowID id=wxID_ANY, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString& name= wxT("panel"));
00240         
00242         void ReconnectKeyboard();
00243         
00246         bool SetPlugin();
00247         
00250         bool InitCom();
00251         
00254         bool IsComInit() {
00255                 return bComInit;
00256         }
00257         
00259         void CloseCom();
00260         
00263         bool IsComError() {
00264                 return bComError;
00265         }
00266 
00267 
00270         unsigned char* GetCArrQueryValue() {
00271                 return cArrQueryValue;
00272         }
00273         
00276         double GetDQueryValue() const {
00277                 return dQueryValue;
00278         }
00279         
00282         const wxString& GetSQueryValue() const {
00283                 return sQueryValue;
00284         }
00285         
00288         int GetDataLength() const {
00289                 return data_length;
00290         }
00291         
00294         int DoSCPICommand(wxString sParam=wxT(""));
00295         
00296 protected:
00297         wxWindow* m_pParent;
00298         ObjectBaseShape* m_pParentShape;
00299         double dQueryValue;
00300         wxString sQueryValue;
00301         double* dArrQueryValue;
00302         unsigned char* cArrQueryValue;
00303         bool bComError;
00304         int data_length;
00305         bool bComInit;
00306 
00307         IPlugin* comPlugin;
00308 
00310         void OnKeyDown(wxKeyEvent& event);
00311         
00312 };
00313 
00314 
00315 
00316 #endif //__OBJECTSBASE__
 All Classes Functions