#include <wx/wx.h>
#include <wx/textctrl.h>
#include <wx/checkbox.h>
#include <wx/tglbtn.h>
#include <wx/choice.h>
#include <wx/button.h>
#include <wx/frame.h>
#include <wx/timer.h>
#include <wx/spinctrl.h>


#include "port.h"
#include "define.h"

		#define ID_BUTTON1 1001
        #define ID_STATICTEXT1 1002
        #define ID_STATICTEXT2 1003
        #define ID_STATICTEXT3 1004
        #define ID_STATICTEXT4 1005
        #define ID_STATICTEXT5 1006
        #define ID_STATICTEXT6 1007
        #define ID_STATICTEXT7 1008
        #define ID_STATICTEXT8 1008
        #define ID_SPINCTRL1 1009
        #define ID_COMBOBOX1 1010
        #define ID_COMBOBOX2 1011
        #define ID_COMBOBOX3 1012
        #define ID_COMBOBOX4 1013
        #define ID_COMBOBOX5 1014
        #define ID_COMBOBOX6 1015
        #define ID_COMBOBOX7 1016
        #define ID_SPINCTRL2 1017
        #define ID_BUTTON2 1018
        #define ID_CHECKBOX1 1019
        #define ID_TEXTCTRL1 1020
        #define ID_CHECKBOX2 1021
        #define ID_TEXTCTRL2 1022
        #define ID_BUTTON3 1023
        #define ID_TIMER 1024

char VARI[100];
#if YesWindows
    static 	char *myport[]= {"com1","com2","com3","com4","com5","com6","com7","com8","com9","\\\\.\\COM10","\\\\.\\COM11","\\\\.\\COM12"};
#else
	static char *myport[]= {(char *)"/dev/ttyUSB0", (char *)"/dev/ttyUSB1", (char *)"/dev/ttyACM0", (char *)"/dev/ttyACM1", (char *)"/dev/ttyACM2", (char *)"/dev/ttyS0", (char *)"/dev/ttyS1"};
#endif	


class MiFrame: public wxFrame
{
public:
    MiFrame(wxWindow* parent,wxWindowID id = -1);
	virtual ~MiFrame();
	
	void SendData(void);
	
	wxClientDC * dcPantalla;
	wxMemoryDC * dcBuffer;
	wxBitmap 	*m_bitmap;
	
private:
	
		void OnBexitClick(wxCommandEvent& event);
        void OnOsampleAverageSelected(wxCommandEvent& event);
        void OnOledModeSelected(wxCommandEvent& event);
        void OnOsampleRateSelected(wxCommandEvent& event);
        void OnOpulseWidthSelected(wxCommandEvent& event);
        void OnOadcRangeSelected(wxCommandEvent& event);
        void OnOdisplaySelected(wxCommandEvent& event);
        void OnOindexChange(wxSpinEvent& event);
 //       void OnClose(wxCloseEvent& event);
        void OnOzoomSelected(wxCommandEvent& event);
        void OnOpauseClick(wxCommandEvent& event);
        void OnOledBrightnessChange(wxSpinEvent& event);
        void OnTimer1Trigger(wxTimerEvent& event);
        void OnPaint(wxPaintEvent& event);
        void OnOclearClick(wxCommandEvent& event);
        void OnOresetClick(wxCommandEvent& event);
        
		wxComboBox* OadcRange;
        wxButton* Oreset;
        wxStaticText* StaticText2;
        wxSpinCtrl* Oindex;
        wxComboBox* Ozoom;
        wxStaticText* StaticText6;
        wxTextCtrl* Oinfo;
        wxSpinCtrl* OledBrightness;
        wxTextCtrl* Obmp;
        wxStaticText* StaticText1;
        wxStaticText* StaticText3;
        wxComboBox* OledMode;
        wxCheckBox* Opause;
        wxStaticText* StaticText5;
        wxStaticText* StaticText7;
        wxComboBox* Odisplay;
        wxTimer MiTimer;
        wxButton* Bexit;
        wxComboBox* OsampleAverage;
        wxComboBox* OsampleRate;
        wxStaticText* StaticText4;
        wxComboBox* OpulseWidth;
        wxButton* Oclear;
        wxCheckBox* Opulso;
        wxStaticText* StaticText8;
   //_________________________________     
         DECLARE_EVENT_TABLE()   		
};

class MiAplicacion : public wxApp
{
public:
    virtual bool OnInit();
};

bool MiAplicacion::OnInit()
{
	wxInitAllImageHandlers();
    MiFrame* Frame = new MiFrame(0);
    Frame->Show();
    return true;
}

