Added helper functions for string -> XmString conversion.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19539 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon
2003-03-10 21:40:53 +00:00
parent a63b009834
commit 3e2d47e1a9
2 changed files with 20 additions and 9 deletions

View File

@@ -94,6 +94,10 @@ extern XColor itemColors[5] ;
// utility classes // utility classes
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxString wxXmStringToString( const XmString& xmString );
XmString wxStringToXmString( const wxString& string );
XmString wxStringToXmString( const char* string );
// XmString made easy to use in wxWindows (and has an added benefit of // XmString made easy to use in wxWindows (and has an added benefit of
// cleaning up automatically) // cleaning up automatically)
class wxXmString class wxXmString
@@ -123,8 +127,6 @@ private:
XmString m_string; XmString m_string;
}; };
wxString wxXmStringToString( const XmString& xmString );
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Routines used in both wxTextCtrl/wxListBox and nativa wxComboBox // Routines used in both wxTextCtrl/wxListBox and nativa wxComboBox
// (defined in src/motif/listbox.cpp or src/motif/textctrl.cpp // (defined in src/motif/listbox.cpp or src/motif/textctrl.cpp

View File

@@ -273,7 +273,7 @@ static char *GetResourcePath(char *buf, const char *name, bool create = FALSE)
// Put in standard place for resource files if not absolute // Put in standard place for resource files if not absolute
strcpy (buf, DEFAULT_XRESOURCE_DIR); strcpy (buf, DEFAULT_XRESOURCE_DIR);
strcat (buf, "/"); strcat (buf, "/");
strcat (buf, (const char*) wxFileNameFromPath (name)); strcat (buf, wxFileNameFromPath (name).c_str());
} }
if (create) { if (create) {
@@ -335,9 +335,9 @@ bool wxWriteResource(const wxString& section, const wxString& entry, const wxStr
} }
char resName[300]; char resName[300];
strcpy (resName, (const char*) section); strcpy (resName, section.c_str());
strcat (resName, "."); strcat (resName, ".");
strcat (resName, (const char*) entry); strcat (resName, entry.c_str());
XrmPutStringResource (&database, resName, value); XrmPutStringResource (&database, resName, value);
return TRUE; return TRUE;
@@ -481,7 +481,7 @@ void wxXMergeDatabases (wxApp * theApp, Display * display)
wxString classname = theApp->GetClassName(); wxString classname = theApp->GetClassName();
char name[256]; char name[256];
(void) strcpy (name, "/usr/lib/X11/app-defaults/"); (void) strcpy (name, "/usr/lib/X11/app-defaults/");
(void) strcat (name, (const char*) classname); (void) strcat (name, classname.c_str());
/* Get application defaults file, if any */ /* Get application defaults file, if any */
applicationDB = XrmGetFileDatabase (name); applicationDB = XrmGetFileDatabase (name);
@@ -674,9 +674,9 @@ bool wxSetDisplay(const wxString& display_name)
Cardinal argc = 0; Cardinal argc = 0;
Display *display = XtOpenDisplay((XtAppContext) wxTheApp->GetAppContext(), Display *display = XtOpenDisplay((XtAppContext) wxTheApp->GetAppContext(),
(const char*) display_name, display_name.c_str(),
(const char*) wxTheApp->GetAppName(), wxTheApp->GetAppName().c_str(),
(const char*) wxTheApp->GetClassName(), wxTheApp->GetClassName().c_str(),
NULL, NULL,
#if XtSpecificationRelease < 5 #if XtSpecificationRelease < 5
0, &argc, 0, &argc,
@@ -1283,3 +1283,12 @@ wxString wxXmStringToString( const XmString& xmString )
return wxEmptyString; return wxEmptyString;
} }
XmString wxStringToXmString( const wxString& str )
{
return XmStringCreateLtoR((char *)str.c_str(), XmSTRING_DEFAULT_CHARSET);
}
XmString wxStringToXmString( const char* str )
{
return XmStringCreateLtoR((char *)str, XmSTRING_DEFAULT_CHARSET);
}