Donc j'ai un petit soucis je remets l'imprim écran et mon code.
Pardon d'avance j'ai pas trop bien structuré mon code je débute en C++ mais j'ai capté comment faire donc je le referais après que mon erreur soit résolu

mainframe.h :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
 
#ifndef __MAINFRAME_H__
#define __MAINFRAME_H__
 
#include "wx/wx.h"
 
enum {MENU_NEW,MENU_OPEN,MENU_SAVE,MENU_QUIT,MENU_LINE,MENU_COLOR,MENU_TRIANGLE,MENU_VERSION,MENU_TOOLBAR,TOOLBAR_TOOLS};
 
class CMainFrame: public wxFrame {
 public:
 
  CMainFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
 
  void 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, _("Open"), toolBarBitmaps[1]);
    m_toolbar->AddTool(MENU_SAVE, _("Save"), toolBarBitmaps[2]);
    m_toolbar->AddSeparator();
    m_toolbar->AddCheckTool(MENU_TRIANGLE,_("Draw"),toolBarBitmaps[3]);
 
    m_toolbar->Realize();
    SetToolBar(m_toolbar);
  }
 
 private:
 
  wxToolBar *m_toolbar;
 
  DECLARE_EVENT_TABLE();
 
 
}; //MyFrame
 
#endif
mainframe.cpp :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
#include <stdio.h>
#include <stdlib.h>
#include <wx/wx.h>
#include <wx/accel.h>
 
#include "mainframe.h"
 
BEGIN_EVENT_TABLE(CMainFrame, wxFrame)
END_EVENT_TABLE()
 
 
 
CMainFrame::CMainFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, -1, title, pos, size) 
{
} //constructor
dialogs.h :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
#ifndef __DIALOGS_H__
#define __DIALOGS_H__
 
#include "wx/wx.h"
 
enum {ID_TEXT};
 
class VersionDialog : public wxDialog{
 
  public :
 
    VersionDialog(wxWindow *parent, wxWindowID id,const wxString &title);
 
  private :
 
 
 
DECLARE_EVENT_TABLE()
 
};
 
class ThicknessDialog : public wxDialog{
 
 public:
 
  ThicknessDialog(wxWindow *parent, wxWindowID id,const wxString &title);
 
  private :
 
};
#endif
dialogs.cpp :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
#include <stdio.h>
#include <stdlib.h>
#include <wx/wx.h>
#include <wx/accel.h>
 
#include "dialogs.h"
 
BEGIN_EVENT_TABLE(VersionDialog, wxDialog)
END_EVENT_TABLE ()
 
VersionDialog::VersionDialog( wxWindow *parent, wxWindowID id,const wxString &title) :wxDialog( parent, id, title){
  wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
  wxStaticText *item1 = new wxStaticText( this, ID_TEXT, _("Version 1.0"),wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE );
  wxButton *item2 = new wxButton( this, wxID_OK, _("OK"),wxDefaultPosition);
  item0->Add( item1, 0, wxALIGN_CENTRE|wxALL, 5 );
  item0->Add( item2, 0, wxALIGN_CENTRE|wxALL, 5 );
  this->SetAutoLayout( TRUE );
  this->SetSizer( item0 );
  item0->Fit( this );
  item0->SetSizeHints( this );
}
 
ThicknessDialog::ThicknessDialog(wxWindow *parent, wxWindowID id,const wxString &title) :wxDialog( parent, id, title){
 
}
main.cpp :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
 
#include "wx/wx.h" 
#include "mainframe.h"
#include "dialogs.h"
 
class MyApp: public wxApp 
{
	virtual bool OnInit();
	CMainFrame *m_MainFrame;
};
 
 
IMPLEMENT_APP(MyApp)
 
 
bool MyApp::OnInit() 
{
	m_MainFrame = new CMainFrame( _("Fenetre"), wxPoint(50,50), wxSize(450,340) );
	wxMenuBar *menu_bar = new wxMenuBar;
 
	wxMenu *file_menu_fichier = new wxMenu;
	wxMenu *file_menu_affichage = new wxMenu;
	wxMenu *file_menu_option = new wxMenu;
	wxMenu *file_menu_aide = new wxMenu;
 
	menu_bar->Append(file_menu_fichier,_("Fichier"));
	menu_bar->Append(file_menu_affichage,_("Affichage"));
	menu_bar->Append(file_menu_option,_("Options"));
	menu_bar->Append(file_menu_aide,_("Aide"));
 
	file_menu_fichier->Append(MENU_NEW,_("New\tCtrl-N"));
	file_menu_fichier->AppendSeparator();
	file_menu_fichier->Append(MENU_OPEN,_("Open\tCtrl-O"));
	file_menu_fichier->Append(MENU_SAVE,_("Save\tCtrl-S"));
	file_menu_fichier->AppendSeparator();
	file_menu_fichier->Append(MENU_QUIT,_("Quit\tCtrl-Q"));
 
	file_menu_affichage->AppendCheckItem(MENU_TOOLBAR,_("Boite Outil\tCtrl-B"));
 
	file_menu_option->Append(MENU_LINE,_("Line\tCtrl-L"));
	file_menu_option->Append(MENU_COLOR,_("Color\tCtrl-R"));
	file_menu_option->Append(MENU_TRIANGLE,_("Triangle\tCtrl-T"));
 
	file_menu_aide->Append(MENU_VERSION,_("Version"));
 
	menu_bar->Enable(MENU_TRIANGLE,false);
	file_menu_affichage->Check(MENU_TOOLBAR,TRUE);
	m_MainFrame->SetMenuBar(menu_bar);
	m_MainFrame->CreateMyToolbar();
	m_MainFrame->Show(TRUE);
 
	return TRUE;
}
Voilà voilà.