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);
} |
Partager