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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include "mainframe.h"
#include "dialogs.h"
BEGIN_EVENT_TABLE(CMainFrame, wxFrame)
EVT_MENU(MENU_VER,CMainFrame::OnAPropos)
EVT_MENU(MENU_EPAI,CMainFrame::OnEpaisseur)
EVT_MENU(MENU_EXIT,CMainFrame::OnQuit)
END_EVENT_TABLE()
// Le constructeur
CMainFrame::CMainFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
{
}
// Création de la toolbar
void CMainFrame::CreateMyToolbar()
{
m_toolbar = CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL,TOOLBAR_TOOLS);
wxBitmap toolBarBitmaps[4];
toolBarBitmaps[0] = wxBitmap(_("new.bmp"),wxBITMAP_TYPE_BMP);
toolBarBitmaps[1] = wxBitmap(_("open.bmp"),wxBITMAP_TYPE_BMP);
toolBarBitmaps[2] = wxBitmap(_("save.bmp"),wxBITMAP_TYPE_BMP);
toolBarBitmaps[3] = wxBitmap(_("draw.bmp"),wxBITMAP_TYPE_BMP);
m_toolbar->SetToolBitmapSize(wxSize(toolBarBitmaps[0].GetWidth(),toolBarBitmaps[0].GetHeight()));
m_toolbar->AddTool(MENU_NEW, _("Nouveau"), toolBarBitmaps[0]);
m_toolbar->AddTool(MENU_OPEN, _("Ouvrir"), toolBarBitmaps[1]);
m_toolbar->AddTool(MENU_SAVE, _("Sauver"), toolBarBitmaps[2]);
m_toolbar->AddSeparator();
m_toolbar->AddCheckTool(App_is_Draw,_("Dessiner"),toolBarBitmaps[3]);
SetToolBar(m_toolbar);
}
//Implémentation des fonctions liées aux événements
void CMainFrame::OnAPropos(wxCommandEvent& event)
{
//VersionDialog vdlg(this, -1, "Version");
//vdlg.ShowModal();
wxMessageBox("","A propos !");
}
void CMainFrame::OnEpaisseur(wxCommandEvent& event)
{
//EpaisseurDialog Edlg(this, -1, "Epaisseur");
//Edlg.ShowModal();
}
void CMainFrame::OnQuit(wxCommandEvent& event)
{
Close(TRUE);
} |
Partager