#include "wx/log.h"
#if wxUSE_GUI
+ #include "wx/app.h"
#include "wx/window.h"
#include "wx/frame.h"
#include "wx/menu.h"
#include "wx/msgdlg.h"
#include "wx/textdlg.h"
+ #include "wx/textctrl.h" // for wxTE_PASSWORD
#if wxUSE_ACCEL
#include "wx/menuitem.h"
#include "wx/accel.h"
#if wxUSE_GUI
#include "wx/colordlg.h"
+ #include "wx/fontdlg.h"
#include "wx/notebook.h"
#include "wx/frame.h"
#include "wx/statusbr.h"
- #include "wx/toolbar.h"
#endif // wxUSE_GUI
#include <time.h>
#include "wx/msw/private.h"
#endif
+// ----------------------------------------------------------------------------
+// common data
+// ----------------------------------------------------------------------------
+
+#if WXWIN_COMPATIBILITY_2_2
+ const wxChar *wxInternalErrorStr = wxT("wxWindows Internal Error");
+ const wxChar *wxFatalErrorStr = wxT("wxWindows Fatal Error");
+#endif // WXWIN_COMPATIBILITY_2_2
+
// ----------------------------------------------------------------------------
// function protoypes
// ----------------------------------------------------------------------------
// string functions
// ----------------------------------------------------------------------------
-#ifdef __WXMAC__
+#if defined(__WXMAC__) && !defined(__DARWIN__)
int strcasecmp(const char *str_1, const char *str_2)
{
register char c1, c2;
return 0 ;
}
-#endif // wxMAC
+#endif // __WXMAC__ && !__DARWIN__
#if defined( __VMS__ ) && ( __VMS_VER < 70000000 )
// we have no strI functions under VMS, therefore I have implemented
#define strncasecmp strnicmp
#endif
+#ifdef __WATCOMC__
+#define strcasecmp stricmp
+#define strncasecmp strnicmp
+#endif
+
wxChar *
copystring (const wxChar *s)
{
}
void
-StringToFloat (wxChar *s, float *number)
+StringToFloat (const wxChar *s, float *number)
{
if (s && *s && number)
*number = (float) wxStrtod (s, (wxChar **) NULL);
}
void
-StringToDouble (wxChar *s, double *number)
+StringToDouble (const wxChar *s, double *number)
{
if (s && *s && number)
*number = wxStrtod (s, (wxChar **) NULL);
}
void
-StringToInt (wxChar *s, int *number)
+StringToInt (const wxChar *s, int *number)
{
if (s && *s && number)
*number = (int) wxStrtol (s, (wxChar **) NULL, 10);
}
void
-StringToLong (wxChar *s, long *number)
+StringToLong (const wxChar *s, long *number)
{
if (s && *s && number)
*number = wxStrtol (s, (wxChar **) NULL, 10);
// Match a string INDEPENDENT OF CASE
bool
-StringMatch (char *str1, char *str2, bool subString, bool exact)
+StringMatch (const char *str1, const char *str2, bool subString, bool exact)
{
if (str1 == NULL || str2 == NULL)
return FALSE;
// Menu accelerators related functions
// ----------------------------------------------------------------------------
-wxChar *wxStripMenuCodes(wxChar *in, wxChar *out)
+wxChar *wxStripMenuCodes(const wxChar *in, wxChar *out)
{
wxString s = wxMenuItem::GetLabelFromText(in);
if ( out )
// Hack for wxNotebook case: at least in wxGTK, all pages
// claim to be shown, so we must only deal with the selected one.
+#if wxUSE_NOTEBOOK
if (win->IsKindOf(CLASSINFO(wxNotebook)))
{
wxNotebook* nb = (wxNotebook*) win;
return foundWin;
}
}
+#endif
+
/* Doesn't work
// Frame case
else if (win->IsKindOf(CLASSINFO(wxFrame)))
t = imagedir;
if (!absolute_pathname(name)) {
-#if defined(DOS) || defined(__WIN32__)
+#if defined(__DOS__) || defined(__WIN32__)
int drive;
char *newrbuf;
wxColour wxGetColourFromUser(wxWindow *parent, const wxColour& colInit)
{
- wxColourData data;
- data.SetChooseFull(TRUE);
- if ( colInit.Ok() )
- {
- data.SetColour((wxColour &)colInit); // const_cast
- }
+ wxColourData data;
+ data.SetChooseFull(TRUE);
+ if ( colInit.Ok() )
+ {
+ data.SetColour((wxColour &)colInit); // const_cast
+ }
- wxColour colRet;
- wxColourDialog dialog(parent, &data);
- if ( dialog.ShowModal() == wxID_OK )
- {
- colRet = dialog.GetColourData().GetColour();
- }
- //else: leave it invalid
+ wxColour colRet;
+ wxColourDialog dialog(parent, &data);
+ if ( dialog.ShowModal() == wxID_OK )
+ {
+ colRet = dialog.GetColourData().GetColour();
+ }
+ //else: leave it invalid
- return colRet;
+ return colRet;
}
#endif // wxUSE_COLOURDLG
+#if wxUSE_FONTDLG
+
+wxFont wxGetFontFromUser(wxWindow *parent, const wxFont& fontInit)
+{
+ wxFontData data;
+ if ( fontInit.Ok() )
+ {
+ data.SetInitialFont(fontInit);
+ }
+
+ wxFont fontRet;
+ wxFontDialog dialog(parent, &data);
+ if ( dialog.ShowModal() == wxID_OK )
+ {
+ fontRet = dialog.GetFontData().GetChosenFont();
+ }
+ //else: leave it invalid
+
+ return fontRet;
+}
+
+#endif // wxUSE_FONTDLG
// ----------------------------------------------------------------------------
// missing C RTL functions (FIXME shouldn't be here at all)
// ----------------------------------------------------------------------------
#ifdef __MWERKS__
+#if __MSL__ < 0x7000
char *strdup(const char *s)
{
return strcpy( (char*) malloc( strlen( s ) + 1 ) , s ) ;
}
-
+#endif
int isascii( int c )
{
return ( c >= 0 && c < 128 ) ;
#endif // wxUSE_GUI
+const wxChar *wxGetInstallPrefix()
+{
+ wxString prefix;
+
+ if ( wxGetEnv(wxT("WXPREFIX"), &prefix) )
+ return prefix.c_str();
+
+#ifdef wxINSTALL_PREFIX
+ return wxT(wxINSTALL_PREFIX);
+#else
+ return wxT("");
+#endif
+}
+
+wxString wxGetDataDir()
+{
+ wxString format = wxGetInstallPrefix();
+ format << wxFILE_SEP_PATH
+ << wxT("share") << wxFILE_SEP_PATH
+ << wxT("wx") << wxFILE_SEP_PATH
+ << wxT("%i.%i");
+ wxString dir;
+ dir.Printf(format.c_str(), wxMAJOR_VERSION, wxMINOR_VERSION);
+ return dir;
+}
+
+
// ----------------------------------------------------------------------------
// network and user id functions
// ----------------------------------------------------------------------------
return wxDoExecuteWithCapture(command, output, &error);
}
+// ----------------------------------------------------------------------------
+// wxApp::Yield() wrappers for backwards compatibility
+// ----------------------------------------------------------------------------
+
+bool wxYield()
+{
+#if wxUSE_GUI
+ return wxTheApp && wxTheApp->Yield();
+#else
+ return FALSE;
+#endif
+}
+
+bool wxYieldIfNeeded()
+{
+#if wxUSE_GUI
+ return wxTheApp && wxTheApp->Yield(TRUE);
+#else
+ return FALSE;
+#endif
+}