1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
   | #include "ffwrapper.hpp"
#include <wx/gbsizer.h>
 
// Fenêtre principal (seul fenêtre)
MyFrame::MyFrame(std::string var) : wxFrame(NULL, -1, "Wrapper FineFocus XXXX",
						wxDefaultPosition, wxDefaultSize,
						wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN)
{
	// Définition du panel et du grid
	wxPanel *panel = new wxPanel(this, -1);
	wxGridBagSizer *grid_BS = new wxGridBagSizer(0, 0);
	panel->SetSizerAndFit(grid_BS);
 
	// Définition du RadioBox "Action"
	wxArrayString action_list;
	action_list.Add("Sauvegarder");
	action_list.Add("Restaurer");
	wxRadioBox *ActionBox = new wxRadioBox(panel, -1, "1-Choisir l'action a effectuer", wxDefaultPosition, wxDefaultSize, action_list, 1, wxRA_SPECIFY_COLS);
 
	// Définition du RadioBox "Focuser"
	wxArrayString focuser_list;
	focuser_list.Add("Focuser C8");
	focuser_list.Add("Crayford C8");	
	focuser_list.Add("Crayford LU80");
	wxRadioBox *FocuserBox = new wxRadioBox(panel, -1, "2-Choisir le focuser à utiliser", wxDefaultPosition, wxDefaultSize, focuser_list, 1, wxRA_SPECIFY_COLS);
 
	// Définition des boutons
	wxButton *CloseButton = new wxButton(panel, -1, "Fermer", wxPoint(20,20), wxDefaultSize);
	wxButton *ProcessButton = new wxButton(panel, -1, "3-Lancer FineFocus", wxPoint(20,20), wxDefaultSize);
 
	grid_BS->Add(ActionBox, wxGBPosition(0, 0), wxGBSpan(1, 1), wxTOP | wxBOTTOM | wxLEFT | wxRIGHT, 15, NULL);
	grid_BS->Add(FocuserBox, wxGBPosition(0, 1), wxGBSpan(1, 1), wxTOP | wxBOTTOM |wxRIGHT, 15, NULL);
	grid_BS->Add(ProcessButton, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER | wxBOTTOM |wxLEFT, 15, NULL);
	grid_BS->Add(CloseButton, wxGBPosition(1, 1), wxGBSpan(1, 1), wxALIGN_CENTER | wxBOTTOM |wxLEFT | wxRIGHT, 15, NULL);
 
	// Bind des boutons
	CloseButton->Bind(wxEVT_BUTTON, &MyFrame::OnQuit, this);
	ProcessButton->Bind(wxEVT_BUTTON, &MyFrame::OnProcess, this);
 
	grid_BS->Fit(this);
	grid_BS->SetSizeHints(this);
}
 
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) 
{
    // Bouton fermeture
	this->Close(true);
}
 
void MyFrame::OnProcess(wxCommandEvent& WXUNUSED(event))
{
	wxString focuser = FocuserBox.GetStringSelection();
	wxString action = ActionBox.GetStringSelection();
    // à partir de là... code des process sauvegarde et restauration
} | 
Partager