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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| const int ID_COMBOBOX = 101;
const int BUTTON2 = 102;
const int BUTTON3 = 103;
// Implements MyApp& GetApp()
DECLARE_APP(MyApp)
// Give wxWidgets the means to create a MyApp object
IMPLEMENT_APP(MyApp)
// Initialize the application
bool MyApp::OnInit()
{
imageHandler = new wxJPEGHandler;
wxImage::AddHandler(imageHandler);
// Create the main application window
frame = new MyFrame(wxT("Test"));
// Show it
frame->Show(true);
// Start the event loop
return true;
}
int MyApp::OnExit()
{
return 0;
}
// Event table for MyFrame
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
EVT_BUTTON(BUTTON2, MyFrame::OnButton)
EVT_BUTTON(BUTTON3, MyFrame::OnLink)
END_EVENT_TABLE()
void MyFrame::OnQuit(wxCommandEvent& event)
{
// Destroy the frame
Close(true);
}
MyFrame::MyFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxDefaultSize)
{
choices.Add(wxT("Aymeric"));
choices.Add(wxT("Bruno"));
panel = new wxPanel(this);
panel->SetBackgroundColour(*wxWHITE);
topSizer = new wxBoxSizer(wxVERTICAL);
wxImage image(wxT("C:\\Documents and Settings\\Clément\\Bureau\\images.jpg"), wxBITMAP_TYPE_JPEG);
bitmap = new wxBitmap(image);
staticBitmap = new wxStaticBitmap(panel, wxID_STATIC, *bitmap, wxDefaultPosition, wxDefaultSize);
topSizer->Add(staticBitmap, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 5);
comboBox = new wxComboBox(panel, ID_COMBOBOX, wxT("Aymeric"), wxDefaultPosition, wxDefaultSize, choices, wxCB_DROPDOWN);
topSizer->Add(comboBox, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 5);
link = new wxButton(panel, BUTTON3, "Creation d'un nouveau profil");
link->SetForegroundColour(*wxBLUE);
link->SetWindowStyle(wxBORDER_NONE);
topSizer->Add(link, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 5);
button = new wxButton(panel, BUTTON2, _T("Ok"), wxDefaultPosition, wxSize(50,30), wxID_JUSTIFY_CENTER);
topSizer->Add(button, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 5);
topSizer->SetSizeHints(this);
SetSizer(topSizer);
} |
Partager