From: <ma...@us...> - 2003-11-28 17:42:28
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv26077 Modified Files: Images.cpp Log Message: Toolbar images generation now works on wxMSW and wxGTK. Index: Images.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Images.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- Images.cpp 27 Nov 2003 15:21:29 -0000 1.26 +++ Images.cpp 28 Nov 2003 17:42:25 -0000 1.27 @@ -153,7 +153,6 @@ */ void CImages::MakeToolImages() { wxBitmap tmp, tmp_new; - wxMask *tmp_mask; wxMemoryDC mdc; wxCoord x, y, width = 0, height = 0; wxArrayString btntxt, btnimg; @@ -194,26 +193,33 @@ tool_img_width = width; tool_img_height = height; - wxString background; - m_config->Read(wxT("/General/ToolButtonBackground"), &background, wxT("LIGHT BLUE")); - m_config->Write(wxT("/General/ToolButtonBackground"), background); - mdc.SetBrush(wxBrush(*wxTheColourDatabase->FindColour(background), wxSOLID)); - + mdc.BeginDrawing(); /* Loop through our lists of texts/images and draw images for toolbar */ for (unsigned int i=0;i<btntxt.GetCount();i++) { tmp_new = wxBitmap(width, height); mdc.SelectObject(tmp_new); - mdc.SetBrush(wxBrush(wxColour(0, 0, 0), wxSOLID)); + /* On wxMSW, wxLIGHT_GREY colour pointer gives system background colour */ + #ifdef __WXMSW__ + mdc.SetPen(*wxTRANSPARENT_PEN); + mdc.SetBrush(wxBrush(*wxLIGHT_GREY, wxSOLID)); + /* Elsewhere 0,0,0 colour works for background */ + #else + mdc.SetBrush(wxBrush(wxColour(0, 0, 0), wxSOLID)); + #endif mdc.DrawRectangle(0, 0, tmp_new.GetWidth(), tmp_new.GetHeight()); - mdc.SetBrush(wxBrush(*wxTheColourDatabase->FindColour(background), wxSOLID)); mdc.DrawBitmap(GetImage(btnimg.Item(i)), (tmp_new.GetWidth()-32)/2, 2, true); mdc.SetTextForeground( wxColour(1,1,1)); mdc.GetTextExtent(btntxt.Item(i), &x, &y); mdc.DrawText(btntxt.Item(i), (tmp_new.GetWidth()-x)/2, 36); - tmp_mask = new wxMask(tmp_new, wxColour(0,0,0)); - tmp_new.SetMask(tmp_mask); + /* Can't (and dont need to) use transparency mask on wxMSW */ + #ifndef __WXMSW__ + wxMask *tmp_mask; + tmp_mask = new wxMask(tmp_new, wxColour(0,0,0)); + tmp_new.SetMask(tmp_mask); + #endif GetImage(btnimg.Item(i)) = tmp_new; } + mdc.EndDrawing(); } /** |