// Workarounds for wx problems. // // Copyright (C) 2004 Gregory W. Chicares. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as // published by the Free Software Foundation. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // http://groups.yahoo.com/group/actuarialsoftware // email: // snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA // $Id: wx_workarounds.hpp,v 1.1 2004/05/09 02:09:40 chicares Exp $ #ifndef wx_workarounds_hpp #define wx_workarounds_hpp #include // wxICON #include // wxMessageBox #include // WX!! At least in wx-2.4.1, class wxString has an inline destructor // but an out-of-line constructor. This triggers many mpatrol NOFREE // diagnostics for applications that link to a wx dll. This problem // should be fixed in wx; until it is, this workaround seems to // cure the problem. inline wxString wx_string_workaround(char const* s) { return *new wxString(s); } // WX!! Similar treatment is required for wxMessageBox() because of // its default wxString const& second argument. inline int wx_message_box_workaround (char const* message ,char const* caption = "Message" ,long int style = wxOK | wxCENTRE ,wxWindow* parent = NULL ,int x = -1 ,int y = -1 ) { return wxMessageBox (wx_string_workaround(message) ,wx_string_workaround(caption) ,style ,parent ,x ,y ); } // WX!! Similar treatment is required for macro wxICON due to // class wxIcon's wxString const& parameter. Presumably the dll issue // arises only on the msw platform. This code is adapted from // wx/include/wx/gdicmn.h (C) 1997 Julian Smart // which is covered by the wxWindows license. #ifdef __WXMSW__ # define WX_ICON_WORKAROUND(x) wxIcon(wx_string_workaround(#x)) #else // Not msw platform. # define WX_ICON_WORKAROUND(x) wxICON(x) #endif // Not msw platform. // TODO ?? wx documentation for wxICON has a cross reference to // wxBITMAP; probably we'll want to treat that similarly somday. #endif // wx_workarounds_hpp