Alors voilà, j'ai créé une barre d'outils avec des icones. Mais j'ai une icone où je voulais faire un bouton qui s'enclenche quand on appuie dessus et reste dans cette position tant qu'on ne re-appuie pas dessus --> Donc un AddCheckTool mais le soucis c'est que lorsque j'appuie dessus l'icone disparait mais le bouton fonctionne quand même parce que j'appuie dans le vide et mon popup apparait quand même.

voici le code :

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
 
void CMainFrame::CreateMyToolbar() {
	m_toolbar = CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL,TOOLBAR_TOOLS);
	wxBitmap toolBarBitmaps[4];
	string temp;
	string path = "drawtri.app/Contents/MacOS/Bitmaps/";
 
	wxImage* img1 = new wxImage();
	wxImage* img2 = new wxImage();
	wxImage* img3 = new wxImage();
	wxImage* img4 = new wxImage();
 
	img1->AddHandler(new wxBMPHandler);
	img2->AddHandler(new wxBMPHandler);
	img3->AddHandler(new wxBMPHandler);
	img4->AddHandler(new wxBMPHandler);
 
	temp = path+"new.bmp";
	img1->LoadFile(temp.c_str(),wxBITMAP_TYPE_BMP);
	toolBarBitmaps[0] = wxBitmap(*img1);
 
	temp = path+"open.bmp";
	img2->LoadFile(temp.c_str(),wxBITMAP_TYPE_BMP);
	toolBarBitmaps[1] = wxBitmap(*img2);
 
	temp = path+"save.bmp";
	img3->LoadFile(temp.c_str(),wxBITMAP_TYPE_BMP);
	toolBarBitmaps[2] = wxBitmap(*img3);
 
	temp = path+"draw.bmp";
	img4->LoadFile(temp.c_str(),wxBITMAP_TYPE_BMP);
	toolBarBitmaps[3] = wxBitmap(*img4);
 
    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_LOSANGE,"Losange",toolBarBitmaps[3]);
 
    m_toolbar->Realize();
    SetToolBar(m_toolbar);
}
EDIT : j'ai oublié de préciser que j'ai regardé la doc de cette méthode et donc j'ai vu que l'on pouvait passer en paramètre une deuxième image donc me suis dit que j'allais passer la même => mais ca ne résoud pas le problème puisque elle disparait quand même.