HACCEL hAccel =
#if defined(__WIN32__) && !defined(__TWIN32__)
#ifdef UNICODE
- ::LoadAcceleratorsW(wxGetInstance(), (const char *)resource);
+ ::LoadAcceleratorsW(wxGetInstance(), (const wxChar *)resource);
#else
::LoadAcceleratorsA(wxGetInstance(), (const char *)resource);
#endif
#else
- ::LoadAccelerators(wxGetInstance(), (const char *)resource);
+ ::LoadAccelerators(wxGetInstance(), (const wxChar *)resource);
#endif
M_ACCELDATA->m_hAccel = hAccel;
M_ACCELDATA->m_ok = (hAccel != 0);
// global variables
// ---------------------------------------------------------------------------
-extern char *wxBuffer;
-extern char *wxOsVersion;
+extern wxChar *wxBuffer;
+extern wxChar *wxOsVersion;
extern wxList *wxWinHandleList;
extern wxList WXDLLEXPORT wxPendingDelete;
#if wxUSE_THREADS
wxApp *wxTheApp = NULL;
// FIXME why not const? and not static?
-char wxFrameClassName[] = "wxFrameClass";
-char wxMDIFrameClassName[] = "wxMDIFrameClass";
-char wxMDIChildFrameClassName[] = "wxMDIChildFrameClass";
-char wxPanelClassName[] = "wxPanelClass";
-char wxCanvasClassName[] = "wxCanvasClass";
+wxChar wxFrameClassName[] = _T("wxFrameClass");
+wxChar wxMDIFrameClassName[] = _T("wxMDIFrameClass");
+wxChar wxMDIChildFrameClassName[] = _T("wxMDIChildFrameClass");
+wxChar wxPanelClassName[] = _T("wxPanelClass");
+wxChar wxCanvasClassName[] = _T("wxCanvasClass");
HICON wxSTD_FRAME_ICON = (HICON) NULL;
HICON wxSTD_MDICHILDFRAME_ICON = (HICON) NULL;
// wxRedirectIOToConsole();
#endif
- wxBuffer = new char[1500]; // FIXME
+ wxBuffer = new wxChar[1500]; // FIXME
wxClassInfo::InitializeClasses();
#if wxUSE_RESOURCES
- wxGetResource("wxWindows", "OsVersion", &wxOsVersion);
+ wxGetResource(_T("wxWindows"), _T("OsVersion"), &wxOsVersion);
#endif
// I'm annoyed ... I don't know where to put this and I don't want to
InitCommonControls();
#if wxUSE_RICHEDIT
- gs_hRichEdit = LoadLibrary("RICHED32.DLL");
+ gs_hRichEdit = LoadLibrary(_T("RICHED32.DLL"));
if (gs_hRichEdit == (HINSTANCE) NULL)
{
#if wxUSE_CTL3D
if (!Ctl3dRegister(wxhInstance))
- wxLogError("Cannot register CTL3D");
+ wxLogError(_T("Cannot register CTL3D"));
Ctl3dAutoSubclass(wxhInstance);
#endif
g_globalCursor = new wxCursor;
- wxSTD_FRAME_ICON = LoadIcon(wxhInstance, "wxSTD_FRAME");
- wxSTD_MDIPARENTFRAME_ICON = LoadIcon(wxhInstance, "wxSTD_MDIPARENTFRAME");
- wxSTD_MDICHILDFRAME_ICON = LoadIcon(wxhInstance, "wxSTD_MDICHILDFRAME");
+ wxSTD_FRAME_ICON = LoadIcon(wxhInstance, _T("wxSTD_FRAME"));
+ wxSTD_MDIPARENTFRAME_ICON = LoadIcon(wxhInstance, _T("wxSTD_MDIPARENTFRAME"));
+ wxSTD_MDICHILDFRAME_ICON = LoadIcon(wxhInstance, _T("wxSTD_MDICHILDFRAME"));
- wxDEFAULT_FRAME_ICON = LoadIcon(wxhInstance, "wxDEFAULT_FRAME");
- wxDEFAULT_MDIPARENTFRAME_ICON = LoadIcon(wxhInstance, "wxDEFAULT_MDIPARENTFRAME");
- wxDEFAULT_MDICHILDFRAME_ICON = LoadIcon(wxhInstance, "wxDEFAULT_MDICHILDFRAME");
+ wxDEFAULT_FRAME_ICON = LoadIcon(wxhInstance, _T("wxDEFAULT_FRAME"));
+ wxDEFAULT_MDIPARENTFRAME_ICON = LoadIcon(wxhInstance, _T("wxDEFAULT_MDIPARENTFRAME"));
+ wxDEFAULT_MDICHILDFRAME_ICON = LoadIcon(wxhInstance, _T("wxDEFAULT_MDICHILDFRAME"));
RegisterWindowClasses();
LOGBRUSH lb;
lb.lbStyle = BS_PATTERN;
- lb.lbHatch = (int)LoadBitmap( wxhInstance, "wxDISABLE_BUTTON_BITMAP" );
+ lb.lbHatch = (int)LoadBitmap( wxhInstance, _T("wxDISABLE_BUTTON_BITMAP") );
if ( lb.lbHatch )
{
wxDisableButtonBrush = ::CreateBrushIndirect( & lb );
int count = 0;
// Get application name
- char name[260]; // 260 is MAX_PATH value from windef.h
+ wxChar name[260]; // 260 is MAX_PATH value from windef.h
::GetModuleFileName(wxhInstance, name, WXSIZEOF(name));
args.Add(name);
count++;
- strcpy(name, wxFileNameFromPath(name));
+ wxStrcpy(name, wxFileNameFromPath(name));
wxStripExtension(name);
wxTheApp->SetAppName(name);
while (i < len)
{
// Skip whitespace
- while ((i < len) && isspace(cmdLine.GetChar(i)))
+ while ((i < len) && wxIsspace(cmdLine.GetChar(i)))
i ++;
if (i < len)
{
- if (cmdLine.GetChar(i) == '"') // We found the start of a string
+ if (cmdLine.GetChar(i) == _T('"')) // We found the start of a string
{
i ++;
int first = i;
- while ((i < len) && (cmdLine.GetChar(i) != '"'))
+ while ((i < len) && (cmdLine.GetChar(i) != _T('"')))
i ++;
wxString arg(cmdLine.Mid(first, (i - first)));
else // Unquoted argument
{
int first = i;
- while ((i < len) && !isspace(cmdLine.GetChar(i)))
+ while ((i < len) && !wxIsspace(cmdLine.GetChar(i)))
i ++;
wxString arg(cmdLine.Mid(first, (i - first)));
}
}
- wxTheApp->argv = new char*[count + 1];
+ wxTheApp->argv = new wxChar*[count + 1];
for (i = 0; i < count; i++)
{
wxString arg(args[i]);
- wxTheApp->argv[i] = copystring((const char*)arg);
+ wxTheApp->argv[i] = copystring((const wxChar*)arg);
}
wxTheApp->argv[count] = NULL; // argv[] is a NULL-terminated list
wxTheApp->argc = count;
// wxDebugContext, too.
if (wxDebugContext::CountObjectsLeft(TRUE) > 0)
{
- wxLogDebug("There were memory leaks.");
+ wxLogDebug(_T("There were memory leaks."));
wxDebugContext::Dump();
wxDebugContext::PrintStatistics();
}
// the IMPLEMENT_APP macro is used instead, which sets an initializer
// function for delayed, dynamic app object construction.
wxCHECK_MSG( wxApp::GetInitializerFunction(), 0,
- "No initializer - use IMPLEMENT_APP macro." );
+ _T("No initializer - use IMPLEMENT_APP macro.") );
wxTheApp = (*wxApp::GetInitializerFunction()) ();
}
- wxCHECK_MSG( wxTheApp, 0, "You have to define an instance of wxApp!" );
+ wxCHECK_MSG( wxTheApp, 0, _T("You have to define an instance of wxApp!") );
// save the WinMain() parameters
wxTheApp->ConvertToStandardCommandArgs(lpCmdLine);
{
#if wxUSE_THREADS
wxASSERT_MSG( wxThread::IsMain(),
- "only the main thread can process Windows messages" );
+ _T("only the main thread can process Windows messages") );
static bool s_hadGuiLock = TRUE;
static wxMsgArray s_aSavedMessages;
int wxApp::GetComCtl32Version() const
{
// have we loaded COMCTL32 yet?
- HMODULE theModule = ::GetModuleHandle("COMCTL32");
+ HMODULE theModule = ::GetModuleHandle(_T("COMCTL32"));
int version = 0;
// if so, then we can check for the version
{
if (m_selectedInto)
{
- char buf[200];
- sprintf(buf, "Bitmap was deleted without selecting out of wxMemoryDC %X.", (unsigned int) m_selectedInto);
+ wxChar buf[200];
+ wxSprintf(buf, _T("Bitmap was deleted without selecting out of wxMemoryDC %X."), (unsigned int) m_selectedInto);
wxFatalError(buf);
}
if (m_hBitmap)
if (M_BITMAPDATA->m_selectedInto)
{
- char buf[200];
- sprintf(buf, "Bitmap %X was deleted without selecting out of wxMemoryDC %X.", (unsigned int) this, (unsigned int) M_BITMAPDATA->m_selectedInto);
+ wxChar buf[200];
+ wxSprintf(buf, _T("Bitmap %X was deleted without selecting out of wxMemoryDC %X."), (unsigned int) this, (unsigned int) M_BITMAPDATA->m_selectedInto);
wxFatalError(buf);
}
if (M_BITMAPDATA->m_hBitmap)
wxBitmapHandler *handler = FindHandler(type);
if ( handler == NULL ) {
- wxLogWarning("no bitmap handler for type %d defined.", type);
+ wxLogWarning(_T("no bitmap handler for type %d defined."), type);
return FALSE;
}
wxBitmapHandler *handler = FindHandler(type);
if ( handler == NULL ) {
- wxLogWarning("no bitmap handler for type %d defined.", type);
+ wxLogWarning(_T("no bitmap handler for type %d defined."), type);
return FALSE;
}
wxBitmapHandler *handler = FindHandler(type);
if ( handler == NULL ) {
- wxLogWarning("no bitmap handler for type %d defined.", type);
+ wxLogWarning(_T("no bitmap handler for type %d defined."), type);
return FALSE;
}
}
// it's probably not found
- wxLogError("Can't load bitmap '%s' from resources! Check .rc file.", name.c_str());
+ wxLogError(_T("Can't load bitmap '%s' from resources! Check .rc file."), name.c_str());
return FALSE;
}
m_hWnd = (WXHWND)CreateWindowEx
(
0,
- "BUTTON",
- "",
+ _T("BUTTON"),
+ _T(""),
WS_VISIBLE | WS_TABSTOP | WS_CHILD | BS_OWNERDRAW ,
0, 0, 0, 0,
GetWinHwnd(parent),
m_hWnd = (WXHWND)CreateWindowEx
(
MakeExtendedStyle(m_windowStyle),
- "BUTTON",
+ _T("BUTTON"),
label,
WS_VISIBLE | WS_TABSTOP | WS_CHILD,
0, 0, 0, 0,
int current_width;
int cyf;
- char buf[300];
+ wxChar buf[300];
GetWindowText((HWND) GetHWND(), buf, 300);
GetTextExtent(buf, ¤t_width, &cyf,NULL,NULL,
& this->GetFont());
void wxButton::SetLabel(const wxString& label)
{
- SetWindowText((HWND) GetHWND(), (const char *) label);
+ SetWindowText((HWND) GetHWND(), (const wxChar *) label);
}
WXHBRUSH wxButton::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
bool wxCaret::MSWCreateCaret()
{
- wxASSERT_MSG( GetWindow(), "caret without window cannot be created" );
- wxASSERT_MSG( IsOk(), "caret of zero size cannot be created" );
+ wxASSERT_MSG( GetWindow(), _T("caret without window cannot be created") );
+ wxASSERT_MSG( IsOk(), _T("caret of zero size cannot be created") );
if ( !m_hasCaret )
{
void wxCaret::DoShow()
{
- wxASSERT_MSG( GetWindow(), "caret without window cannot be shown" );
- wxASSERT_MSG( IsOk(), "caret of zero size cannot be shown" );
+ wxASSERT_MSG( GetWindow(), _T("caret without window cannot be shown") );
+ wxASSERT_MSG( IsOk(), _T("caret of zero size cannot be shown") );
if ( !m_hasCaret )
{
m_windowStyle = style;
wxString Label = label;
- if (Label == "")
- Label = " "; // Apparently needed or checkbox won't show
+ if (Label == _T(""))
+ Label = _T(" "); // Apparently needed or checkbox won't show
if ( id == -1 )
m_windowId = NewControlId();
msStyle |= WS_BORDER;
*/
- m_hWnd = (WXHWND)CreateWindowEx(exStyle, "BUTTON", Label,
+ m_hWnd = (WXHWND)CreateWindowEx(exStyle, _T("BUTTON"), Label,
msStyle,
0, 0, 0, 0,
(HWND)parent->GetHWND(), (HMENU)m_windowId,
checkHeight = -1 ;
long msStyle = CHECK_FLAGS;
- HWND wx_button = CreateWindowEx(MakeExtendedStyle(m_windowStyle), CHECK_CLASS, "toggle",
+ HWND wx_button = CreateWindowEx(MakeExtendedStyle(m_windowStyle), CHECK_CLASS, _T("toggle"),
msStyle,
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
wxGetInstance(), NULL);
// update it
int index = m_pParent->GetItemIndex(this);
- wxASSERT_MSG( index != wxNOT_FOUND, "what does this item do here?" );
+ wxASSERT_MSG( index != wxNOT_FOUND, _T("what does this item do here?") );
m_nIndex = (size_t)index;
}
if ( ::SendMessage(hwndListbox, LB_GETITEMRECT,
m_nIndex, (LPARAM)&rcUpdate) == LB_ERR )
{
- wxLogDebug("LB_GETITEMRECT failed");
+ wxLogDebug(_T("LB_GETITEMRECT failed"));
}
#else // Win16
// FIXME this doesn't work if the listbox is scrolled!
void wxCheckListBox::Delete(int N)
{
wxCHECK_RET( N >= 0 && N < m_noItems,
- "invalid index in wxListBox::Delete" );
+ _T("invalid index in wxListBox::Delete") );
wxListBox::Delete(N);
void wxCheckListBox::InsertItems(int nItems, const wxString items[], int pos)
{
wxCHECK_RET( pos >= 0 && pos <= m_noItems,
- "invalid index in wxCheckListBox::InsertItems" );
+ _T("invalid index in wxCheckListBox::InsertItems") );
wxListBox::InsertItems(nItems, items, pos);
if ( want3D || wxStyleHasBorder(m_windowStyle) )
msStyle |= WS_BORDER;
- m_hWnd = (WXHWND)::CreateWindowEx(exStyle, "COMBOBOX", NULL,
+ m_hWnd = (WXHWND)::CreateWindowEx(exStyle, _T("COMBOBOX"), NULL,
msStyle,
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
wxGetInstance(), NULL);
- wxCHECK_MSG( m_hWnd, FALSE, "Failed to create combobox" );
+ wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create combobox") );
/*
#if wxUSE_CTL3D
void wxChoice::Append(const wxString& item)
{
- SendMessage((HWND) GetHWND(), CB_ADDSTRING, 0, (LONG)(const char *)item);
+ SendMessage((HWND) GetHWND(), CB_ADDSTRING, 0, (LONG)(const wxChar *)item);
m_noStrings ++;
}
}
return -1;
#else
- int pos = (int)SendMessage((HWND) GetHWND(), CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)(LPSTR)(const char *)s);
+ int pos = (int)SendMessage((HWND) GetHWND(), CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)(LPSTR)(const wxChar *)s);
if (pos == LB_ERR)
return -1;
else
if (sel > -1)
return wxString(this->GetString (sel));
else
- return wxString("");
+ return wxString(_T(""));
}
bool wxChoice::SetStringSelection (const wxString& s)
bool wxOpenClipboard()
{
- wxCHECK_MSG( !gs_wxClipboardIsOpen, TRUE, "clipboard already opened." );
+ wxCHECK_MSG( !gs_wxClipboardIsOpen, TRUE, _T("clipboard already opened.") );
wxWindow *win = wxTheApp->GetTopWindow();
if ( win )
}
else
{
- wxLogDebug("Can not open clipboard without a main window,");
+ wxLogDebug(_T("Can not open clipboard without a main window."));
return FALSE;
}
bool wxCloseClipboard()
{
- wxCHECK_MSG( gs_wxClipboardIsOpen, FALSE, "clipboard is not opened" );
+ wxCHECK_MSG( gs_wxClipboardIsOpen, FALSE, _T("clipboard is not opened") );
gs_wxClipboardIsOpen = FALSE;
return ::EnumClipboardFormats(dataFormat);
}
-int wxRegisterClipboardFormat(char *formatName)
+int wxRegisterClipboardFormat(wxChar *formatName)
{
return ::RegisterClipboardFormat(formatName);
}
bool wxGetClipboardFormatName(wxDataFormat dataFormat,
- char *formatName,
+ wxChar *formatName,
int maxCount)
{
return ::GetClipboardFormatName((int)dataFormat, formatName, maxCount) > 0;
bool wxClipboard::AddData( wxDataObject *data )
{
- wxCHECK_MSG( data, FALSE, "data is invalid" );
+ wxCHECK_MSG( data, FALSE, _T("data is invalid") );
#if wxUSE_DRAG_AND_DROP
- wxCHECK_MSG( wxIsClipboardOpened(), FALSE, "clipboard not open" );
+ wxCHECK_MSG( wxIsClipboardOpened(), FALSE, _T("clipboard not open") );
wxDataFormat format = data->GetFormat();
bool wxClipboard::GetData( wxDataObject *data )
{
- wxCHECK_MSG( wxIsClipboardOpened(), FALSE, "clipboard not open" );
+ wxCHECK_MSG( wxIsClipboardOpened(), FALSE, _T("clipboard not open") );
#if wxUSE_DRAG_AND_DROP
wxDataFormat format = data->GetFormat();
if ( want3D || wxStyleHasBorder(m_windowStyle) )
msStyle |= WS_BORDER;
- m_hWnd = (WXHWND)::CreateWindowEx(exStyle, "COMBOBOX", NULL,
+ m_hWnd = (WXHWND)::CreateWindowEx(exStyle, _T("COMBOBOX"), NULL,
msStyle,
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
wxGetInstance(), NULL);
- wxCHECK_MSG( m_hWnd, FALSE, "Failed to create combobox" );
+ wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create combobox") );
/*
#if wxUSE_CTL3D
}
if (singletons > 0)
{
- char *tmp = new char[len + singletons + 1];
+ wxChar *tmp = new wxChar[len + singletons + 1];
int j = 0;
for (i = 0; i < len; i ++)
{
delete[] tmp;
}
else
- SetWindowText((HWND) GetHWND(), (const char *)value);
+ SetWindowText((HWND) GetHWND(), (const wxChar *)value);
}
// Clipboard operations
SendMessage(hWnd, WM_CUT, (WPARAM)0, (LPARAM)0);
// Now replace with 'value', by pasting.
- wxSetClipboardData(wxDF_TEXT, (wxObject *)(const char *)value, 0, 0);
+ wxSetClipboardData(wxDF_TEXT, (wxObject *)(const wxChar *)value, 0, 0);
// Paste into edit control
SendMessage(hWnd, WM_PASTE, (WPARAM)0, (LPARAM)0L);
lpDIB->bmiHeader.biBitCount)));
// Get a hDC so we can create a bitmap compatible with it
- hDC = CreateDC( "DISPLAY", NULL, NULL, NULL);
+ hDC = CreateDC( _T("DISPLAY"), NULL, NULL, NULL);
// 5) Create a device dependent bitmap with the XOR bits.
hbmXor = CreateDIBitmap( hDC, (LPBITMAPINFOHEADER)&(lpDIB->bmiHeader),
lpDIB->bmiHeader.biBitCount)));
// Get a hDC so we can create a bitmap compatible with it
- hDC = CreateDC( "DISPLAY", NULL, NULL, NULL);
+ hDC = CreateDC( _T("DISPLAY"), NULL, NULL, NULL);
// 5) Create a device dependent bitmap with the XOR bits.
hbmXor = CreateBitmap( (int )lpDIB->bmiHeader.biWidth,
else if (flags & wxBITMAP_TYPE_CUR)
{
#if wxUSE_RESOURCE_LOADING_IN_MSW
- M_CURSORDATA->m_hCursor = (WXHCURSOR) ReadCursorFile((char *)(const char *)cursor_file, wxGetInstance(), &M_CURSORDATA->m_width, &M_CURSORDATA->m_height);
+ M_CURSORDATA->m_hCursor = (WXHCURSOR) ReadCursorFile(WXSTRINGCAST cursor_file, wxGetInstance(), &M_CURSORDATA->m_width, &M_CURSORDATA->m_height);
M_CURSORDATA->m_destroyCursor = TRUE;
#endif
}
else if (flags & wxBITMAP_TYPE_ICO)
{
#if wxUSE_RESOURCE_LOADING_IN_MSW
- M_CURSORDATA->m_hCursor = (WXHCURSOR) IconToCursor((char *)(const char *)cursor_file, wxGetInstance(), hotSpotX, hotSpotY, &M_CURSORDATA->m_width, &M_CURSORDATA->m_height);
+ M_CURSORDATA->m_hCursor = (WXHCURSOR) IconToCursor(WXSTRINGCAST cursor_file, wxGetInstance(), hotSpotX, hotSpotY, &M_CURSORDATA->m_width, &M_CURSORDATA->m_height);
M_CURSORDATA->m_destroyCursor = TRUE;
#endif
}
#if wxUSE_RESOURCE_LOADING_IN_MSW
HBITMAP hBitmap = 0;
HPALETTE hPalette = 0;
- bool success = ReadDIB((char *)(const char *)cursor_file, &hBitmap, &hPalette) != 0;
+ bool success = ReadDIB(WXSTRINGCAST cursor_file, &hBitmap, &hPalette) != 0;
if (!success)
return;
if (hPalette)
}
case wxCURSOR_HAND:
{
- M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_HAND");
+ M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_HAND"));
break;
}
case wxCURSOR_BULLSEYE:
{
- M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_BULLSEYE");
+ M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_BULLSEYE"));
break;
}
case wxCURSOR_PENCIL:
{
- M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PENCIL");
+ M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_PENCIL"));
break;
}
case wxCURSOR_MAGNIFIER:
{
- M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_MAGNIFIER");
+ M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_MAGNIFIER"));
break;
}
case wxCURSOR_NO_ENTRY:
{
- M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_NO_ENTRY");
+ M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_NO_ENTRY"));
break;
}
case wxCURSOR_LEFT_BUTTON:
}
case wxCURSOR_SIZING:
{
- M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_SIZING");
+ M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_SIZING"));
break;
}
case wxCURSOR_WATCH:
{
- M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_WATCH");
+ M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_WATCH"));
break;
}
case wxCURSOR_SPRAYCAN:
{
- M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_ROLLER");
+ M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_ROLLER"));
break;
}
case wxCURSOR_PAINT_BRUSH:
{
- M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PBRUSH");
+ M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_PBRUSH"));
break;
}
case wxCURSOR_POINT_LEFT:
{
- M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PLEFT");
+ M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_PLEFT"));
break;
}
case wxCURSOR_POINT_RIGHT:
{
- M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PRIGHT");
+ M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_PRIGHT"));
break;
}
case wxCURSOR_QUESTION_ARROW:
{
- M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_QARROW");
+ M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_QARROW"));
break;
}
case wxCURSOR_BLANK:
{
- M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_BLANK");
+ M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_BLANK"));
break;
}
default:
#define _MAXPATHLEN 500
// Useful buffer, initialized in wxCommonInit
-char *wxBuffer = NULL;
+wxChar *wxBuffer = NULL;
// Windows List
wxWindowList wxTopLevelWindows;
wxColour wxNullColour;
// Default window names
-const char *wxButtonNameStr = "button";
-const char *wxCanvasNameStr = "canvas";
-const char *wxCheckBoxNameStr = "check";
-const char *wxChoiceNameStr = "choice";
-const char *wxComboBoxNameStr = "comboBox";
-const char *wxDialogNameStr = "dialog";
-const char *wxFrameNameStr = "frame";
-const char *wxGaugeNameStr = "gauge";
-const char *wxStaticBoxNameStr = "groupBox";
-const char *wxListBoxNameStr = "listBox";
-const char *wxStaticTextNameStr = "message";
-const char *wxStaticBitmapNameStr = "message";
-const char *wxMultiTextNameStr = "multitext";
-const char *wxPanelNameStr = "panel";
-const char *wxRadioBoxNameStr = "radioBox";
-const char *wxRadioButtonNameStr = "radioButton";
-const char *wxBitmapRadioButtonNameStr = "radioButton";
-const char *wxScrollBarNameStr = "scrollBar";
-const char *wxSliderNameStr = "slider";
-const char *wxStaticNameStr = "static";
-const char *wxTextCtrlWindowNameStr = "textWindow";
-const char *wxTextCtrlNameStr = "text";
-const char *wxVirtListBoxNameStr = "virtListBox";
-const char *wxButtonBarNameStr = "buttonbar";
-const char *wxEnhDialogNameStr = "Shell";
-const char *wxToolBarNameStr = "toolbar";
-const char *wxStatusLineNameStr = "status_line";
-const char *wxEmptyString = "";
-const char *wxGetTextFromUserPromptStr = "Input Text";
-const char *wxMessageBoxCaptionStr = "Message";
-const char *wxFileSelectorPromptStr = "Select a file";
-const char *wxFileSelectorDefaultWildcardStr = "*.*";
-const char *wxInternalErrorStr = "wxWindows Internal Error";
-const char *wxFatalErrorStr = "wxWindows Fatal Error";
-const char *wxTreeCtrlNameStr = "treeCtrl";
+const wxChar *wxButtonNameStr = _T("button");
+const wxChar *wxCanvasNameStr = _T("canvas");
+const wxChar *wxCheckBoxNameStr = _T("check");
+const wxChar *wxChoiceNameStr = _T("choice");
+const wxChar *wxComboBoxNameStr = _T("comboBox");
+const wxChar *wxDialogNameStr = _T("dialog");
+const wxChar *wxFrameNameStr = _T("frame");
+const wxChar *wxGaugeNameStr = _T("gauge");
+const wxChar *wxStaticBoxNameStr = _T("groupBox");
+const wxChar *wxListBoxNameStr = _T("listBox");
+const wxChar *wxStaticTextNameStr = _T("message");
+const wxChar *wxStaticBitmapNameStr = _T("message");
+const wxChar *wxMultiTextNameStr = _T("multitext");
+const wxChar *wxPanelNameStr = _T("panel");
+const wxChar *wxRadioBoxNameStr = _T("radioBox");
+const wxChar *wxRadioButtonNameStr = _T("radioButton");
+const wxChar *wxBitmapRadioButtonNameStr = _T("radioButton");
+const wxChar *wxScrollBarNameStr = _T("scrollBar");
+const wxChar *wxSliderNameStr = _T("slider");
+const wxChar *wxStaticNameStr = _T("static");
+const wxChar *wxTextCtrlWindowNameStr = _T("textWindow");
+const wxChar *wxTextCtrlNameStr = _T("text");
+const wxChar *wxVirtListBoxNameStr = _T("virtListBox");
+const wxChar *wxButtonBarNameStr = _T("buttonbar");
+const wxChar *wxEnhDialogNameStr = _T("Shell");
+const wxChar *wxToolBarNameStr = _T("toolbar");
+const wxChar *wxStatusLineNameStr = _T("status_line");
+const wxChar *wxEmptyString = _T("");
+const wxChar *wxGetTextFromUserPromptStr = _T("Input Text");
+const wxChar *wxMessageBoxCaptionStr = _T("Message");
+const wxChar *wxFileSelectorPromptStr = _T("Select a file");
+const wxChar *wxFileSelectorDefaultWildcardStr = _T("*.*");
+const wxChar *wxInternalErrorStr = _T("wxWindows Internal Error");
+const wxChar *wxFatalErrorStr = _T("wxWindows Fatal Error");
+const wxChar *wxTreeCtrlNameStr = _T("treeCtrl");
// See wx/utils.h
-const char *wxFloatToStringStr = "%.2f";
-const char *wxDoubleToStringStr = "%.2f";
+const wxChar *wxFloatToStringStr = _T("%.2f");
+const wxChar *wxDoubleToStringStr = _T("%.2f");
#ifdef __WXMSW__
-const char *wxUserResourceStr = "TEXT";
+const wxChar *wxUserResourceStr = _T("TEXT");
#endif
#if wxUSE_SHARED_LIBRARY
else
SetBkMode(GetHdc(), OPAQUE);
- (void)TextOut(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), (char *) (const char *)text, strlen((const char *)text));
+ (void)TextOut(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), WXSTRINGCAST text, wxStrlen(WXSTRINGCAST text));
if (m_textBackgroundColour.Ok())
(void)SetBkColor(GetHdc(), old_background);
HFONT f = (HFONT) ::SelectObject(GetHdc(), (HFONT) m_font.GetResourceHandle());
if (f == (HFONT) NULL)
{
- wxLogDebug("::SelectObject failed in wxDC::SetFont.");
+ wxLogDebug(_T("::SelectObject failed in wxDC::SetFont."));
}
if (!m_oldFont)
m_oldFont = (WXHFONT) f;
SIZE sizeRect;
TEXTMETRIC tm;
- GetTextExtentPoint(GetHdc(), (char *)(const char *) string, strlen((char *)(const char *) string), &sizeRect);
+ GetTextExtentPoint(GetHdc(), WXSTRINGCAST string, wxStrlen(WXSTRINGCAST string), &sizeRect);
GetTextMetrics(GetHdc(), &tm);
if (x) *x = XDEV2LOGREL(sizeRect.cx);
wxPaintDC::wxPaintDC(wxWindow *canvas)
{
- wxCHECK_RET( canvas, "NULL canvas in wxPaintDC ctor" );
+ wxCHECK_RET( canvas, _T("NULL canvas in wxPaintDC ctor") );
#ifdef __WXDEBUG__
if ( !g_isPainting )
// a device context
if (bitmap.GetSelectedInto() && (bitmap.GetSelectedInto() != this))
{
- wxFatalError("Error in wxMemoryDC::SelectObject\nBitmap is selected in another wxMemoryDC.\nDelete the first wxMemoryDC or use SelectObject(NULL)");
+ wxFatalError(_T("Error in wxMemoryDC::SelectObject\nBitmap is selected in another wxMemoryDC.\nDelete the first wxMemoryDC or use SelectObject(NULL)"));
return;
}
if (bm == ERROR)
{
- wxFatalError("Error in wxMemoryDC::SelectObject\nBitmap may not be loaded, or may be selected in another wxMemoryDC.\nDelete the first wxMemoryDC to deselect bitmap.");
+ wxFatalError(_T("Error in wxMemoryDC::SelectObject\nBitmap may not be loaded, or may be selected in another wxMemoryDC.\nDelete the first wxMemoryDC to deselect bitmap."));
}
else if (!m_oldBitmap)
m_oldBitmap = (WXHBITMAP) bm;
{
m_isInteractive = interactive;
- if (!file.IsNull() && file != "")
+ if (!file.IsNull() && file != _T(""))
m_printData.SetFilename(file);
#if wxUSE_COMMON_DIALOGS
}
else
#endif
- if ((!driver_name.IsNull() && driver_name != "") &&
- (!device_name.IsNull() && device_name != "") &&
- (!file.IsNull() && file != ""))
+ if ((!driver_name.IsNull() && driver_name != _T("")) &&
+ (!device_name.IsNull() && device_name != _T("")) &&
+ (!file.IsNull() && file != _T("")))
{
- m_hDC = (WXHDC) CreateDC((char *) (const char *) driver_name, (char *) (const char *) device_name, (char *) (const char *) file, NULL);
+ m_hDC = (WXHDC) CreateDC(WXSTRINGCAST driver_name, WXSTRINGCAST device_name, WXSTRINGCAST file, NULL);
m_ok = m_hDC ? TRUE: FALSE;
}
else
{
DOCINFO docinfo;
docinfo.cbSize = sizeof(DOCINFO);
- docinfo.lpszDocName = (const char *)message;
+ docinfo.lpszDocName = (const wxChar*)message;
wxString filename(m_printData.GetFilename());
if (filename.IsEmpty())
docinfo.lpszOutput = NULL;
else
- docinfo.lpszOutput = (const char *) filename;
+ docinfo.lpszOutput = (const wxChar *) filename;
#if defined(__WIN95__)
docinfo.lpszDatatype = NULL;
if (ret <= 0)
{
DWORD lastError = GetLastError();
- wxLogDebug("wxDC::StartDoc failed with error: %d\n", lastError);
+ wxLogDebug(_T("wxDC::StartDoc failed with error: %d\n"), lastError);
}
#endif
GlobalFree(pd.hDevMode);
pd.hDevMode=NULL;
}
- return ( deviceName != "" );
+ return ( deviceName != _T("") );
}
#if 0
wxPrintData printData = printDataConst;
printData.ConvertToNative();
- char* driverName = (char*) NULL;
+ wxChar* driverName = (wxChar*) NULL;
wxString devNameStr = printData.GetPrinterName();
- char* deviceName;
- char* portName = (char*) NULL; // Obsolete in WIN32
+ wxChar* deviceName;
+ wxChar* portName = (wxChar*) NULL; // Obsolete in WIN32
- if (devNameStr == "")
- deviceName = (char*) NULL;
+ if (devNameStr == _T(""))
+ deviceName = (wxChar*) NULL;
else
- deviceName = (char*) (const char*) devNameStr;
+ deviceName = WXSTRINGCAST devNameStr;
LPDEVMODE lpDevMode = (LPDEVMODE) NULL;
if ( hDevMode )
lpDevMode = (DEVMODE*) GlobalLock(hDevMode);
- if (devNameStr == "")
+ if (devNameStr == _T(""))
{
// Retrieve the default device name
wxString portName;
bool ret = wxGetDefaultDeviceName(devNameStr, portName);
- wxASSERT_MSG( ret, "Could not get default device name." );
+ wxASSERT_MSG( ret, _T("Could not get default device name.") );
- deviceName = (char*) (const char*) devNameStr;
+ deviceName = WXSTRINGCAST devNameStr;
}
#ifdef __WIN32__
bool wxDDEServer::Create(const wxString& server_name)
{
m_serviceName = server_name;
- HSZ serviceName = DdeCreateStringHandle(DDEIdInst, (char*) (const char *)server_name, CP_WINANSI);
+ HSZ serviceName = DdeCreateStringHandle(DDEIdInst, WXSTRINGCAST server_name, CP_WINANSI);
if (DdeNameService(DDEIdInst, serviceName, (HSZ) NULL, DNS_REGISTER) == 0)
{
wxDDEServer::~wxDDEServer(void)
{
- if (m_serviceName != "")
+ if (m_serviceName != _T(""))
{
- HSZ serviceName = DdeCreateStringHandle(DDEIdInst, (char*) (const char *)m_serviceName, CP_WINANSI);
+ HSZ serviceName = DdeCreateStringHandle(DDEIdInst, WXSTRINGCAST m_serviceName, CP_WINANSI);
if (DdeNameService(DDEIdInst, serviceName, NULL, DNS_UNREGISTER) == 0)
{
DDEPrintError();
wxConnectionBase *wxDDEClient::MakeConnection(const wxString& /* host */, const wxString& server_name, const wxString& topic)
{
- HSZ serviceName = DdeCreateStringHandle(DDEIdInst, (char*) (const char *)server_name, CP_WINANSI);
- HSZ topic_atom = DdeCreateStringHandle(DDEIdInst, (char*) (const char *)topic, CP_WINANSI);
+ HSZ serviceName = DdeCreateStringHandle(DDEIdInst, WXSTRINGCAST server_name, CP_WINANSI);
+ HSZ topic_atom = DdeCreateStringHandle(DDEIdInst, WXSTRINGCAST topic, CP_WINANSI);
HCONV hConv = DdeConnect(DDEIdInst, serviceName, topic_atom, (PCONVCONTEXT)NULL);
if (hConv == (HCONV) NULL)
return (DdeDisconnect((HCONV) m_hConv) != 0);
}
-bool wxDDEConnection::Execute(char *data, int size, wxIPCFormat format)
+bool wxDDEConnection::Execute(wxChar *data, int size, wxIPCFormat format)
{
DWORD result;
if (size < 0)
- size = strlen(data);
+ size = wxStrlen(data);
size ++;
else return NULL;
}
-bool wxDDEConnection::Poke(const wxString& item, char *data, int size, wxIPCFormat format)
+bool wxDDEConnection::Poke(const wxString& item, wxChar *data, int size, wxIPCFormat format)
{
DWORD result;
if (size < 0)
- size = strlen(data);
+ size = wxStrlen(data);
size ++;
}
// Calls that SERVER can make
-bool wxDDEConnection::Advise(const wxString& item, char *data, int size, wxIPCFormat format)
+bool wxDDEConnection::Advise(const wxString& item, wxChar *data, int size, wxIPCFormat format)
{
if (size < 0)
- size = strlen(data);
+ size = wxStrlen(data);
size ++;
{
case XTYP_CONNECT:
{
- char topic_buf[100];
- char server_buf[100];
- DdeQueryString(DDEIdInst, hsz1, (LPSTR)topic_buf, sizeof(topic_buf),
+ wxChar topic_buf[100];
+ wxChar server_buf[100];
+ DdeQueryString(DDEIdInst, hsz1, (LPTSTR)topic_buf, WXSIZEOF(topic_buf),
CP_WINANSI);
- DdeQueryString(DDEIdInst, hsz2, (LPSTR)server_buf, sizeof(topic_buf),
+ DdeQueryString(DDEIdInst, hsz2, (LPTSTR)server_buf, WXSIZEOF(topic_buf),
CP_WINANSI);
wxDDEServer *server = DDEFindServer(server_buf);
if (server)
if (connection)
{
- char item_name[200];
- DdeQueryString(DDEIdInst, hsz2, (LPSTR)item_name, sizeof(item_name),
+ wxChar item_name[200];
+ DdeQueryString(DDEIdInst, hsz2, (LPTSTR)item_name, WXSIZEOF(item_name),
CP_WINANSI);
int user_size = -1;
if (connection)
{
- char item_name[200];
- DdeQueryString(DDEIdInst, hsz2, (LPSTR)item_name, sizeof(item_name),
+ wxChar item_name[200];
+ DdeQueryString(DDEIdInst, hsz2, (LPTSTR)item_name, WXSIZEOF(item_name),
CP_WINANSI);
DWORD len = DdeGetData(hData, (LPBYTE)(connection->m_bufPtr), connection->m_bufSize, 0);
DdeFreeDataHandle(hData);
if (connection)
{
- char item_name[200];
- DdeQueryString(DDEIdInst, hsz2, (LPSTR)item_name, sizeof(item_name),
+ wxChar item_name[200];
+ DdeQueryString(DDEIdInst, hsz2, (LPTSTR)item_name, WXSIZEOF(item_name),
CP_WINANSI);
return (DDERETURN)connection->OnStartAdvise(connection->m_topicName, wxString(item_name));
if (connection)
{
- char item_name[200];
- DdeQueryString(DDEIdInst, hsz2, (LPSTR)item_name, sizeof(item_name),
+ wxChar item_name[200];
+ DdeQueryString(DDEIdInst, hsz2, (LPTSTR)item_name, WXSIZEOF(item_name),
CP_WINANSI);
return (DDERETURN)connection->OnStopAdvise(connection->m_topicName, wxString(item_name));
} else return (DDERETURN)0;
if (connection)
{
- char item_name[200];
- DdeQueryString(DDEIdInst, hsz2, (LPSTR)item_name, sizeof(item_name),
+ wxChar item_name[200];
+ DdeQueryString(DDEIdInst, hsz2, (LPTSTR)item_name, WXSIZEOF(item_name),
CP_WINANSI);
DWORD len = DdeGetData(hData, (LPBYTE)(connection->m_bufPtr), connection->m_bufSize, 0);
// Atom table stuff
static HSZ DDEAddAtom(const wxString& string)
{
- HSZ atom = DdeCreateStringHandle(DDEIdInst, (char*) (const char *)string, CP_WINANSI);
+ HSZ atom = DdeCreateStringHandle(DDEIdInst, WXSTRINGCAST string, CP_WINANSI);
wxAtomTable.Append(string, (wxObject *)atom);
return atom;
}
void DDEPrintError(void)
{
- char *err = NULL;
+ wxChar *err = NULL;
switch (DdeGetLastError(DDEIdInst))
{
case DMLERR_ADVACKTIMEOUT:
- err = "A request for a synchronous advise transaction has timed out.";
+ err = _T("A request for a synchronous advise transaction has timed out.");
break;
case DMLERR_BUSY:
- err = "The response to the transaction caused the DDE_FBUSY bit to be set.";
+ err = _T("The response to the transaction caused the DDE_FBUSY bit to be set.");
break;
case DMLERR_DATAACKTIMEOUT:
- err = "A request for a synchronous data transaction has timed out.";
+ err = _T("A request for a synchronous data transaction has timed out.");
break;
case DMLERR_DLL_NOT_INITIALIZED:
- err = "A DDEML function was called without first calling the DdeInitialize function,\n\ror an invalid instance identifier\n\rwas passed to a DDEML function.";
+ err = _T("A DDEML function was called without first calling the DdeInitialize function,\n\ror an invalid instance identifier\n\rwas passed to a DDEML function.");
break;
case DMLERR_DLL_USAGE:
- err = "An application initialized as APPCLASS_MONITOR has\n\rattempted to perform a DDE transaction,\n\ror an application initialized as APPCMD_CLIENTONLY has \n\rattempted to perform server transactions.";
+ err = _T("An application initialized as APPCLASS_MONITOR has\n\rattempted to perform a DDE transaction,\n\ror an application initialized as APPCMD_CLIENTONLY has \n\rattempted to perform server transactions.");
break;
case DMLERR_EXECACKTIMEOUT:
- err = "A request for a synchronous execute transaction has timed out.";
+ err = _T("A request for a synchronous execute transaction has timed out.");
break;
case DMLERR_INVALIDPARAMETER:
- err = "A parameter failed to be validated by the DDEML.";
+ err = _T("A parameter failed to be validated by the DDEML.");
break;
case DMLERR_LOW_MEMORY:
- err = "A DDEML application has created a prolonged race condition.";
+ err = _T("A DDEML application has created a prolonged race condition.");
break;
case DMLERR_MEMORY_ERROR:
- err = "A memory allocation failed.";
+ err = _T("A memory allocation failed.");
break;
case DMLERR_NO_CONV_ESTABLISHED:
- err = "A client's attempt to establish a conversation has failed.";
+ err = _T("A client's attempt to establish a conversation has failed.");
break;
case DMLERR_NOTPROCESSED:
- err = "A transaction failed.";
+ err = _T("A transaction failed.");
break;
case DMLERR_POKEACKTIMEOUT:
- err = "A request for a synchronous poke transaction has timed out.";
+ err = _T("A request for a synchronous poke transaction has timed out.");
break;
case DMLERR_POSTMSG_FAILED:
- err = "An internal call to the PostMessage function has failed. ";
+ err = _T("An internal call to the PostMessage function has failed. ");
break;
case DMLERR_REENTRANCY:
- err = "Reentrancy problem.";
+ err = _T("Reentrancy problem.");
break;
case DMLERR_SERVER_DIED:
- err = "A server-side transaction was attempted on a conversation\n\rthat was terminated by the client, or the server\n\rterminated before completing a transaction.";
+ err = _T("A server-side transaction was attempted on a conversation\n\rthat was terminated by the client, or the server\n\rterminated before completing a transaction.");
break;
case DMLERR_SYS_ERROR:
- err = "An internal error has occurred in the DDEML.";
+ err = _T("An internal error has occurred in the DDEML.");
break;
case DMLERR_UNADVACKTIMEOUT:
- err = "A request to end an advise transaction has timed out.";
+ err = _T("A request to end an advise transaction has timed out.");
break;
case DMLERR_UNFOUND_QUEUE_ID:
- err = "An invalid transaction identifier was passed to a DDEML function.\n\rOnce the application has returned from an XTYP_XACT_COMPLETE callback,\n\rthe transaction identifier for that callback is no longer valid.";
+ err = _T("An invalid transaction identifier was passed to a DDEML function.\n\rOnce the application has returned from an XTYP_XACT_COMPLETE callback,\n\rthe transaction identifier for that callback is no longer valid.");
break;
default:
- err = "Unrecognised error type.";
+ err = _T("Unrecognised error type.");
break;
}
- MessageBox((HWND) NULL, (LPCSTR)err, "DDE Error", MB_OK | MB_ICONINFORMATION);
+ MessageBox((HWND) NULL, (LPCTSTR)err, _T("DDE Error"), MB_OK | MB_ICONINFORMATION);
}
#endif
// Allows creation of dialogs with & without captions under MSWindows,
// resizeable or not (but a resizeable dialog always has caption -
// otherwise it would look too strange)
- const char *dlg;
+ const wxChar *dlg;
if ( style & wxTHICK_FRAME )
- dlg = "wxResizeableDialog";
+ dlg = _T("wxResizeableDialog");
else if ( style & wxCAPTION )
- dlg = "wxCaptionDialog";
+ dlg = _T("wxCaptionDialog");
else
- dlg = "wxNoCaptionDialog";
+ dlg = _T("wxNoCaptionDialog");
MSWCreate(m_windowId, parent, NULL, this, NULL,
x, y, width, height,
0, // style is not used if we have dlg template
void wxDialog::SetTitle(const wxString& title)
{
- SetWindowText((HWND) GetHWND(), (const char *)title);
+ SetWindowText((HWND) GetHWND(), title.c_str());
}
wxString wxDialog::GetTitle() const
BITMAPFILEHEADER bf;
WORD nNumColors;
BOOL result = FALSE;
- char str[128];
+ wxChar str[128];
WORD offBits;
HDC hDC;
BOOL bCoreHead = FALSE;
fh = OpenFile (lpFileName, &of, OF_READ);
if (fh == -1) {
- wsprintf(str,"Can't open file '%s'", lpFileName);
- MessageBox(NULL, str, "Error", MB_ICONSTOP | MB_OK);
+ wsprintf(str,_T("Can't open file '%s'"), lpFileName);
+ MessageBox(NULL, str, _T("Error"), MB_ICONSTOP | MB_OK);
return (0);
}
* bits....
*/
-int DibWriteFile(LPSTR szFile, LPBITMAPINFOHEADER lpbi)
+int DibWriteFile(LPTSTR szFile, LPBITMAPINFOHEADER lpbi)
{
HFILE fh;
OFSTRUCT of;
- fh = OpenFile(szFile, &of, OF_WRITE | OF_CREATE);
+ fh = OpenFile(wxConvFile.cWX2MB(szFile), &of, OF_WRITE | OF_CREATE);
if (!fh) {
// printf("la regamos0");
return 1;
}
-PDIB DibOpenFile(LPSTR szFile)
+PDIB DibOpenFile(LPTSTR szFile)
{
HFILE fh;
DWORD dwLen;
#define GetCurrentInstance() (HINSTANCE)SELECTOROF((LPVOID)&of)
#endif
- fh = OpenFile(szFile, &of, OF_READ);
+ fh = OpenFile(wxConvFile.cWX2MB(szFile), &of, OF_READ);
if (fh == -1)
{
// TODO: Unicode version
#ifdef __WIN16__
h = FindResource(GetCurrentInstance(), szFile, RT_BITMAP);
+#elif wxUSE_UNICODE
+ h = FindResourceW(GetCurrentInstance(), szFile, RT_BITMAP);
#else
h = FindResourceA(GetCurrentInstance(), szFile, RT_BITMAP);
#endif
*/
// Fill in the BROWSEINFO structure.
+ wxWX2MBbuf message = m_message.mb_str();
bi.hwndOwner = hWnd;
bi.pidlRoot = NULL; // pidlPrograms;
bi.pszDisplayName = lpBuffer;
- bi.lpszTitle = (LPCTSTR) (const char *) m_message;
+ bi.lpszTitle = (const char*)message; // BC++ 4.52 says LPSTR, not LPTSTR?
bi.ulFlags = 0;
bi.lpfn = NULL;
bi.lParam = 0;
IMPLEMENT_CLASS(wxFileDialog, wxDialog)
#endif
-wxString wxFileSelector(const char *title,
- const char *defaultDir,
- const char *defaultFileName,
- const char *defaultExtension,
- const char *filter,
+wxString wxFileSelector(const wxChar *title,
+ const wxChar *defaultDir,
+ const wxChar *defaultFileName,
+ const wxChar *defaultExtension,
+ const wxChar *filter,
int flags,
wxWindow *parent,
int x, int y)
wxString filter2;
if ( defaultExtension && !filter )
- filter2 = wxString("*.") + defaultExtension;
+ filter2 = wxString(_T("*.")) + defaultExtension;
else if ( filter )
filter2 = filter;
wxFileDialog fileDialog(parent, title, defaultDirString,
defaultFilenameString, filter2,
flags, wxPoint(x, y));
- if( Strlen(defaultExtension) != 0 )
+ if( wxStrlen(defaultExtension) != 0 )
{
int filterFind = 1,
filterIndex = 0;
for( unsigned int i = 0; i < filter2.Len(); i++ )
{
- if( filter2.GetChar(i) == '|' )
+ if( filter2.GetChar(i) == _T('|') )
{
// save the start index of the new filter
unsigned int is = i++;
// find the end of the filter
for( ; i < filter2.Len(); i++ )
{
- if(filter2[i] == '|')
+ if(filter2[i] == _T('|'))
break;
}
if ( fileDialog.ShowModal() == wxID_OK )
{
- strcpy(wxBuffer, (const char *)fileDialog.GetPath());
+ wxStrcpy(wxBuffer, (const wxChar *)fileDialog.GetPath());
return wxBuffer;
}
else
# endif
-wxString wxFileSelectorEx(const char *title,
- const char *defaultDir,
- const char *defaultFileName,
+wxString wxFileSelectorEx(const wxChar *title,
+ const wxChar *defaultDir,
+ const wxChar *defaultFileName,
int* defaultFilterIndex,
- const char *filter,
+ const wxChar *filter,
int flags,
wxWindow* parent,
int x,
int y)
{
- wxFileDialog fileDialog(parent, title ? title : "", defaultDir ? defaultDir : "",
- defaultFileName ? defaultFileName : "", filter ? filter : "", flags, wxPoint(x, y));
+ wxFileDialog fileDialog(parent, title ? title : _T(""), defaultDir ? defaultDir : _T(""),
+ defaultFileName ? defaultFileName : _T(""), filter ? filter : _T(""), flags, wxPoint(x, y));
if ( fileDialog.ShowModal() == wxID_OK )
{
*defaultFilterIndex = fileDialog.GetFilterIndex();
- strcpy(wxBuffer, (const char *)fileDialog.GetPath());
+ wxStrcpy(wxBuffer, (const wxChar *)fileDialog.GetPath());
return wxBuffer;
}
else
m_message = message;
m_dialogStyle = style;
m_parent = parent;
- m_path = "";
+ m_path = _T("");
m_fileName = defaultFileName;
m_dir = defaultDir;
m_wildCard = wildCard;
HWND hWnd = 0;
if (m_parent) hWnd = (HWND) m_parent->GetHWND();
- static char fileNameBuffer [ MAXPATH ]; // the file-name
- char titleBuffer [ MAXFILE+1+MAXEXT ]; // the file-name, without path
+ static wxChar fileNameBuffer [ MAXPATH ]; // the file-name
+ wxChar titleBuffer [ MAXFILE+1+MAXEXT ]; // the file-name, without path
- *fileNameBuffer = '\0';
- *titleBuffer = '\0';
+ *fileNameBuffer = _T('\0');
+ *titleBuffer = _T('\0');
long msw_flags = 0;
if ( (m_dialogStyle & wxHIDE_READONLY) || (m_dialogStyle & wxSAVE) )
of.lStructSize = sizeof(OPENFILENAME);
of.hwndOwner = hWnd;
- of.lpstrTitle = (char *)(const char *)m_message;
+ of.lpstrTitle = WXSTRINGCAST m_message;
of.lpstrFileTitle = titleBuffer;
size_t i = 0;
size_t len = m_dir.Length();
for (i = 0; i < len; i++)
- if (m_dir[i] == '/')
- m_dir[i] = '\\';
+ if (m_dir[i] == _T('/'))
+ m_dir[i] = _T('\\');
- of.lpstrInitialDir = (const char *) m_dir;
+ of.lpstrInitialDir = m_dir.c_str();
of.Flags = msw_flags;
//=======================================================================
wxString theFilter;
- if ( Strlen(m_wildCard) == 0 )
- theFilter = wxString("*.*");
+ if ( wxStrlen(m_wildCard) == 0 )
+ theFilter = wxString(_T("*.*"));
else
theFilter = m_wildCard ;
wxString filterBuffer;
- if ( !strchr( theFilter, '|' ) ) { // only one filter ==> default text
+ if ( !wxStrchr( theFilter, _T('|') ) ) { // only one filter ==> default text
filterBuffer.Printf(_("Files (%s)|%s"),
theFilter.c_str(), theFilter.c_str());
}
}
- filterBuffer += "|";
+ filterBuffer += _T("|");
// Replace | with \0
for (i = 0; i < filterBuffer.Len(); i++ ) {
- if ( filterBuffer.GetChar(i) == '|' ) {
- filterBuffer[i] = '\0';
+ if ( filterBuffer.GetChar(i) == _T('|') ) {
+ filterBuffer[i] = _T('\0');
}
}
- of.lpstrFilter = (LPSTR)(const char *)filterBuffer;
+ of.lpstrFilter = (LPTSTR)(const wxChar *)filterBuffer;
of.nFilterIndex = m_filterIndex;
//=== Setting defaultFileName >>=========================================
- strncpy( fileNameBuffer, (const char *)m_fileName, MAXPATH-1 );
- fileNameBuffer[ MAXPATH-1 ] = '\0';
+ wxStrncpy( fileNameBuffer, (const wxChar *)m_fileName, MAXPATH-1 );
+ fileNameBuffer[ MAXPATH-1 ] = _T('\0');
of.lpstrFile = fileNameBuffer; // holds returned filename
of.nMaxFile = MAXPATH;
if ( success )
{
- const char* extension = NULL;
+ const wxChar* extension = NULL;
//=== Adding the correct extension >>=================================
m_filterIndex = (int)of.nFilterIndex;
- if ( of.nFileExtension && fileNameBuffer[ of.nFileExtension-1] != '.' )
+ if ( of.nFileExtension && fileNameBuffer[ of.nFileExtension-1] != _T('.') )
{ // user has typed an filename
// without an extension:
extension = filterBuffer;
for( int i = 0; i < maxFilter; i++ ) { // get extension
- extension = extension + strlen( extension ) +1;
+ extension = extension + wxStrlen( extension ) +1;
}
- extension = strrchr( extension, '.' );
+ extension = wxStrrchr( extension, _T('.') );
if ( extension // != "blabla"
- && !strrchr( extension, '*' ) // != "blabla.*"
- && !strrchr( extension, '?' ) // != "blabla.?"
+ && !wxStrrchr( extension, _T('*') ) // != "blabla.*"
+ && !wxStrrchr( extension, _T('?') ) // != "blabla.?"
&& extension[1] // != "blabla."
- && extension[1] != ' ' ) // != "blabla. "
+ && extension[1] != _T(' ') ) // != "blabla. "
{
// now concat extension to the fileName:
m_fileName = wxString(fileNameBuffer) + extension;
- int len = strlen( fileNameBuffer );
- strncpy( fileNameBuffer + len, extension, MAXPATH - len );
- fileNameBuffer[ MAXPATH -1 ] = '\0';
+ int len = wxStrlen( fileNameBuffer );
+ wxStrncpy( fileNameBuffer + len, extension, MAXPATH - len );
+ fileNameBuffer[ MAXPATH -1 ] = _T('\0');
}
}
// Generic file load/save dialog (for internal use only)
static
wxString wxDefaultFileSelector(bool load,
- const char *what,
- const char *extension,
- const char *default_name,
+ const wxChar *what,
+ const wxChar *extension,
+ const wxChar *default_name,
wxWindow *parent)
{
wxString prompt;
- wxString str = load ? _("Load %s file") : _("Save %s file");
+ wxString str;
+ if (load) str = _("Load %s file");
+ else str = _("Save %s file");
prompt.Printf(str, what);
- const char *ext = extension;
- if (*ext == '.')
+ const wxChar *ext = extension;
+ if (*ext == _T('.'))
ext++;
wxString wild;
- wild.Printf("*.%s", ext);
+ wild.Printf(_T("*.%s"), ext);
return wxFileSelector (prompt, NULL, default_name, ext, wild, 0, parent);
}
// Generic file load dialog
-WXDLLEXPORT wxString wxLoadFileSelector(const char *what,
- const char *extension,
- const char *default_name,
+WXDLLEXPORT wxString wxLoadFileSelector(const wxChar *what,
+ const wxChar *extension,
+ const wxChar *default_name,
wxWindow *parent)
{
return wxDefaultFileSelector(TRUE, what, extension, default_name, parent);
}
// Generic file save dialog
-WXDLLEXPORT wxString wxSaveFileSelector(const char *what,
- const char *extension,
- const char *default_name,
+WXDLLEXPORT wxString wxSaveFileSelector(const wxChar *what,
+ const wxChar *extension,
+ const wxChar *default_name,
wxWindow *parent)
{
return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
else if (M_FONTDATA->m_weight == wxBOLD)
ff_weight = FW_BOLD;
- const char* pzFace = (const char*) ff_face;
+ const wxChar* pzFace = (const wxChar*) ff_face;
if (!M_FONTDATA->m_faceName.IsNull())
- pzFace = (const char*) M_FONTDATA->m_faceName ;
+ pzFace = (const wxChar*) M_FONTDATA->m_faceName ;
/* Always calculate fonts using the screen DC (is this the best strategy?)
* There may be confusion if a font is selected into a printer
logFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
logFont->lfQuality = PROOF_QUALITY;
logFont->lfPitchAndFamily = DEFAULT_PITCH | ff_family;
- strcpy(logFont->lfFaceName, ff_face);
+ wxStrcpy(logFont->lfFaceName, ff_face);
}
wxFont wxCreateFontFromLogFont(LOGFONT *logFont) // , bool createNew)
int fontWeight = wxNORMAL;
int fontPoints = 10;
bool fontUnderline = FALSE;
- char *fontFace = NULL;
+ wxChar *fontFace = NULL;
// int lfFamily = logFont->lfPitchAndFamily & 0xF0;
int lfFamily = logFont->lfPitchAndFamily;
extern wxWindowList wxModelessWindows;
extern wxList WXDLLEXPORT wxPendingDelete;
-extern char wxFrameClassName[];
+extern wxChar wxFrameClassName[];
extern wxMenu *wxCurrentPopupMenu;
#if !USE_SHARED_LIBRARY
{
// VZ: calling CreateStatusBar twice is an error - why anyone would do it?
wxCHECK_MSG( m_frameStatusBar == NULL, FALSE,
- "recreating status bar in wxFrame" );
+ _T("recreating status bar in wxFrame") );
m_frameStatusBar = OnCreateStatusBar(number, style, id,
name);
void wxFrame::SetStatusText(const wxString& text, int number)
{
- wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" );
+ wxCHECK_RET( m_frameStatusBar != NULL, _T("no statusbar to set text for") );
m_frameStatusBar->SetStatusText(text, number);
}
void wxFrame::SetStatusWidths(int n, const int widths_field[])
{
- wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" );
+ wxCHECK_RET( m_frameStatusBar != NULL, _T("no statusbar to set widths for") );
m_frameStatusBar->SetStatusWidths(n, widths_field);
PositionStatusBar();
return;
}
- wxCHECK_RET( !menu_bar->GetFrame(), "this menubar is already attached" );
+ wxCHECK_RET( !menu_bar->GetFrame(), _T("this menubar is already attached") );
if (m_frameMenuBar)
delete m_frameMenuBar;
*
*/
-bool wxFrame::MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *wx_win, const char *title,
+bool wxFrame::MSWCreate(int id, wxWindow *parent, const wxChar *wclass, wxWindow *wx_win, const wxChar *title,
int x, int y, int width, int height, long style)
{
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{
wxCHECK_MSG( m_frameToolBar == NULL, FALSE,
- "recreating toolbar in wxFrame" );
+ _T("recreating toolbar in wxFrame") );
wxToolBar* toolBar = OnCreateToolBar(style, id, name);
if (toolBar)
msFlags |= ZYZGS_3D;
HWND wx_button =
- CreateWindowEx(MakeExtendedStyle(m_windowStyle), "zYzGauge", NULL, msFlags,
+ CreateWindowEx(MakeExtendedStyle(m_windowStyle), _T("zYzGauge"), NULL, msFlags,
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
wxGetInstance(), NULL);
/* static global variables */
-static char gszzYzGaugeClass[] = "zYzGauge";
+static wxChar gszzYzGaugeClass[] = _T("zYzGauge");
/* window word position definitions */
/* Get a DC to determine whether device is mono or not, and set
* default foreground/background colors as appropriate.
*/
- if ((hdc = CreateIC("DISPLAY", NULL, NULL, 0L)))
+ if ((hdc = CreateIC(_T("DISPLAY"), NULL, NULL, 0L)))
{
/* check for mono-display */
if ((GetDeviceCaps(hdc, BITSPIXEL) == 1) &&
DWORD dwExtent;
RECT rc1, rc2;
HFONT hFont;
- char ach[ 6 ];
+ wxChar ach[ 6 ];
WORD dx, dy, wGomerX, wGomerY;
/* Win32s has no GetTextExtent(); let's try GetTextExtentPoint() instead,
* which needs a SIZE* parameter */
hFont = (HFONT) SelectObject(hdc, pgauge->hFont);
/* build up a string to blit out--ie the meaning of life: "42%" */
- wsprintf(ach, "%3d%%", (WORD)((DWORD)iPos * 100 / iRange));
+ wsprintf(ach, _T("%3d%%"), (WORD)((DWORD)iPos * 100 / iRange));
/* Win32s has no GetTextExtent(); let's try GetTextExtentPoint() instead */
#if defined(__WIN32__)
GetTextExtentPoint(hdc, ach, wGomerX = lstrlen(ach), &size);
bool wxWinHelpController::DisplayContents(void)
{
- if (m_helpFile == "") return FALSE;
+ if (m_helpFile == _T("")) return FALSE;
wxString str = m_helpFile;
size_t len = str.Length();
- if (!(str[(size_t)(len-1)] == 'p' && str[(size_t)(len-2)] == 'l' && str[(size_t)(len-3)] == 'h' && str[(size_t)(len-4)] == '.'))
- str += ".hlp";
+ if (!(str[(size_t)(len-1)] == _T('p') && str[(size_t)(len-2)] == _T('l') && str[(size_t)(len-3)] == _T('h') && str[(size_t)(len-4)] == _T('.')))
+ str += _T(".hlp");
if (wxTheApp->GetTopWindow())
{
#if defined(__WIN95__)
- WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const char*) str, HELP_FINDER, 0L);
+ WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_FINDER, 0L);
#else
- WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const char*) str, HELP_CONTENTS, 0L);
+ WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTENTS, 0L);
#endif
return TRUE;
}
bool wxWinHelpController::DisplaySection(int section)
{
// Use context number
- if (m_helpFile == "") return FALSE;
+ if (m_helpFile == _T("")) return FALSE;
wxString str = m_helpFile;
size_t len = str.Length();
- if (!(str[(size_t)(len-1)] == 'p' && str[(size_t)(len-2)] == 'l' && str[(size_t)(len-3)] == 'h' && str[(size_t)(len-4)] == '.'))
- str += ".hlp";
+ if (!(str[(size_t)(len-1)] == _T('p') && str[(size_t)(len-2)] == _T('l') && str[(size_t)(len-3)] == _T('h') && str[(size_t)(len-4)] == _T('.')))
+ str += _T(".hlp");
if (wxTheApp->GetTopWindow())
{
- WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const char*) str, HELP_CONTEXT, (DWORD)section);
+ WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)section);
return TRUE;
}
return FALSE;
bool wxWinHelpController::DisplayBlock(long block)
{
// Use context number -- a very rough equivalent to block id!
- if (m_helpFile == "") return FALSE;
+ if (m_helpFile == _T("")) return FALSE;
wxString str = m_helpFile;
size_t len = str.Length();
if (!(str[(size_t)(len-1)] == 'p' && str[(size_t)(len-2)] == 'l' && str[(size_t)(len-3)] == 'h' && str[(size_t)(len-4)] == '.'))
- str += ".hlp";
+ str += _T(".hlp");
if (wxTheApp->GetTopWindow())
{
- WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const char*) str, HELP_CONTEXT, (DWORD)block);
+ WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)block);
return TRUE;
}
return FALSE;
bool wxWinHelpController::KeywordSearch(const wxString& k)
{
- if (m_helpFile == "") return FALSE;
+ if (m_helpFile == _T("")) return FALSE;
wxString str = m_helpFile;
size_t len = str.Length();
- if (!(str[(size_t)(len-1)] == 'p' && str[(size_t)(len-2)] == 'l' && str[(size_t)(len-3)] == 'h' && str[(size_t)(len-4)] == '.'))
- str += ".hlp";
+ if (!(str[(size_t)(len-1)] == _T('p') && str[(size_t)(len-2)] == _T('l') && str[(size_t)(len-3)] == _T('h') && str[(size_t)(len-4)] == _T('.')))
+ str += _T(".hlp");
if (wxTheApp->GetTopWindow())
{
- WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const char*) str, HELP_PARTIALKEY, (DWORD)(const char*) k);
+ WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_PARTIALKEY, (DWORD)(const wxChar*) k);
return TRUE;
}
return FALSE;
{
wxIcon *icon = (wxIcon *)bitmap;
wxIconRefData *data = (wxIconRefData *)icon->GetRefData();
- data->m_hIcon = (WXHICON)ReadIconFile((char *)name.c_str(), wxGetInstance(),
+ data->m_hIcon = (WXHICON)ReadIconFile((wxChar *)name.c_str(), wxGetInstance(),
&data->m_width, &data->m_height);
data->m_ok = data->m_hIcon != 0;
event.m_commandInt = aSelections[0] ;
event.m_clientData = GetClientData(event.m_commandInt);
wxString str(GetString(event.m_commandInt));
- if (str != "")
+ if (str != _T(""))
{
event.m_commandString = str;
}
wstyle |= WS_BORDER;
}
- m_hWnd = (WXHWND)::CreateWindowEx(exStyle, "LISTBOX", NULL,
+ m_hWnd = (WXHWND)::CreateWindowEx(exStyle, _T("LISTBOX"), NULL,
wstyle | WS_CHILD,
0, 0, 0, 0,
(HWND)parent->GetHWND(), (HMENU)m_windowId,
wxGetInstance(), NULL);
- wxCHECK_MSG( m_hWnd, FALSE, "Failed to create listbox" );
+ wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create listbox") );
#if wxUSE_CTL3D
if (want3D)
void wxListBox::SetFirstItem(int N)
{
wxCHECK_RET( N >= 0 && N < m_noItems,
- "invalid index in wxListBox::SetFirstItem" );
+ _T("invalid index in wxListBox::SetFirstItem") );
SendMessage(GetHwnd(),LB_SETTOPINDEX,(WPARAM)N,(LPARAM)0) ;
}
void wxListBox::Delete(int N)
{
wxCHECK_RET( N >= 0 && N < m_noItems,
- "invalid index in wxListBox::Delete" );
+ _T("invalid index in wxListBox::Delete") );
SendMessage(GetHwnd(), LB_DELETESTRING, N, 0);
m_noItems--;
if ( m_windowStyle & wxLB_OWNERDRAW ) {
// client data must be pointer to wxOwnerDrawn, otherwise we would crash
// in OnMeasure/OnDraw.
- wxFAIL_MSG("Can't use client data with owner-drawn listboxes");
+ wxFAIL_MSG(_T("Can't use client data with owner-drawn listboxes"));
}
else
#endif
ListBox_SetItemData(GetHwnd(), ui, pNewItem);
wxASSERT_MSG(clientData[ui] == NULL,
- "Can't use client data with owner-drawn listboxes");
+ _T("Can't use client data with owner-drawn listboxes"));
}
}
#endif
void wxListBox::SetSelection(int N, bool select)
{
wxCHECK_RET( N >= 0 && N < m_noItems,
- "invalid index in wxListBox::SetSelection" );
+ _T("invalid index in wxListBox::SetSelection") );
if ((m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED))
SendMessage(GetHwnd(), LB_SETSEL, select, N);
bool wxListBox::Selected(int N) const
{
wxCHECK_MSG( N >= 0 && N < m_noItems, FALSE,
- "invalid index in wxListBox::Selected" );
+ _T("invalid index in wxListBox::Selected") );
return SendMessage(GetHwnd(), LB_GETSEL, N, 0) == 0 ? FALSE : TRUE;
}
void wxListBox::Deselect(int N)
{
wxCHECK_RET( N >= 0 && N < m_noItems,
- "invalid index in wxListBox::Deselect" );
+ _T("invalid index in wxListBox::Deselect") );
if ((m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED))
SendMessage(GetHwnd(), LB_SETSEL, FALSE, N);
void *wxListBox::GetClientData(int N) const
{
wxCHECK_MSG( N >= 0 && N < m_noItems, NULL,
- "invalid index in wxListBox::GetClientData" );
+ _T("invalid index in wxListBox::GetClientData") );
- return (char *)SendMessage(GetHwnd(), LB_GETITEMDATA, N, 0);
+ return (void *)SendMessage(GetHwnd(), LB_GETITEMDATA, N, 0);
}
void wxListBox::SetClientData(int N, void *Client_data)
{
wxCHECK_RET( N >= 0 && N < m_noItems,
- "invalid index in wxListBox::SetClientData" );
+ _T("invalid index in wxListBox::SetClientData") );
if ( ListBox_SetItemData(GetHwnd(), N, Client_data) == LB_ERR )
- wxLogDebug("LB_SETITEMDATA failed");
+ wxLogDebug(_T("LB_SETITEMDATA failed"));
}
// Return number of selections and an array of selected integers
if (no_sel != 0) {
int *selections = new int[no_sel];
if ( ListBox_GetSelItems(GetHwnd(), no_sel, selections) == LB_ERR ) {
- wxFAIL_MSG("This listbox can't have single-selection style!");
+ wxFAIL_MSG(_T("This listbox can't have single-selection style!"));
}
aSelections.Alloc(no_sel);
wxCHECK_MSG( !(m_windowStyle & wxLB_MULTIPLE) &&
!(m_windowStyle & wxLB_EXTENDED),
-1,
- "GetSelection() can't be used with multiple-selection "
- "listboxes, use GetSelections() instead." );
+ _T("GetSelection() can't be used with multiple-selection "
+ "listboxes, use GetSelections() instead.") );
return ListBox_GetCurSel(GetHwnd());
}
wxString wxListBox::GetString(int N) const
{
wxCHECK_MSG( N >= 0 && N < m_noItems, "",
- "invalid index in wxListBox::GetClientData" );
+ _T("invalid index in wxListBox::GetClientData") );
int len = ListBox_GetTextLen(GetHwnd(), N);
return;
TEXTMETRIC lpTextMetric;
- if (s != "")
+ if (s != _T(""))
{
int existingExtent = (int)SendMessage(GetHwnd(), LB_GETHORIZONTALEXTENT, 0, 0L);
HDC dc = GetWindowDC(GetHwnd());
GetTextMetrics(dc, &lpTextMetric);
SIZE extentXY;
- ::GetTextExtentPoint(dc, (LPSTR) (const char *)s, s.Length(), &extentXY);
+ ::GetTextExtentPoint(dc, (LPTSTR) (const wxChar *)s, s.Length(), &extentXY);
int extentX = (int)(extentXY.cx + lpTextMetric.tmAveCharWidth);
if (oldFont)
int len = (int)SendMessage(GetHwnd(), LB_GETTEXT, i, (LONG)wxBuffer);
wxBuffer[len] = 0;
SIZE extentXY;
- ::GetTextExtentPoint(dc, (LPSTR)wxBuffer, len, &extentXY);
+ ::GetTextExtentPoint(dc, (LPTSTR)wxBuffer, len, &extentXY);
int extentX = (int)(extentXY.cx + lpTextMetric.tmAveCharWidth);
if (extentX > largestExtent)
largestExtent = extentX;
wxListBox::InsertItems(int nItems, const wxString items[], int pos)
{
wxCHECK_RET( pos >= 0 && pos <= m_noItems,
- "invalid index in wxListBox::InsertItems" );
+ _T("invalid index in wxListBox::InsertItems") );
int i;
for (i = 0; i < nItems; i++)
ListBox_InsertString(GetHwnd(), i + pos, items[i]);
m_noItems += nItems;
- SetHorizontalExtent("");
+ SetHorizontalExtent(_T(""));
}
void wxListBox::SetString(int N, const wxString& s)
{
wxCHECK_RET( N >= 0 && N < m_noItems,
- "invalid index in wxListBox::SetString" );
+ _T("invalid index in wxListBox::SetString") );
int sel = -1;
if (!(m_windowStyle & wxLB_MULTIPLE) && !(m_windowStyle & wxLB_EXTENDED))
if (N == (m_noItems - 1))
newN = -1;
- SendMessage(GetHwnd(), LB_INSERTSTRING, newN, (LPARAM) (const char *)s);
+ SendMessage(GetHwnd(), LB_INSERTSTRING, newN, (LPARAM) (const wxChar *)s);
if (oldData)
wxListBox::SetClientData(N, oldData);
MEASUREITEMSTRUCT *pStruct = (MEASUREITEMSTRUCT *)item;
wxDC dc;
- dc.SetHDC((WXHDC)CreateIC("DISPLAY", NULL, NULL, 0));
+ dc.SetHDC((WXHDC)CreateIC(_T("DISPLAY"), NULL, NULL, 0));
dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_ANSI_VAR_FONT));
pStruct->itemHeight = dc.GetCharHeight() + 2*OWNER_DRAWN_LISTBOX_EXTRA_SPACE;
// Create the ListView control.
m_hWnd = (WXHWND)CreateWindowEx(exStyle,
WC_LISTVIEW,
- "",
+ _T(""),
wstyle,
x, y, width, height,
(HWND) parent->GetHWND(),
NULL);
if ( !m_hWnd ) {
- wxLogError("Can't create list control window.");
+ wxLogError(_T("Can't create list control window."));
return FALSE;
}
WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ;
HWND hWndListControl = CreateWindowEx(exStyle,
WC_LISTVIEW,
- "",
+ _T(""),
style,
x, y, width, height,
(HWND) GetParent()->GetHWND(),
if ( item.m_mask & wxLIST_MASK_TEXT )
{
lvCol.mask |= LVCF_TEXT;
- lvCol.pszText = new char[513];
+ lvCol.pszText = new wxChar[513];
lvCol.cchTextMax = 512;
}
if ( info.m_mask & wxLIST_MASK_TEXT )
{
lvItem.mask |= LVIF_TEXT;
- lvItem.pszText = new char[513];
+ lvItem.pszText = new wxChar[513];
lvItem.cchTextMax = 512;
}
else
}
else
{
- wxLogDebug("Failed to insert the column '%s' into listview!",
+ wxLogDebug(_T("Failed to insert the column '%s' into listview!"),
lvCol.pszText);
}
if ( !event.m_item.m_text.IsNull() )
{
info->item.pszText = AddPool(event.m_item.m_text);
- info->item.cchTextMax = strlen(info->item.pszText) + 1;
+ info->item.cchTextMax = wxStrlen(info->item.pszText) + 1;
}
}
// wxConvertToMSWListItem(this, event.m_item, info->item);
return TRUE;
}
-char *wxListCtrl::AddPool(const wxString& str)
+wxChar *wxListCtrl::AddPool(const wxString& str)
{
// Remove the first element if 3 strings exist
if ( m_stringPool.Number() == 3 )
delete[] (char *)node->Data();
delete node;
}
- wxNode *node = m_stringPool.Add((char *) (const char *)str);
- return (char *)node->Data();
+ wxNode *node = m_stringPool.Add(WXSTRINGCAST str);
+ return (wxChar *)node->Data();
}
// List item structure
if ( needText )
{
- lvItem.pszText = new char[513];
+ lvItem.pszText = new wxChar[513];
lvItem.cchTextMax = 512;
}
// lvItem.mask |= TVIF_HANDLE | TVIF_STATE | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM ;
}
else
{
- lvItem.pszText = (char *) (const char *)info.m_text ;
+ lvItem.pszText = WXSTRINGCAST info.m_text ;
if ( lvItem.pszText )
lvItem.cchTextMax = info.m_text.Length();
else
extern wxWindowList wxModelessWindows; // from dialog.cpp
extern wxMenu *wxCurrentPopupMenu;
-extern char wxMDIFrameClassName[];
-extern char wxMDIChildFrameClassName[];
+extern wxChar wxMDIFrameClassName[];
+extern wxChar wxMDIChildFrameClassName[];
extern wxWindow *wxWndHook; // from window.cpp
extern wxList *wxWinHandleList;
int width = size.x;
int height = size.y;
- m_windowMenu = (WXHMENU) ::LoadMenu(wxGetInstance(), "wxWindowMenu");
+ m_windowMenu = (WXHMENU) ::LoadMenu(wxGetInstance(), _T("wxWindowMenu"));
DWORD msflags = WS_OVERLAPPED;
if (style & wxMINIMIZE_BOX)
m_hWnd = (WXHWND)::CreateWindowEx
(
exStyle,
- "MDICLIENT",
+ _T("MDICLIENT"),
NULL,
msStyle,
0, 0, 0, 0,
// update menu bar of the parent window
wxWindow *parent = win->GetParent();
- wxCHECK_RET( parent, "MDI client without parent frame? weird..." );
+ wxCHECK_RET( parent, _T("MDI client without parent frame? weird...") );
::DrawMenuBar(GetWinHwnd(parent));
}
bool success = FALSE;
for ( int i = 0; i < N; i++ )
{
- char buf[256];
+ wxChar buf[256];
int chars = GetMenuString(hmenu, i, buf, WXSIZEOF(buf), MF_BYPOSITION);
if ( chars == 0 )
{
- wxLogLastError("GetMenuString");
+ wxLogLastError(_T("GetMenuString"));
continue;
}
{
success = TRUE;
::InsertMenu(hmenu, i, MF_BYPOSITION | MF_POPUP | MF_STRING,
- (UINT)subMenu, "&Window");
+ (UINT)subMenu, _T("&Window"));
break;
}
}
// function appends a new item or submenu to the menu
void wxMenu::Append(wxMenuItem *pItem)
{
- wxCHECK_RET( pItem != NULL, "can't append NULL item to the menu" );
+ wxCHECK_RET( pItem != NULL, _T("can't append NULL item to the menu") );
#if wxUSE_ACCEL
// check for accelerators: they are given after '\t'
wxString label = pItem->GetName();
- int posTab = label.Find('\t');
+ int posTab = label.Find(_T('\t'));
if ( posTab != wxNOT_FOUND ) {
// parse the accelerator string
int keyCode = 0;
(current.Len() == 2 ||
(current.Len() == 3 && isdigit(current[2U]))) ) {
int n;
- sscanf(current.c_str() + 1, "%d", &n);
+ wxSscanf(current.c_str() + 1, _T("%d"), &n);
keyCode = VK_F1 + n - 1;
}
id = pItem->GetId();
}
- LPCSTR pData;
+ LPCTSTR pData;
#if wxUSE_OWNER_DRAWN
if ( pItem->IsOwnerDrawn() ) { // want to get {Measure|Draw}Item messages?
// item draws itself, pass pointer to it in data parameter
flags |= MF_OWNERDRAW;
- pData = (LPCSTR)pItem;
+ pData = (LPCTSTR)pItem;
}
else
#endif
if ( !SetMenuItemInfo(GetHMENU(), (unsigned)id, FALSE, &mii) )
{
- wxLogLastError("SetMenuItemInfo");
+ wxLogLastError(_T("SetMenuItemInfo"));
}
}
#endif // __WIN32__
break;
}
- wxCHECK_RET( node, "wxMenu::Delete(): item doesn't exist" );
+ wxCHECK_RET( node, _T("wxMenu::Delete(): item doesn't exist") );
HMENU menu = GetHMENU();
void wxMenu::Enable(int id, bool Flag)
{
wxMenuItem *item = FindItemForId(id);
- wxCHECK_RET( item != NULL, "can't enable non-existing menu item" );
+ wxCHECK_RET( item != NULL, _T("can't enable non-existing menu item") );
item->Enable(Flag);
}
bool wxMenu::IsEnabled(int id) const
{
wxMenuItem *item = FindItemForId(id);
- wxCHECK_MSG( item != NULL, FALSE, "invalid item id" );
+ wxCHECK_MSG( item != NULL, FALSE, _T("invalid item id") );
return item->IsEnabled();
}
void wxMenu::Check(int id, bool Flag)
{
wxMenuItem *item = FindItemForId(id);
- wxCHECK_RET( item != NULL, "can't get status of non-existing menu item" );
+ wxCHECK_RET( item != NULL, _T("can't get status of non-existing menu item") );
item->Check(Flag);
}
bool wxMenu::IsChecked(int id) const
{
wxMenuItem *item = FindItemForId(id);
- wxCHECK_MSG( item != NULL, FALSE, "invalid item id" );
+ wxCHECK_MSG( item != NULL, FALSE, _T("invalid item id") );
return item->IsChecked();
}
void wxMenu::SetLabel(int id, const wxString& label)
{
wxMenuItem *item = FindItemForId(id) ;
- wxCHECK_RET( item, "wxMenu::SetLabel: no such item" );
+ wxCHECK_RET( item, _T("wxMenu::SetLabel: no such item") );
item->SetName(label);
}
if (pItem)
label = pItem->GetName() ;
else
- wxFAIL_MSG("wxMenu::GetLabel: item doesn't exist");
+ wxFAIL_MSG(_T("wxMenu::GetLabel: item doesn't exist"));
return label;
}
if (item)
item->SetHelp(helpString);
else
- wxFAIL_MSG("wxMenu::SetHelpString: item doesn't exist");
+ wxFAIL_MSG(_T("wxMenu::SetHelpString: item doesn't exist"));
}
wxString wxMenu::GetHelpString (int itemId) const
if (item)
help = item->GetHelp();
else
- wxFAIL_MSG("wxMenu::GetHelpString: item doesn't exist");
+ wxFAIL_MSG(_T("wxMenu::GetHelpString: item doesn't exist"));
return help;
}
(unsigned)idMenuTitle, m_title) ||
!InsertMenu(hMenu, 1u, MF_BYPOSITION, (unsigned)-1, NULL) )
{
- wxLogLastError("InsertMenu");
+ wxLogLastError(_T("InsertMenu"));
}
}
}
{
// menu can be in at most one menubar because otherwise they would both
// delete the menu pointer
- wxASSERT_MSG( !m_menuBar, "menu belongs to 2 menubars, expect a crash" );
+ wxASSERT_MSG( !m_menuBar, _T("menu belongs to 2 menubars, expect a crash") );
m_menuBar = menubar;
m_savehMenu = m_hMenu;
void wxMenu::Detach()
{
- wxASSERT_MSG( m_menuBar, "can't detach menu if it's not attached" );
+ wxASSERT_MSG( m_menuBar, _T("can't detach menu if it's not attached") );
m_hMenu = m_savehMenu;
m_savehMenu = 0;
void wxMenuBar::Refresh()
{
- wxCHECK_RET( m_menuBarFrame, "can't refresh a menubar withotu a frame" );
+ wxCHECK_RET( m_menuBarFrame, _T("can't refresh a menubar withotu a frame") );
DrawMenuBar((HWND)m_menuBarFrame->GetHWND()) ;
}
WXHMENU wxMenuBar::Create()
{
- wxCHECK_MSG( !m_hMenu, TRUE, "menubar already created" );
+ wxCHECK_MSG( !m_hMenu, TRUE, _T("menubar already created") );
m_hMenu = (WXHMENU)::CreateMenu();
wxMenu *itemMenu = NULL;
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
- wxCHECK_RET( item, "attempt to enable an item which doesn't exist" );
+ wxCHECK_RET( item, _T("attempt to enable an item which doesn't exist") );
item->Enable(enable);
}
wxMenu *itemMenu = NULL;
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
- wxCHECK_RET( item, "attempt to check an item which doesn't exist" );
- wxCHECK_RET( item->IsCheckable(), "attempt to check an uncheckable item" );
+ wxCHECK_RET( item, _T("attempt to check an item which doesn't exist") );
+ wxCHECK_RET( item->IsCheckable(), _T("attempt to check an uncheckable item") );
item->Check(check);
}
wxMenu *itemMenu = NULL;
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
- wxCHECK_MSG( item, FALSE, "wxMenuBar::IsChecked(): no such item" );
+ wxCHECK_MSG( item, FALSE, _T("wxMenuBar::IsChecked(): no such item") );
int flag = ::GetMenuState(GetHMenuOf(itemMenu), id, MF_BYCOMMAND);
wxMenu *itemMenu = NULL;
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
- wxCHECK_MSG( item, FALSE, "wxMenuBar::IsEnabled(): no such item" );
+ wxCHECK_MSG( item, FALSE, _T("wxMenuBar::IsEnabled(): no such item") );
int flag = ::GetMenuState(GetHMenuOf(itemMenu), id, MF_BYCOMMAND) ;
wxMenu *itemMenu = NULL;
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
- wxCHECK_RET( item, "wxMenuBar::SetLabel(): no such item" );
+ wxCHECK_RET( item, _T("wxMenuBar::SetLabel(): no such item") );
item->SetName(label);
}
wxMenu *itemMenu = NULL;
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
- wxCHECK_MSG( item, "", "wxMenuBar::GetLabel(): no such item" );
+ wxCHECK_MSG( item, _T(""), _T("wxMenuBar::GetLabel(): no such item") );
return item->GetName();
}
wxMenu *itemMenu = NULL;
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
- wxCHECK_RET( item, "wxMenuBar::SetHelpString(): no such item" );
+ wxCHECK_RET( item, _T("wxMenuBar::SetHelpString(): no such item") );
item->SetHelp(helpString);
}
wxMenu *itemMenu = NULL;
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
- wxCHECK_MSG( item, "", "wxMenuBar::GetHelpString(): no such item" );
+ wxCHECK_MSG( item, _T(""), _T("wxMenuBar::GetHelpString(): no such item") );
return item->GetHelp();
}
UINT flagsOld = ::GetMenuState((HMENU)m_hMenu, pos, MF_BYPOSITION);
if ( flagsOld == 0xFFFFFFFF )
{
- wxLogLastError("GetMenuState");
+ wxLogLastError(_T("GetMenuState"));
return;
}
if ( ::RemoveMenu((HMENU)m_hMenu, (UINT)pos, MF_BYPOSITION) )
{
// VZ: I'm not sure about what's going on here, so I leave an assert
- wxASSERT_MSG( m_menus[pos] == a_menu, "what is this parameter for??" );
+ wxASSERT_MSG( m_menus[pos] == a_menu, _T("what is this parameter for??") );
a_menu->Detach();
return FALSE;
}
-bool wxMenuBar::OnAppend(wxMenu *a_menu, const char *title)
+bool wxMenuBar::OnAppend(wxMenu *a_menu, const wxChar *title)
{
WXHMENU submenu = a_menu->GetHMenu();
if ( !submenu )
if ( !::AppendMenu(GetHMENU(), MF_POPUP | MF_STRING,
(UINT)submenu, title) )
{
- wxLogLastError("AppendMenu");
+ wxLogLastError(_T("AppendMenu"));
}
Refresh();
new_menus[i] = m_menus[i];
m_menus[i] = NULL;
new_titles[i] = m_titles[i];
- m_titles[i] = "";
+ m_titles[i] = _T("");
}
if (m_menus)
{
else if ( m_savehMenu != 0 )
return m_savehMenu;
- wxFAIL_MSG("wxMenu without HMENU");
+ wxFAIL_MSG(_T("wxMenu without HMENU"));
return 0;
}
#endif //owner drawn
m_strHelp(strHelp)
{
- wxASSERT_MSG( pParentMenu != NULL, "a menu item should have a parent" );
+ wxASSERT_MSG( pParentMenu != NULL, _T("a menu item should have a parent") );
#if wxUSE_OWNER_DRAWN
// set default menu colors
void wxMenuItem::Check(bool bDoCheck)
{
- wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
+ wxCHECK_RET( IsCheckable(), _T("only checkable items may be checked") );
if ( m_bChecked != bDoCheck ) {
long rc = CheckMenuItem(GetHMenuOf(m_pParentMenu),
flagsOld |= MF_POPUP;
}
- LPCSTR data;
+ LPCTSTR data;
#if wxUSE_OWNER_DRAWN
if ( IsOwnerDrawn() )
{
flagsOld |= MF_OWNERDRAW;
- data = (LPCSTR)this;
+ data = (LPCTSTR)this;
}
else
#endif //owner drawn
MF_BYCOMMAND | flagsOld,
id, data) == 0xFFFFFFFF )
{
- wxLogLastError("ModifyMenu");
+ wxLogLastError(_T("ModifyMenu"));
}
}
}
M_METAFILEDATA->m_windowsMappingMode = wxMM_ANISOTROPIC;
M_METAFILEDATA->m_metafile = 0;
- if (!file.IsNull() && (file.Cmp("") == 0))
+ if (!file.IsNull() && (file.Cmp(_T("")) == 0))
M_METAFILEDATA->m_metafile = (WXHANDLE) GetMetaFile(file);
}
if (!file.IsNull() && wxFileExists(file))
wxRemoveFile(file);
- if (!file.IsNull() && (file != ""))
+ if (!file.IsNull() && (file != _T("")))
m_hDC = (WXHDC) CreateMetaFile(file);
else
m_hDC = (WXHDC) CreateMetaFile(NULL);
m_minY = 10000;
m_maxX = -10000;
m_maxY = -10000;
- if (file != "" && wxFileExists(file)) wxRemoveFile(file);
+ if (file != _T("") && wxFileExists(file)) wxRemoveFile(file);
m_hDC = (WXHDC) CreateMetaFile(file);
m_ok = TRUE;
SIZE sizeRect;
TEXTMETRIC tm;
- GetTextExtentPoint(dc, (char *)(const char *) string, strlen((char *)(const char *) string), &sizeRect);
+ GetTextExtentPoint(dc, WXSTRINGCAST string, wxStrlen(WXSTRINGCAST string), &sizeRect);
GetTextMetrics(dc, &tm);
ReleaseDC(NULL, dc);
p < (WORD *)&pMFHead ->checksum; ++p)
pMFHead ->checksum ^= *p;
- FILE *fd = fopen((char *)(const char *)filename, "rb");
+ FILE *fd = fopen(filename.mb_str(wxConvFile), "rb");
if (!fd) return FALSE;
- char tempFileBuf[256];
- wxGetTempFileName("mf", tempFileBuf);
- FILE *fHandle = fopen(tempFileBuf, "wb");
+ wxChar tempFileBuf[256];
+ wxGetTempFileName(_T("mf"), tempFileBuf);
+ FILE *fHandle = fopen(wxConvFile.cWX2MB(tempFileBuf), "wb");
if (!fHandle)
return FALSE;
fwrite((void *)&header, sizeof(unsigned char), sizeof(mfPLACEABLEHEADER), fHandle);
#define HASCAPTION( hwnd ) (TestWinStyle( hwnd, IBS_VERTCAPTION ) ||\
TestWinStyle( hwnd, IBS_HORZCAPTION ))
-#define SETCAPTIONSIZE(h,i) (UINT)SetProp(h,"ibSize",(HANDLE)i)
-#define GETCAPTIONSIZE(h) (UINT)GetProp(h,"ibSize")
-#define FREECAPTIONSIZE(h) RemoveProp(h,"ibSize")
+#define SETCAPTIONSIZE(h,i) (UINT)SetProp(h,_T("ibSize"),(HANDLE)i)
+#define GETCAPTIONSIZE(h) (UINT)GetProp(h,_T("ibSize"))
+#define FREECAPTIONSIZE(h) RemoveProp(h,_T("ibSize"))
-#define SETMENUWASUPFLAG(h,i) (UINT)SetProp(h,"ibFlag",(HANDLE)i)
-#define GETMENUWASUPFLAG(h) (UINT)GetProp(h,"ibFlag")
-#define FREEMENUWASUPFLAG(h) RemoveProp(h,"ibFlag")
+#define SETMENUWASUPFLAG(h,i) (UINT)SetProp(h,_T("ibFlag"),(HANDLE)i)
+#define GETMENUWASUPFLAG(h) (UINT)GetProp(h,_T("ibFlag"))
+#define FREEMENUWASUPFLAG(h) RemoveProp(h,_T("ibFlag"))
/////////////////////////////////////////////////////////////////////
// Little known fact:
{
// VZ: I don't know what should be here, but the vars must
// be inited!
- wxFAIL_MSG("don't know how to initialize cx, cy");
+ wxFAIL_MSG(_T("don't know how to initialize cx, cy"));
cx = cy = 0;
}
if (fWin31)
{
HFONT hFont ;
- LPSTR lpsz ;
+ LPTSTR lpsz ;
LOGFONT lf ;
TEXTMETRIC tm ;
int cx ;
int cy ;
SIZE Size ;
- lpsz = (char*)GlobalAllocPtr( GHND, ui + 2 );
+ lpsz = (wxChar*)GlobalAllocPtr( GHND, (ui + 2) * sizeof(wxChar) );
if (lpsz)
{
UINT nBkMode ;
{
// Can only rotate true type fonts (well, ok, we could
// try and use "modern").
- strcpy( lf.lfFaceName, "Arial" ) ;
+ wxStrcpy( lf.lfFaceName, _T("Arial") ) ;
lf.lfPitchAndFamily = FF_SWISS | 0x04;
lf.lfEscapement = 900 ;
else
msStyle |= MB_TASKMODAL;
- int msAns = MessageBox(hWnd, (LPCSTR)(const char *)m_message, (LPCSTR)(const char *)m_caption, msStyle);
+ int msAns = MessageBox(hWnd, (LPCTSTR)(const wxChar *)m_message, (LPCTSTR)(const wxChar *)m_caption, msStyle);
int ans = wxOK;
switch (msAns)
{
wxWindow* win = NULL;
- if (str == "BUTTON")
+ if (str == _T("BUTTON"))
{
int style1 = (style & 0xFF);
if ((style1 == BS_3STATE) || (style1 == BS_AUTO3STATE) || (style1 == BS_AUTOCHECKBOX) ||
{
// TODO: how to find the bitmap?
win = new wxBitmapButton;
- wxLogError("Have not yet implemented bitmap button as BS_BITMAP button.");
+ wxLogError(_T("Have not yet implemented bitmap button as BS_BITMAP button."));
}
#endif
else if (style1 == BS_OWNERDRAW)
id);
}
}
- else if (str == "COMBOBOX")
+ else if (str == _T("COMBOBOX"))
{
win = new wxComboBox;
}
// for correct functioning.
// Could have wxWindow::AdoptAttributesFromHWND(WXHWND)
// to be overridden by each control class.
- else if (str == "EDIT")
+ else if (str == _T("EDIT"))
{
win = new wxTextCtrl;
}
- else if (str == "LISTBOX")
+ else if (str == _T("LISTBOX"))
{
win = new wxListBox;
}
- else if (str == "SCROLLBAR")
+ else if (str == _T("SCROLLBAR"))
{
win = new wxScrollBar;
}
#if defined(__WIN95__) && !defined(__TWIN32__)
- else if (str == "MSCTLS_UPDOWN32")
+ else if (str == _T("MSCTLS_UPDOWN32"))
{
win = new wxSpinButton;
}
#endif
- else if (str == "MSCTLS_TRACKBAR32")
+ else if (str == _T("MSCTLS_TRACKBAR32"))
{
// Need to ascertain if it's horiz or vert
win = new wxSlider;
}
- else if (str == "STATIC")
+ else if (str == _T("STATIC"))
{
int style1 = (style & 0xFF);
win = new wxStaticBitmap;
// Help! this doesn't correspond with the wxWin implementation.
- wxLogError("Please make SS_BITMAP statics into owner-draw buttons.");
+ wxLogError(_T("Please make SS_BITMAP statics into owner-draw buttons."));
}
#endif
}
else
{
- wxString msg("Don't know how to convert from Windows class ");
+ wxString msg(_T("Don't know how to convert from Windows class "));
msg += str;
wxLogError(msg);
}
int wxNotebook::SetSelection(int nPage)
{
- wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, "notebook page out of range" );
+ wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, _T("notebook page out of range") );
ChangePage(m_nSelection, nPage);
bool wxNotebook::SetPageText(int nPage, const wxString& strText)
{
- wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, "notebook page out of range" );
+ wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("notebook page out of range") );
TC_ITEM tcItem;
tcItem.mask = TCIF_TEXT;
- tcItem.pszText = (char *)strText.c_str();
+ tcItem.pszText = (wxChar *)strText.c_str();
return TabCtrl_SetItem(m_hwnd, nPage, &tcItem) != 0;
}
wxString wxNotebook::GetPageText(int nPage) const
{
- wxCHECK_MSG( IS_VALID_PAGE(nPage), "", "notebook page out of range" );
+ wxCHECK_MSG( IS_VALID_PAGE(nPage), _T(""), _T("notebook page out of range") );
- char buf[256];
+ wxChar buf[256];
TC_ITEM tcItem;
tcItem.mask = TCIF_TEXT;
tcItem.pszText = buf;
int wxNotebook::GetPageImage(int nPage) const
{
- wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, "notebook page out of range" );
+ wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, _T("notebook page out of range") );
TC_ITEM tcItem;
tcItem.mask = TCIF_IMAGE;
bool wxNotebook::SetPageImage(int nPage, int nImage)
{
- wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, "notebook page out of range" );
+ wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("notebook page out of range") );
TC_ITEM tcItem;
tcItem.mask = TCIF_IMAGE;
// remove one page from the notebook
bool wxNotebook::DeletePage(int nPage)
{
- wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, "notebook page out of range" );
+ wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("notebook page out of range") );
TabCtrl_DeleteItem(m_hwnd, nPage);
// remove one page from the notebook, without deleting
bool wxNotebook::RemovePage(int nPage)
{
- wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, "notebook page out of range" );
+ wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("notebook page out of range") );
TabCtrl_DeleteItem(m_hwnd, nPage);
if (!strText.IsEmpty())
{
tcItem.mask |= TCIF_TEXT;
- tcItem.pszText = (char *)strText.c_str();
+ tcItem.pszText = (wxChar *)strText.c_str();
}
else
- tcItem.pszText = (char *) NULL;
+ tcItem.pszText = (wxChar *) NULL;
if ( TabCtrl_InsertItem(m_hwnd, nPage, &tcItem) == -1 ) {
- wxLogError("Can't create the notebook page '%s'.", strText.c_str());
+ wxLogError(_T("Can't create the notebook page '%s'."), strText.c_str());
return FALSE;
}
dc.SetFont(GetFont());
// ## ugly...
- char *szStripped = new char[m_strName.Len()];
- wxStripMenuCodes((char *)m_strName.c_str(), szStripped);
+ wxChar *szStripped = new wxChar[m_strName.Len()];
+ wxStripMenuCodes((wxChar *)m_strName.c_str(), szStripped);
wxString str = szStripped;
delete [] szStripped;
// # without this menu items look too tightly packed (at least under Windows)
- str += 'W'; // 'W' is typically the widest letter
+ str += _T('W'); // 'W' is typically the widest letter
dc.GetTextExtent(str, (long *)pwidth, (long *)pheight);
m_nHeight = *pheight; // remember height for use in OnDrawItem
HFONT hPrevFont = (HFONT) ::SelectObject(hdc, hfont);
DrawState(hdc, NULL, NULL,
- (LPARAM)(const char *)m_strName, m_strName.Length(),
+ (LPARAM)(const wxChar *)m_strName, m_strName.Length(),
x, rc.y, rc.GetWidth(), rc.GetHeight(),
DST_PREFIXTEXT | ( st & wxODDisabled ? DSS_DISABLED : 0) );
imageOK = FALSE;
}
-wxPNGReader::wxPNGReader ( char* ImageFileName )
+wxPNGReader::wxPNGReader ( wxChar* ImageFileName )
{
imageOK = FALSE;
filetype = 0;
return mask;
}
-bool wxPNGReader::ReadFile(char * ImageFileName)
+bool wxPNGReader::ReadFile(wxChar * ImageFileName)
{
int number_passes;
if (ImageFileName)
- strcpy(filename, ImageFileName);
+ wxStrcpy(filename, ImageFileName);
FILE *fp;
png_struct *png_ptr;
wxPNGReaderIter iter(this);
/* open the file */
- fp = fopen(filename, "rb");
+ fp = fopen(wxConvFile.cWX2MB(filename), "rb");
if (!fp)
return FALSE;
/* write a png file */
-bool wxPNGReader::SaveFile(char * ImageFileName)
+bool wxPNGReader::SaveFile(wxChar * ImageFileName)
{
if (ImageFileName)
- strcpy(filename, ImageFileName);
+ wxStrcpy(filename, ImageFileName);
wxPNGReaderIter iter(this);
FILE *fp;
png_info *info_ptr;
/* open the file */
- fp = fopen(filename, "wb");
+ fp = fopen(wxConvFile.cWX2MB(filename), "wb");
if (!fp)
return FALSE;
}
-bool wxPNGReader::SaveXPM(char *filename, char *name)
+bool wxPNGReader::SaveXPM(wxChar *filename, wxChar *name)
{
- char nameStr[256];
+ wxChar nameStr[256];
if ( name )
- strcpy(nameStr, name);
+ wxStrcpy(nameStr, name);
else
{
- strcpy(nameStr, filename);
+ wxStrcpy(nameStr, filename);
wxStripExtension(nameStr);
}
if ( !GetPalette() )
return FALSE;
- ofstream str(filename);
+ ofstream str(wxConvFile.cWX2MB(filename));
if ( str.bad() )
return FALSE;
int desiredWidth, int desiredHeight)
{
wxPNGReader reader;
- if (reader.ReadFile((char*) (const char*) name))
+ if (reader.ReadFile(WXSTRINGCAST name))
{
return reader.InstantiateBitmap(bitmap);
}
if (!win)
{
wxEndBusyCursor();
- wxLogDebug("Could not create an abort dialog.");
+ wxLogDebug(_T("Could not create an abort dialog."));
delete dc;
}
}
}
- wxASSERT_MSG( selectedButton != -1, "click from alien button?" );
+ wxASSERT_MSG( selectedButton != -1, _T("click from alien button?") );
if ( selectedButton != m_selectedButton )
{
}
// Create a dummy radio control to end the group.
- (void)CreateWindowEx(0, RADIO_CLASS, "", WS_GROUP | RADIO_FLAGS,
+ (void)CreateWindowEx(0, RADIO_CLASS, _T(""), WS_GROUP | RADIO_FLAGS,
0, 0, 0, 0, hwndParent,
(HMENU)NewControlId(), wxGetInstance(), NULL);
wxString wxRadioBox::GetLabel(int item) const
{
- wxCHECK_MSG( item >= 0 && item < m_noItems, "", "invalid radiobox index" );
+ wxCHECK_MSG( item >= 0 && item < m_noItems, _T(""), _T("invalid radiobox index") );
return wxGetWindowText(m_radioButtons[item]);
}
void wxRadioBox::SetLabel(int item, const wxString& label)
{
- wxCHECK_RET( item >= 0 && item < m_noItems, "invalid radiobox index" );
+ wxCHECK_RET( item >= 0 && item < m_noItems, _T("invalid radiobox index") );
m_radioWidth[item] = m_radioHeight[item] = -1;
SetWindowText((HWND)m_radioButtons[item], label.c_str());
m_radioWidth[item] = bitmap->GetWidth() + FB_MARGIN;
m_radioHeight[item] = bitmap->GetHeight() + FB_MARGIN;
*/
- wxFAIL_MSG("not implemented");
+ wxFAIL_MSG(_T("not implemented"));
}
int wxRadioBox::FindString(const wxString& s) const
void wxRadioBox::SetSelection(int N)
{
- wxCHECK_RET( (N >= 0) && (N < m_noItems), "invalid radiobox index" );
+ wxCHECK_RET( (N >= 0) && (N < m_noItems), _T("invalid radiobox index") );
// Following necessary for Win32s, because Win32s translate BM_SETCHECK
if (m_selectedButton >= 0 && m_selectedButton < m_noItems)
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
yy = currentY;
- char buf[400];
+ wxChar buf[400];
int y_offset = yy;
int x_offset = xx;
{
wxRadioBox *radiobox = (wxRadioBox *)::GetWindowLong(hwnd, GWL_USERDATA);
- wxCHECK_MSG( radiobox, 0, "radio button without radio box?" );
+ wxCHECK_MSG( radiobox, 0, _T("radio button without radio box?") );
int sel = radiobox->GetSelection();
msStyle |= WS_BORDER;
*/
- m_hWnd = (WXHWND) CreateWindowEx(exStyle, RADIO_CLASS, (const char *)label,
+ m_hWnd = (WXHWND) CreateWindowEx(exStyle, RADIO_CLASS, (const wxChar *)label,
msStyle,0,0,0,0,
(HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL);
- wxCHECK_MSG( m_hWnd, FALSE, "Failed to create radiobutton" );
+ wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create radiobutton") );
#if wxUSE_CTL3D
if (want3D)
// SetValue(value);
// start GRW fix
- if (label != "")
+ if (label != _T(""))
{
int label_width, label_height;
GetTextExtent(label, &label_width, &label_height, NULL, NULL, & this->GetFont());
void wxRadioButton::SetLabel(const wxString& label)
{
- SetWindowText((HWND) GetHWND(), (const char *)label);
+ SetWindowText((HWND) GetHWND(), (const wxChar *)label);
}
void wxRadioButton::SetValue(bool value)
if ( appName.IsEmpty() )
{
- wxCHECK_RET( wxTheApp, "No application name in wxRegConfig ctor!" );
+ wxCHECK_RET( wxTheApp, _T("No application name in wxRegConfig ctor!") );
strRoot << wxTheApp->GetAppName();
}
else
if ( IsImmutable(path.Name()) ) {
if ( TryGetValue(m_keyGlobal, path.Name(), *pStr) ) {
if ( m_keyLocal.HasValue(path.Name()) ) {
- wxLogWarning("User value for immutable key '%s' ignored.",
+ wxLogWarning(_T("User value for immutable key '%s' ignored."),
path.Name().c_str());
}
*pStr = wxConfigBase::ExpandEnvVars(*pStr);
if ( IsImmutable(path.Name()) ) {
if ( TryGetValue(m_keyGlobal, path.Name(), *pStr) ) {
if ( m_keyLocal.HasValue(path.Name()) ) {
- wxLogWarning("User value for immutable key '%s' ignored.",
+ wxLogWarning(_T("User value for immutable key '%s' ignored."),
path.Name().c_str());
}
if ( IsImmutable(path.Name()) ) {
if ( TryGetValue(m_keyGlobal, path.Name(), plResult) ) {
if ( m_keyLocal.HasValue(path.Name()) ) {
- wxLogWarning("User value for immutable key '%s' ignored.",
+ wxLogWarning(_T("User value for immutable key '%s' ignored."),
path.Name().c_str());
}
wxConfigPathChanger path(this, key);
if ( IsImmutable(path.Name()) ) {
- wxLogError("Can't change immutable entry '%s'.", path.Name().c_str());
+ wxLogError(_T("Can't change immutable entry '%s'."), path.Name().c_str());
return FALSE;
}
wxConfigPathChanger path(this, key);
if ( IsImmutable(path.Name()) ) {
- wxLogError("Can't change immutable entry '%s'.", path.Name().c_str());
+ wxLogError(_T("Can't change immutable entry '%s'."), path.Name().c_str());
return FALSE;
}
// TODO there is no way to rename a registry key - we must do a deep copy
// ourselves
- wxFAIL_MSG("Registry key renaming not implemented");
+ wxFAIL_MSG(_T("Registry key renaming not implemented"));
return FALSE;
}
static struct
{
HKEY hkey;
- const char *szName;
- const char *szShortName;
+ const wxChar *szName;
+ const wxChar *szShortName;
}
aStdKeys[] =
{
- { HKEY_CLASSES_ROOT, "HKEY_CLASSES_ROOT", "HKCR" },
+ { HKEY_CLASSES_ROOT, _T("HKEY_CLASSES_ROOT"), _T("HKCR") },
#ifdef __WIN32__
- { HKEY_CURRENT_USER, "HKEY_CURRENT_USER", "HKCU" },
- { HKEY_LOCAL_MACHINE, "HKEY_LOCAL_MACHINE", "HKLM" },
- { HKEY_USERS, "HKEY_USERS", "HKU" }, // short name?
- { HKEY_PERFORMANCE_DATA, "HKEY_PERFORMANCE_DATA", "HKPD" },
+ { HKEY_CURRENT_USER, _T("HKEY_CURRENT_USER"), _T("HKCU") },
+ { HKEY_LOCAL_MACHINE, _T("HKEY_LOCAL_MACHINE"), _T("HKLM") },
+ { HKEY_USERS, _T("HKEY_USERS"), _T("HKU") }, // short name?
+ { HKEY_PERFORMANCE_DATA, _T("HKEY_PERFORMANCE_DATA"), _T("HKPD") },
#if WINVER >= 0x0400
- { HKEY_CURRENT_CONFIG, "HKEY_CURRENT_CONFIG", "HKCC" },
+ { HKEY_CURRENT_CONFIG, _T("HKEY_CURRENT_CONFIG"), _T("HKCC") },
#ifndef __GNUWIN32__
- { HKEY_DYN_DATA, "HKEY_DYN_DATA", "HKDD" }, // short name?
+ { HKEY_DYN_DATA, _T("HKEY_DYN_DATA"), _T("HKDD") }, // short name?
#endif //GNUWIN32
#endif //WINVER >= 4.0
#endif //WIN32
};
// the registry name separator (perhaps one day MS will change it to '/' ;-)
-#define REG_SEPARATOR '\\'
+#define REG_SEPARATOR _T('\\')
// useful for Windows programmers: makes somewhat more clear all these zeroes
// being passed to Windows APIs
static inline void RemoveTrailingSeparator(wxString& str);
// returns TRUE if given registry key exists
-static bool KeyExists(WXHKEY hRootKey, const char *szKey);
+static bool KeyExists(WXHKEY hRootKey, const wxChar *szKey);
// combines value and key name (uses static buffer!)
-static const char *GetFullName(const wxRegKey *pKey,
- const char *szValue = NULL);
+static const wxChar *GetFullName(const wxRegKey *pKey,
+ const wxChar *szValue = NULL);
// ============================================================================
// implementation of wxRegKey class
// @@ should take a `StdKey key', but as it's often going to be used in loops
// it would require casts in user code.
-const char *wxRegKey::GetStdKeyName(size_t key)
+const wxChar *wxRegKey::GetStdKeyName(size_t key)
{
// return empty string if key is invalid
- wxCHECK_MSG( key < nStdKeys, "", "invalid key in wxRegKey::GetStdKeyName" );
+ wxCHECK_MSG( key < nStdKeys, _T(""), _T("invalid key in wxRegKey::GetStdKeyName") );
return aStdKeys[key].szName;
}
-const char *wxRegKey::GetStdKeyShortName(size_t key)
+const wxChar *wxRegKey::GetStdKeyShortName(size_t key)
{
// return empty string if key is invalid
- wxCHECK( key < nStdKeys, "" );
+ wxCHECK( key < nStdKeys, _T("") );
return aStdKeys[key].szShortName;
}
}
if ( ui == nStdKeys ) {
- wxFAIL_MSG("invalid key prefix in wxRegKey::ExtractKeyName.");
+ wxFAIL_MSG(_T("invalid key prefix in wxRegKey::ExtractKeyName."));
hRootKey = HKEY_CLASSES_ROOT;
}
return (StdKey)ui;
}
- wxFAIL_MSG("non root hkey passed to wxRegKey::GetStdKeyFromHkey.");
+ wxFAIL_MSG(_T("non root hkey passed to wxRegKey::GetStdKeyFromHkey."));
return HKCR;
}
return TRUE;
}
-bool wxRegKey::DeleteKey(const char *szKey)
+bool wxRegKey::DeleteKey(const wxChar *szKey)
{
if ( !Open() )
return FALSE;
return key.DeleteSelf();
}
-bool wxRegKey::DeleteValue(const char *szValue)
+bool wxRegKey::DeleteValue(const wxChar *szValue)
{
if ( !Open() )
return FALSE;
#if defined(__WIN32__) && !defined(__TWIN32__)
- m_dwLastError = RegDeleteValue((HKEY) m_hKey, (char*) (const char*) szValue);
+ m_dwLastError = RegDeleteValue((HKEY) m_hKey, WXSTRINGCAST szValue);
if ( m_dwLastError != ERROR_SUCCESS ) {
wxLogSysError(m_dwLastError, _("can't delete value '%s' from key '%s'"),
szValue, GetName().c_str());
// ----------------------------------------------------------------------------
// return TRUE if value exists
-bool wxRegKey::HasValue(const char *szValue) const
+bool wxRegKey::HasValue(const wxChar *szValue) const
{
// this function should be silent, so suppress possible messages from Open()
wxLogNull nolog;
#ifdef __WIN32__
if ( CONST_CAST Open() ) {
- return RegQueryValueEx((HKEY) m_hKey, (char*) (const char*) szValue, RESERVED,
+ return RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED,
NULL, NULL, NULL) == ERROR_SUCCESS;
}
else
}
// returns TRUE if given subkey exists
-bool wxRegKey::HasSubKey(const char *szKey) const
+bool wxRegKey::HasSubKey(const wxChar *szKey) const
{
// this function should be silent, so suppress possible messages from Open()
wxLogNull nolog;
return FALSE;
}
-wxRegKey::ValueType wxRegKey::GetValueType(const char *szValue) const
+wxRegKey::ValueType wxRegKey::GetValueType(const wxChar *szValue) const
{
#ifdef __WIN32__
if ( ! CONST_CAST Open() )
return Type_None;
DWORD dwType;
- m_dwLastError = RegQueryValueEx((HKEY) m_hKey, (char*) (const char*) szValue, RESERVED,
+ m_dwLastError = RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED,
&dwType, NULL, NULL);
if ( m_dwLastError != ERROR_SUCCESS ) {
wxLogSysError(m_dwLastError, _("can't read value of key '%s'"),
}
#ifdef __WIN32__
-bool wxRegKey::SetValue(const char *szValue, long lValue)
+bool wxRegKey::SetValue(const wxChar *szValue, long lValue)
{
#ifdef __TWIN32__
wxFAIL_MSG("RegSetValueEx not implemented by TWIN32");
#endif
}
-bool wxRegKey::QueryValue(const char *szValue, long *plValue) const
+bool wxRegKey::QueryValue(const wxChar *szValue, long *plValue) const
{
if ( CONST_CAST Open() ) {
DWORD dwType, dwSize = sizeof(DWORD);
RegString pBuf = (RegString)plValue;
- m_dwLastError = RegQueryValueEx((HKEY) m_hKey, (char*) (const char*) szValue, RESERVED,
+ m_dwLastError = RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED,
&dwType, pBuf, &dwSize);
if ( m_dwLastError != ERROR_SUCCESS ) {
wxLogSysError(m_dwLastError, _("can't read value of key '%s'"),
else {
// check that we read the value of right type
wxASSERT_MSG( dwType == REG_DWORD,
- "Type mismatch in wxRegKey::QueryValue()." );
+ _T("Type mismatch in wxRegKey::QueryValue().") );
return TRUE;
}
#endif //Win32
-bool wxRegKey::QueryValue(const char *szValue, wxString& strValue) const
+bool wxRegKey::QueryValue(const wxChar *szValue, wxString& strValue) const
{
if ( CONST_CAST Open() ) {
#ifdef __WIN32__
// first get the type and size of the data
DWORD dwType, dwSize;
- m_dwLastError = RegQueryValueEx((HKEY) m_hKey, (char*) (const char*) szValue, RESERVED,
+ m_dwLastError = RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED,
&dwType, NULL, &dwSize);
if ( m_dwLastError == ERROR_SUCCESS ) {
RegString pBuf = (RegString)strValue.GetWriteBuf(dwSize);
- m_dwLastError = RegQueryValueEx((HKEY) m_hKey, (char*) (const char*) szValue, RESERVED,
+ m_dwLastError = RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED,
&dwType, pBuf, &dwSize);
strValue.UngetWriteBuf();
if ( m_dwLastError == ERROR_SUCCESS ) {
// check that it was the right type
wxASSERT_MSG( dwType == REG_SZ,
- "Type mismatch in wxRegKey::QueryValue()." );
+ _T("Type mismatch in wxRegKey::QueryValue().") );
return TRUE;
}
return FALSE;
}
-bool wxRegKey::SetValue(const char *szValue, const wxString& strValue)
+bool wxRegKey::SetValue(const wxChar *szValue, const wxString& strValue)
{
if ( CONST_CAST Open() ) {
#if defined( __WIN32__) && !defined(__TWIN32__)
return FALSE;
#if defined( __WIN32__) && !defined(__TWIN32__)
- char szValueName[1024]; // @@ use RegQueryInfoKey...
+ wxChar szValueName[1024]; // @@ use RegQueryInfoKey...
DWORD dwValueLen = WXSIZEOF(szValueName);
lIndex++;
if ( lIndex == -1 )
return FALSE;
- char szKeyName[_MAX_PATH + 1];
+ wxChar szKeyName[_MAX_PATH + 1];
m_dwLastError = RegEnumKey((HKEY) m_hKey, lIndex++, szKeyName, WXSIZEOF(szKeyName));
if ( m_dwLastError != ERROR_SUCCESS ) {
}
// returns TRUE if the value contains a number (else it's some string)
-bool wxRegKey::IsNumericValue(const char *szValue) const
+bool wxRegKey::IsNumericValue(const wxChar *szValue) const
{
ValueType type = GetValueType(szValue);
switch ( type ) {
// ============================================================================
// implementation of global private functions
// ============================================================================
-bool KeyExists(WXHKEY hRootKey, const char *szKey)
+bool KeyExists(WXHKEY hRootKey, const wxChar *szKey)
{
HKEY hkeyDummy;
if ( RegOpenKey( (HKEY) hRootKey, szKey, &hkeyDummy) == ERROR_SUCCESS ) {
return FALSE;
}
-const char *GetFullName(const wxRegKey *pKey, const char *szValue)
+const wxChar *GetFullName(const wxRegKey *pKey, const wxChar *szValue)
{
static wxString s_str;
s_str = pKey->GetName();
- if ( !IsEmpty(szValue) )
- s_str << "\\" << szValue;
+ if ( !wxIsEmpty(szValue) )
+ s_str << _T("\\") << szValue;
return s_str.c_str();
}
// Now create scrollbar
DWORD _direction = (style & wxHORIZONTAL) ?
SBS_HORZ: SBS_VERT;
- HWND scroll_bar = CreateWindowEx(MakeExtendedStyle(style), "SCROLLBAR", "scrollbar",
+ HWND scroll_bar = CreateWindowEx(MakeExtendedStyle(style), _T("SCROLLBAR"), _T("scrollbar"),
_direction | WS_CHILD | WS_VISIBLE,
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
wxGetInstance(), NULL);
bool want3D;
WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ;
- m_staticValue = (WXHWND) CreateWindowEx(exStyle, "STATIC", NULL,
+ m_staticValue = (WXHWND) CreateWindowEx(exStyle, _T("STATIC"), NULL,
msStyle,
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
wxGetInstance(), NULL);
// Now create min static control
- sprintf(wxBuffer, "%d", minValue);
- m_staticMin = (WXHWND) CreateWindowEx(0, "STATIC", wxBuffer,
+ wxSprintf(wxBuffer, _T("%d"), minValue);
+ m_staticMin = (WXHWND) CreateWindowEx(0, _T("STATIC"), wxBuffer,
STATIC_FLAGS,
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
wxGetInstance(), NULL);
SubclassWin(GetHWND());
- SetWindowText((HWND) m_hWnd, "");
+ SetWindowText((HWND) m_hWnd, _T(""));
SetFont(parent->GetFont());
if ( m_windowStyle & wxSL_LABELS )
{
// Finally, create max value static item
- sprintf(wxBuffer, "%d", maxValue);
- m_staticMax = (WXHWND) CreateWindowEx(0, "STATIC", wxBuffer,
+ wxSprintf(wxBuffer, _T("%d"), maxValue);
+ m_staticMax = (WXHWND) CreateWindowEx(0, _T("STATIC"), wxBuffer,
STATIC_FLAGS,
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
wxGetInstance(), NULL);
::SendMessage((HWND) GetHWND(), TBM_SETPOS, (WPARAM)TRUE, (LPARAM)value);
if (m_staticValue)
{
- sprintf(wxBuffer, "%d", value);
+ wxSprintf(wxBuffer, _T("%d"), value);
SetWindowText((HWND) m_staticValue, wxBuffer);
}
}
AdjustForParentClientOrigin(x1, y1, sizeFlags);
- char buf[300];
+ wxChar buf[300];
int x_offset = x;
int y_offset = y;
::SendMessage((HWND) GetHWND(), TBM_SETRANGE, TRUE, MAKELONG(minValue, maxValue));
- char buf[40];
+ wxChar buf[40];
if ( m_staticMin )
{
- sprintf(buf, "%d", m_rangeMin);
+ wxSprintf(buf, _T("%d"), m_rangeMin);
SetWindowText((HWND) m_staticMin, buf);
}
if ( m_staticMax )
{
- sprintf(buf, "%d", m_rangeMax);
+ wxSprintf(buf, _T("%d"), m_rangeMax);
SetWindowText((HWND) m_staticMax, buf);
}
}
bool want3D;
WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ;
- m_staticValue = (WXHWND) CreateWindowEx(exStyle, "STATIC", NULL,
+ m_staticValue = (WXHWND) CreateWindowEx(exStyle, _T("STATIC"), NULL,
msStyle,
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
wxGetInstance(), NULL);
// Now create min static control
- sprintf(wxBuffer, "%d", minValue);
- m_staticMin = (WXHWND) CreateWindowEx(0, "STATIC", wxBuffer,
+ wxSprintf(wxBuffer, _T("%d"), minValue);
+ m_staticMin = (WXHWND) CreateWindowEx(0, _T("STATIC"), wxBuffer,
STATIC_FLAGS,
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
wxGetInstance(), NULL);
else
msStyle = SBS_HORZ | WS_CHILD | WS_VISIBLE | WS_TABSTOP ;
- HWND scroll_bar = CreateWindowEx(MakeExtendedStyle(m_windowStyle), "SCROLLBAR", wxBuffer,
+ HWND scroll_bar = CreateWindowEx(MakeExtendedStyle(m_windowStyle), _T("SCROLLBAR"), wxBuffer,
msStyle,
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
wxGetInstance(), NULL);
SubclassWin(GetHWND());
// Finally, create max value static item
- sprintf(wxBuffer, "%d", maxValue);
- m_staticMax = (WXHWND) CreateWindowEx(0, "STATIC", wxBuffer,
+ wxSprintf(wxBuffer, _T("%d"), maxValue);
+ m_staticMax = (WXHWND) CreateWindowEx(0, _T("STATIC"), wxBuffer,
STATIC_FLAGS,
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
wxGetInstance(), NULL);
::SetScrollPos((HWND) GetHWND(), SB_CTL, value, TRUE);
if (m_staticValue)
{
- sprintf(wxBuffer, "%d", value);
+ wxSprintf(wxBuffer, _T("%d"), value);
SetWindowText((HWND) m_staticValue, wxBuffer);
}
}
AdjustForParentClientOrigin(x1, y1, sizeFlags);
- char buf[300];
+ wxChar buf[300];
int x_offset = x;
int y_offset = y;
m_rangeMax = maxValue;
::SetScrollRange((HWND) GetHWND(), SB_CTL, m_rangeMin, m_rangeMax, TRUE);
- char buf[40];
+ wxChar buf[40];
if ( m_staticMin )
{
- sprintf(buf, "%d", m_rangeMin);
+ wxSprintf(buf, _T("%d"), m_rangeMin);
SetWindowText((HWND) m_staticMin, buf);
}
if ( m_staticMax )
{
- sprintf(buf, "%d", m_rangeMax);
+ wxSprintf(buf, _T("%d"), m_rangeMax);
SetWindowText((HWND) m_staticMax, buf);
}
}
#ifdef __WIN32__
// create a static control with either SS_BITMAP or SS_ICON style depending
// on what we have here
- const char *classname = "STATIC";
+ const wxChar *classname = _T("STATIC");
int winstyle = m_isIcon ? SS_ICON : SS_BITMAP;
#else // Win16
- const char *classname = "BUTTON";
+ const wxChar *classname = _T("BUTTON");
int winstyle = BS_OWNERDRAW;
#endif // Win32
m_hWnd = (WXHWND)::CreateWindow
(
classname,
- "",
+ _T(""),
winstyle | WS_CHILD | WS_VISIBLE,
0, 0, 0, 0,
(HWND)parent->GetHWND(),
NULL
);
- wxCHECK_MSG( m_hWnd, FALSE, "Failed to create static bitmap" );
+ wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create static bitmap") );
SetBitmap(bitmap);
WXDWORD exStyle = Determine3DEffects(0, &want3D) ;
HWND wx_button =
- CreateWindowEx(exStyle, "BUTTON", (const char *)label, msStyle,
+ CreateWindowEx(exStyle, _T("BUTTON"), (const wxChar *)label, msStyle,
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
wxGetInstance(), NULL);
#if wxUSE_CTL3D
void wxStaticBox::SetLabel(const wxString& label)
{
- SetWindowText((HWND)m_hWnd, (const char *)label);
+ SetWindowText((HWND)m_hWnd, (const wxChar *)label);
}
void wxStaticBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
// windowsx.h and commctrl.h don't define those, so we do it here
#define StatusBar_SetParts(h, n, w) SendMessage(h, SB_SETPARTS, (WPARAM)n, (LPARAM)w)
-#define StatusBar_SetText(h, n, t) SendMessage(h, SB_SETTEXT, (WPARAM)n, (LPARAM)(LPCSTR)t)
+#define StatusBar_SetText(h, n, t) SendMessage(h, SB_SETTEXT, (WPARAM)n, (LPARAM)(LPCTSTR)t)
#define StatusBar_GetTextLen(h, n) LOWORD(SendMessage(h, SB_GETTEXTLENGTH, (WPARAM)n, 0))
-#define StatusBar_GetText(h, n, s) LOWORD(SendMessage(h, SB_GETTEXT, (WPARAM)n, (LPARAM)(LPSTR)s))
+#define StatusBar_GetText(h, n, s) LOWORD(SendMessage(h, SB_GETTEXT, (WPARAM)n, (LPARAM)(LPTSTR)s))
#define hwnd ((HWND)m_hWnd)
wstyle |= SBARS_SIZEGRIP;
m_hWnd = (WXHWND)CreateStatusWindow(wstyle,
- "",
+ _T(""),
(HWND)parent->GetHWND(),
m_windowId);
if ( m_hWnd == 0 ) {
- wxLogSysError("can't create status bar window");
+ wxLogSysError(_T("can't create status bar window"));
return FALSE;
}
}
if ( !StatusBar_SetParts(hwnd, m_nFields, pWidths) ) {
- wxLogDebug("StatusBar_SetParts failed.");
+ wxLogDebug(_T("StatusBar_SetParts failed."));
}
delete [] pWidths;
void wxStatusBar95::SetStatusText(const wxString& strText, int nField)
{
if ( !StatusBar_SetText(hwnd, nField, strText) ) {
- wxLogDebug("StatusBar_SetText failed");
+ wxLogDebug(_T("StatusBar_SetText failed"));
}
}
{
wxASSERT( (nField > -1) && (nField < m_nFields) );
- wxString str("");
+ wxString str(_T(""));
int len = StatusBar_GetTextLen(hwnd, nField);
if (len > 0)
{
if ( wxStyleHasBorder(m_windowStyle) )
msStyle |= WS_BORDER;
- m_hWnd = (WXHWND)::CreateWindowEx(MakeExtendedStyle(m_windowStyle), "STATIC", (const char *)label,
+ m_hWnd = (WXHWND)::CreateWindowEx(MakeExtendedStyle(m_windowStyle), _T("STATIC"), (const wxChar *)label,
msStyle,
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
wxGetInstance(), NULL);
- wxCHECK_MSG( m_hWnd, FALSE, "Failed to create static ctrl" );
+ wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create static ctrl") );
#if wxUSE_CTL3D
/*
int w, h;
GetTextExtent(label, &w, &h, NULL, NULL, & GetFont());
MoveWindow((HWND) GetHWND(), point.x, point.y, (int)(w + 10), (int)h, TRUE);
- SetWindowText((HWND) GetHWND(), (const char *)label);
+ SetWindowText((HWND) GetHWND(), (const wxChar *)label);
}
WXHBRUSH wxStaticText::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
// Create the toolbar control.
HWND hWndTabCtrl = CreateWindowEx(0L, // No extended styles.
WC_TABCONTROL, // Class name for the tab control
- "", // No default text.
+ _T(""), // No default text.
WS_CHILD | WS_BORDER | WS_VISIBLE | tabStyle, // Styles and defaults.
x, y, width, height, // Standard size and position.
(HWND) parent->GetHWND(), // Parent window
// Get the item text
wxString wxTabCtrl::GetItemText(int item) const
{
- char buf[256];
- wxString str("");
+ wxChar buf[256];
+ wxString str(_T(""));
TC_ITEM tcItem;
tcItem.mask = TCIF_TEXT;
tcItem.pszText = buf;
// Insert an item
bool wxTabCtrl::InsertItem(int item, const wxString& text, int imageId, void* data)
{
- char buf[256];
+ wxChar buf[256];
TC_ITEM tcItem;
tcItem.mask = TCIF_PARAM;
tcItem.lParam = (long) data;
- if (text != "")
+ if (text != _T(""))
{
tcItem.mask |= TCIF_TEXT;
- strcpy(buf, (const char*) text);
+ wxStrcpy(buf, (const wxChar*) text);
tcItem.pszText = buf;
tcItem.cchTextMax = 256;
}
// Set the text for an item
bool wxTabCtrl::SetItemText(int item, const wxString& text)
{
- char buf[256];
+ wxChar buf[256];
TC_ITEM tcItem;
tcItem.mask = TCIF_TEXT;
- strcpy(buf, (const char*) text);
+ wxStrcpy(buf, (const wxChar*) text);
tcItem.pszText = buf;
tcItem.cchTextMax = 256;
LRESULT APIENTRY _EXPORT wxTaskBarIconWindowProc( HWND hWnd, unsigned msg,
UINT wParam, LONG lParam );
-char *wxTaskBarWindowClass = "wxTaskBarWindowClass";
+wxChar *wxTaskBarWindowClass = _T("wxTaskBarWindowClass");
wxList wxTaskBarIcon::sm_taskBarIcons;
bool wxTaskBarIcon::sm_registeredClass = FALSE;
notifyData.hIcon = (HICON) icon.GetHICON();
}
- if (((const char*) tooltip != NULL) && (tooltip != ""))
+ if (((const wxChar*) tooltip != NULL) && (tooltip != _T("")))
{
notifyData.uFlags |= NIF_TIP ;
- lstrcpyn(notifyData.szTip, (char*) (const char*) tooltip, sizeof(notifyData.szTip));
+ lstrcpyn(notifyData.szTip, WXSTRINGCAST tooltip, sizeof(notifyData.szTip));
}
notifyData.uID = 99;
return TRUE;
// Also register the taskbar message here
- sm_taskbarMsg = ::RegisterWindowMessage("wxTaskBarIconMessage");
+ sm_taskbarMsg = ::RegisterWindowMessage(_T("wxTaskBarIconMessage"));
WNDCLASS wc;
bool rc;
HINSTANCE hInstance = GetModuleHandle(NULL);
HWND hWnd = CreateWindowEx (0, wxTaskBarWindowClass,
- "wxTaskBarWindow",
+ _T("wxTaskBarWindow"),
WS_OVERLAPPED,
0,
0,
m_foregroundColour = *wxBLACK ;
wxASSERT_MSG( (style & wxTB_VERTICAL) == 0,
- "Sorry, wxToolBar95 under Windows 95 only "
- "supports horizontal orientation." );
+ _T("Sorry, wxToolBar95 under Windows 95 only "
+ "supports horizontal orientation.") );
m_maxWidth = -1;
m_maxHeight = -1;
(
exStyle, // Extended styles.
TOOLBARCLASSNAME, // Class name for the toolbar.
- "", // No default text.
+ _T(""), // No default text.
msflags, // Styles
x, y, width, height, // Standard toolbar size and position.
(HWND) parent->GetHWND(), // Parent window of the toolbar.
NULL // No class data.
);
- wxCHECK_MSG( hWndToolbar, FALSE, "Toolbar creation failed" );
+ wxCHECK_MSG( hWndToolbar, FALSE, _T("Toolbar creation failed") );
// Toolbar-specific initialisation
::SendMessage(hWndToolbar, TB_BUTTONSTRUCTSIZE,
replaceBitmap.nIDNew = (UINT) (HBITMAP) m_hBitmap;
replaceBitmap.nButtons = noButtons;
if (::SendMessage((HWND) GetHWND(), TB_REPLACEBITMAP, (WPARAM) 0, (LPARAM) &replaceBitmap) == -1)
- wxFAIL_MSG("Could not add bitmap to toolbar");
+ wxFAIL_MSG(_T("Could not add bitmap to toolbar"));
::DeleteObject((HBITMAP) oldToolBarBitmap);
addBitmap.hInst = 0;
addBitmap.nID = (UINT)m_hBitmap;
if (::SendMessage((HWND) GetHWND(), TB_ADDBITMAP, (WPARAM) noButtons, (LPARAM) &addBitmap) == -1)
- wxFAIL_MSG("Could not add bitmap to toolbar");
+ wxFAIL_MSG(_T("Could not add bitmap to toolbar"));
}
// Now add the buttons.
long rc = ::SendMessage((HWND) GetHWND(), TB_ADDBUTTONS, (WPARAM)i, (LPARAM)& buttons);
- wxCHECK_MSG( rc, FALSE, "failed to add buttons to the toolbar" );
+ wxCHECK_MSG( rc, FALSE, _T("failed to add buttons to the toolbar") );
(void)::SendMessage((HWND) GetHWND(), TB_AUTOSIZE, (WPARAM)0, (LPARAM) 0);
{
if ( hdr->code == TTN_NEEDTEXTA )
{
- ttText->lpszText = (char *)help.c_str();
+ ttText->lpszText = (wxChar *)help.c_str();
}
#if (_WIN32_IE >= 0x0300)
else
if (m_windowStyle & wxTE_MULTILINE)
{
wxASSERT_MSG( !(m_windowStyle & wxTE_PROCESS_ENTER),
- "wxTE_PROCESS_ENTER style is ignored for multiline controls" );
+ _T("wxTE_PROCESS_ENTER style is ignored for multiline controls") );
msStyle |= ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL ; // WS_BORDER
m_windowStyle |= wxTE_PROCESS_ENTER;
if (m_windowStyle & wxTE_PASSWORD) // hidden input
msStyle |= ES_PASSWORD;
- const char *windowClass = "EDIT";
+ const wxChar *windowClass = _T("EDIT");
#if wxUSE_RICHEDIT
if ( m_windowStyle & wxTE_MULTILINE )
{
msStyle |= ES_AUTOVSCROLL;
m_isRich = TRUE;
- windowClass = "RichEdit" ;
+ windowClass = _T("RichEdit") ;
}
else
m_isRich = FALSE;
#if wxUSE_RICHEDIT
if (m_windowStyle & wxSIMPLE_BORDER)
{
- windowClass = "EDIT";
+ windowClass = _T("EDIT");
m_isRich = FALSE;
}
#endif
0, 0, 0, 0, (HWND) ((wxWindow*)parent)->GetHWND(), (HMENU)m_windowId,
wxGetInstance(), NULL);
- wxCHECK_MSG( m_hWnd, FALSE, "Failed to create text ctrl" );
+ wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create text ctrl") );
#if wxUSE_CTL3D
if ( want3D )
// retrieve the style to see whether this is an edit or richedit ctrl
#if wxUSE_RICHEDIT
- char buf[256];
+ wxChar buf[256];
#ifndef __WIN32__
GetClassName((HWND) hWnd, buf, 256);
wxString str(buf);
str.UpperCase();
- if (str == "EDIT")
+ if (str == _T("EDIT"))
m_isRich = FALSE;
else
m_isRich = TRUE;
}
if (singletons > 0)
{
- char *tmp = new char[len + singletons + 1];
+ wxChar *tmp = new wxChar[len + singletons + 1];
int j = 0;
for (i = 0; i < len; i ++)
{
delete[] tmp;
}
else
- SetWindowText(GetHwnd(), (const char *)value);
+ SetWindowText(GetHwnd(), (const wxChar *)value);
AdjustSpaceLimit();
}
SendMessage(hWnd, WM_CUT, (WPARAM)0, (LPARAM)0);
// Now replace with 'value', by pasting.
- wxSetClipboardData(wxDF_TEXT, (wxObject *) (const char *)value, 0, 0);
+ wxSetClipboardData(wxDF_TEXT, (wxObject *) (const wxChar *)value, 0, 0);
// Paste into edit control
SendMessage(hWnd, WM_PASTE, (WPARAM)0, (LPARAM)0L);
Clear();
// ifstream input(WXSTRINGCAST file, ios::nocreate | ios::in);
- ifstream input(WXSTRINGCAST file, ios::in);
+ ifstream input(MBSTRINGCAST file.mb_str(wxConvFile), ios::in);
if (!input.bad())
{
#ifdef __SALFORDC__
struct _stat stat_buf;
- if (stat((char*) (const char*) file, &stat_buf) < 0)
+ if (stat(MBSTRINGCAST file.mb_str(wxConvFile), &stat_buf) < 0)
return FALSE;
#else
struct stat stat_buf;
- if (stat(file, &stat_buf) < 0)
+ if (stat(file.mb_str(wxConvFile), &stat_buf) < 0)
return FALSE;
#endif
-// char *tmp_buffer = (char*)farmalloc(stat_buf.st_size+1);
+// wxChar *tmp_buffer = (wxChar*)farmalloc(stat_buf.st_size+1);
// This may need to be a bigger buffer than the file size suggests,
// if it's a UNIX file. Give it an extra 1000 just in case.
- char *tmp_buffer = (char*)farmalloc((size_t)(stat_buf.st_size+1+1000));
+ wxChar *tmp_buffer = (wxChar*)farmalloc((size_t)(stat_buf.st_size+1+1000));
+ char *read_buffer = new char[512];
long no_lines = 0;
long pos = 0;
while (!input.eof() && input.peek() != EOF)
{
- input.getline(wxBuffer, 500);
- int len = strlen(wxBuffer);
+ input.getline(read_buffer, 500);
+ int len = strlen(read_buffer);
wxBuffer[len] = 13;
wxBuffer[len+1] = 10;
wxBuffer[len+2] = 0;
- strcpy(tmp_buffer+pos, wxBuffer);
- pos += strlen(wxBuffer);
+#if wxUSE_UNICODE
+ pos += wxConvCurrent->MB2WC(tmp_buffer+pos, read_buffer, (size_t)-1);
+#else
+ strcpy(tmp_buffer+pos, read_buffer);
+ pos += strlen(read_buffer);
+#endif
no_lines++;
}
+ delete[] read_buffer;
SetWindowText(GetHwnd(), tmp_buffer);
SendMessage(GetHwnd(), EM_SETMODIFY, FALSE, 0L);
{
wxString theFile(file);
- if (theFile == "")
+ if (theFile == _T(""))
theFile = m_fileName;
- if (theFile == "")
+ if (theFile == _T(""))
return FALSE;
m_fileName = theFile;
- ofstream output((char*) (const char*) theFile);
+ ofstream output(MBSTRINGCAST theFile.mb_str(wxConvFile));
if (output.bad())
return FALSE;
void wxTextCtrl::Clear()
{
- SetWindowText(GetHwnd(), "");
+ SetWindowText(GetHwnd(), _T(""));
}
bool wxTextCtrl::IsModified() const
wxTextCtrl& wxTextCtrl::operator<<(float f)
{
wxString str;
- str.Printf("%.2f", f);
+ str.Printf(_T("%.2f"), f);
AppendText(str);
return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(double d)
{
wxString str;
- str.Printf("%.2f", d);
+ str.Printf(_T("%.2f"), d);
AppendText(str);
return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(int i)
{
wxString str;
- str.Printf("%d", i);
+ str.Printf(_T("%d"), i);
AppendText(str);
return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(long i)
{
wxString str;
- str.Printf("%ld", i);
+ str.Printf(_T("%ld"), i);
AppendText(str);
return *this;
}
wxMutex::~wxMutex()
{
if (m_locked > 0)
- wxLogDebug("Warning: freeing a locked mutex (%d locks).", m_locked);
+ wxLogDebug(_T("Warning: freeing a locked mutex (%d locks)."), m_locked);
CloseHandle(p_internal->p_mutex);
}
case WAIT_TIMEOUT:
default:
- wxFAIL_MSG("impossible return value in wxMutex::Lock");
+ wxFAIL_MSG(_T("impossible return value in wxMutex::Lock"));
}
m_locked++;
win_priority = THREAD_PRIORITY_HIGHEST;
else
{
- wxFAIL_MSG("invalid value of thread priority parameter");
+ wxFAIL_MSG(_T("invalid value of thread priority parameter"));
win_priority = THREAD_PRIORITY_NORMAL;
}
break;
default:
- wxFAIL_MSG("unexpected result of MsgWaitForMultipleObject");
+ wxFAIL_MSG(_T("unexpected result of MsgWaitForMultipleObject"));
}
} while ( result != WAIT_OBJECT_0 );
}
wxASSERT_MSG( (LPVOID)rc != (LPVOID)STILL_ACTIVE,
- "thread must be already terminated." );
+ _T("thread must be already terminated.") );
::CloseHandle(hThread);
}
::ExitThread((DWORD)status);
- wxFAIL_MSG("Couldn't return from ExitThread()!");
+ wxFAIL_MSG(_T("Couldn't return from ExitThread()!"));
}
void wxThread::SetPriority(unsigned int prio)
{
// this would dead lock everything...
wxASSERT_MSG( !wxThread::IsMain(),
- "main thread doesn't want to block in wxMutexGuiEnter()!" );
+ _T("main thread doesn't want to block in wxMutexGuiEnter()!") );
// the order in which we enter the critical sections here is crucial!!
{
// decrement the number of waiters now
wxASSERT_MSG( s_nWaitingForGui > 0,
- "calling wxMutexGuiLeave() without entering it first?" );
+ _T("calling wxMutexGuiLeave() without entering it first?") );
s_nWaitingForGui--;
void WXDLLEXPORT wxMutexGuiLeaveOrEnter()
{
wxASSERT_MSG( wxThread::IsMain(),
- "only main thread may call wxMutexGuiLeaveOrEnter()!" );
+ _T("only main thread may call wxMutexGuiLeaveOrEnter()!") );
wxCriticalSectionLocker enter(*s_critsectWaitingForGui);
if (milliseconds < 0)
milliseconds = lastMilli;
- wxCHECK_MSG( milliseconds > 0, FALSE, "invalid value for timer timeour" );
+ wxCHECK_MSG( milliseconds > 0, FALSE, _T("invalid value for timer timeour") );
lastMilli = milli = milliseconds;
{
wxNode *node = wxTimerList.Find((long)idTimer);
- wxCHECK_MSG( node, 0, "bogus timer id in wxTimerProc" );
+ wxCHECK_MSG( node, 0, _T("bogus timer id in wxTimerProc") );
wxProcessTimer(*(wxTimer *)node->Data());
continue;
}
- wxASSERT_MSG( dialog || frame, "logic error" );
+ wxASSERT_MSG( dialog || frame, _T("logic error") );
WXHWND hwndTT = frame ? frame->GetToolTipCtrl()
: dialog->GetToolTipCtrl();
}
wxCHECK_MSG( frame || dialog, 0,
- "can't create tooltip control outside a frame or a dialog" );
+ _T("can't create tooltip control outside a frame or a dialog") );
HWND hwndTT = (HWND)(frame ? frame->GetToolTipCtrl()
: dialog->GetToolTipCtrl());
{
// update it immediately
wxToolInfo ti(m_window);
- ti.lpszText = (char *)m_text.c_str();
+ ti.lpszText = (wxChar *)m_text.c_str();
(void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, 0, &ti);
}
(
exStyle,
WC_TREEVIEW,
- "",
+ _T(""),
wstyle,
pos.x, pos.y, size.x, size.y,
(HWND)parent->GetHWND(),
NULL
);
- wxCHECK_MSG( m_hWnd, FALSE, "Failed to create tree ctrl" );
+ wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create tree ctrl") );
if ( parent )
parent->AddChild(this);
wxString wxTreeCtrl::GetItemText(const wxTreeItemId& item) const
{
- char buf[512]; // the size is arbitrary...
+ wxChar buf[512]; // the size is arbitrary...
wxTreeViewItem tvItem(item, TVIF_TEXT);
tvItem.pszText = buf;
if ( !DoGetItem(&tvItem) )
{
// don't return some garbage which was on stack, but an empty string
- buf[0] = '\0';
+ buf[0] = _T('\0');
}
return wxString(buf);
void wxTreeCtrl::SetItemText(const wxTreeItemId& item, const wxString& text)
{
wxTreeViewItem tvItem(item, TVIF_TEXT);
- tvItem.pszText = (char *)text.c_str(); // conversion is ok
+ tvItem.pszText = (wxChar *)text.c_str(); // conversion is ok
DoSetItem(&tvItem);
}
wxTreeItemId wxTreeCtrl::GetNextVisible(const wxTreeItemId& item) const
{
- wxASSERT_MSG( IsVisible(item), "The item you call GetNextVisible() "
- "for must be visible itself!");
+ wxASSERT_MSG( IsVisible(item), _T("The item you call GetNextVisible() "
+ "for must be visible itself!"));
return wxTreeItemId((WXHTREEITEM) TreeView_GetNextVisible(wxhWnd, (HTREEITEM) (WXHTREEITEM) item));
}
wxTreeItemId wxTreeCtrl::GetPrevVisible(const wxTreeItemId& item) const
{
- wxASSERT_MSG( IsVisible(item), "The item you call GetPrevVisible() "
- "for must be visible itself!");
+ wxASSERT_MSG( IsVisible(item), _T("The item you call GetPrevVisible() "
+ "for must be visible itself!"));
return wxTreeItemId((WXHTREEITEM) TreeView_GetPrevVisible(wxhWnd, (HTREEITEM) (WXHTREEITEM) item));
}
if ( !text.IsEmpty() )
{
mask |= TVIF_TEXT;
- tvIns.item.pszText = (char *)text.c_str(); // cast is ok
+ tvIns.item.pszText = (wxChar *)text.c_str(); // cast is ok
}
if ( image != -1 )
flag == (TVE_COLLAPSE | TVE_COLLAPSERESET) ||
flag == TVE_EXPAND ||
flag == TVE_TOGGLE,
- "Unknown flag in wxTreeCtrl::DoExpand" );
+ _T("Unknown flag in wxTreeCtrl::DoExpand") );
// TreeView_Expand doesn't send TVN_ITEMEXPAND(ING) messages, so we must
// emulate them
else
{
// I wonder if it really ever happens...
- wxLogDebug("TreeView_Expand: change didn't took place.");
+ wxLogDebug(_T("TreeView_Expand: change didn't took place."));
}
}
HWND hWnd = (HWND) TreeView_EditLabel(wxhWnd, (HTREEITEM) (WXHTREEITEM) item);
- wxCHECK_MSG( hWnd, NULL, "Can't edit tree ctrl label" );
+ wxCHECK_MSG( hWnd, NULL, _T("Can't edit tree ctrl label") );
DeleteTextCtrl();
int wxTreeCtrl::OnCompareItems(const wxTreeItemId& item1,
const wxTreeItemId& item2)
{
- return strcmp(GetItemText(item1), GetItemText(item2));
+ return wxStrcmp(GetItemText(item1), GetItemText(item2));
}
void wxTreeCtrl::SortChildren(const wxTreeItemId& item)
break;
default:
- wxLogDebug("unexpected code %d in TVN_ITEMEXPAND "
- "message", tv->action);
+ wxLogDebug(_T("unexpected code %d in TVN_ITEMEXPAND "
+ "message"), tv->action);
}
bool ing = (hdr->code == TVN_ITEMEXPANDING);
/// END for console support
// In the WIN.INI file
-static const char WX_SECTION[] = "wxWindows";
-static const char eHOSTNAME[] = "HostName";
-static const char eUSERID[] = "UserId";
-static const char eUSERNAME[] = "UserName";
+static const wxChar WX_SECTION[] = _T("wxWindows");
+static const wxChar eHOSTNAME[] = _T("HostName");
+static const wxChar eUSERID[] = _T("UserId");
+static const wxChar eUSERNAME[] = _T("UserName");
// For the following functions we SHOULD fill in support
// for Windows-NT (which I don't know) as I assume it begin
// functions beyond those provided by WinSock
// Get full hostname (eg. DoDo.BSn-Germany.crg.de)
-bool wxGetHostName(char *buf, int maxSize)
+bool wxGetHostName(wxChar *buf, int maxSize)
{
#if defined(__WIN32__) && !defined(__TWIN32__)
DWORD nSize = maxSize;
return (::GetComputerName(buf, &nSize) != 0);
#else
- char *sysname;
- const char *default_host = "noname";
+ wxChar *sysname;
+ const wxChar *default_host = _T("noname");
- if ((sysname = getenv("SYSTEM_NAME")) == NULL) {
+ if ((sysname = wxGetenv(_T("SYSTEM_NAME"))) == NULL) {
GetProfileString(WX_SECTION, eHOSTNAME, default_host, buf, maxSize - 1);
} else
- strncpy(buf, sysname, maxSize - 1);
- buf[maxSize] = '\0';
+ wxStrncpy(buf, sysname, maxSize - 1);
+ buf[maxSize] = _T('\0');
return *buf ? TRUE : FALSE;
#endif
}
// Get user ID e.g. jacs
-bool wxGetUserId(char *buf, int maxSize)
+bool wxGetUserId(wxChar *buf, int maxSize)
{
#if defined(__WIN32__) && !defined(__win32s__) && !defined(__TWIN32__)
DWORD nSize = maxSize;
if ( ::GetUserName(buf, &nSize) == 0 )
{
- wxLogSysError("Can not get user name");
+ wxLogSysError(_T("Can not get user name"));
return FALSE;
}
#endif // 0/1
#else // Win16 or Win32s
- char *user;
- const char *default_id = "anonymous";
+ wxChar *user;
+ const wxChar *default_id = _T("anonymous");
// Can't assume we have NIS (PC-NFS) or some other ID daemon
// So we ...
- if ( (user = getenv("USER")) == NULL &&
- (user = getenv("LOGNAME")) == NULL ) {
+ if ( (user = wxGetenv(_T("USER"))) == NULL &&
+ (user = wxGetenv(_T("LOGNAME"))) == NULL ) {
// Use wxWindows configuration data (comming soon)
GetProfileString(WX_SECTION, eUSERID, default_id, buf, maxSize - 1);
} else
- strncpy(buf, user, maxSize - 1);
+ wxStrncpy(buf, user, maxSize - 1);
return *buf ? TRUE : FALSE;
#endif
}
// Get user name e.g. Julian Smart
-bool wxGetUserName(char *buf, int maxSize)
+bool wxGetUserName(wxChar *buf, int maxSize)
{
#if wxUSE_PENWINDOWS && !defined(__WATCOMC__) && !defined(__GNUWIN32__)
extern HANDLE g_hPenWin; // PenWindows Running?
{
// Could use NIS, MS-Mail or other site specific programs
// Use wxWindows configuration data
- bool ok = GetProfileString(WX_SECTION, eUSERNAME, "", buf, maxSize - 1) != 0;
+ bool ok = GetProfileString(WX_SECTION, eUSERNAME, _T(""), buf, maxSize - 1) != 0;
if ( !ok )
{
ok = wxGetUserId(buf, maxSize);
if ( !ok )
{
- strncpy(buf, "Unknown User", maxSize);
+ wxStrncpy(buf, _T("Unknown User"), maxSize);
}
}
bool
wxShell(const wxString& command)
{
- char *shell;
- if ((shell = getenv("COMSPEC")) == NULL)
- shell = "\\COMMAND.COM";
+ wxChar *shell;
+ if ((shell = wxGetenv(_T("COMSPEC"))) == NULL)
+ shell = _T("\\COMMAND.COM");
- char tmp[255];
- if (command != "")
- sprintf(tmp, "%s /c %s", shell, WXSTRINGCAST command);
+ wxChar tmp[255];
+ if (command != _T(""))
+ wxSprintf(tmp, _T("%s /c %s"), shell, WXSTRINGCAST command);
else
- strcpy(tmp, shell);
+ wxStrcpy(tmp, shell);
- return (wxExecute((char *)tmp, FALSE) != 0);
+ return (wxExecute((wxChar *)tmp, FALSE) != 0);
}
// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
}
// Output a debug mess., in a system dependent fashion.
-void wxDebugMsg(const char *fmt ...)
+void wxDebugMsg(const wxChar *fmt ...)
{
va_list ap;
- static char buffer[512];
+ static wxChar buffer[512];
if (!wxTheApp->GetWantDebugOutput())
return ;
va_start(ap, fmt);
wvsprintf(buffer,fmt,ap) ;
- OutputDebugString((LPCSTR)buffer) ;
+ OutputDebugString((LPCTSTR)buffer) ;
va_end(ap);
}
// Non-fatal error: pop up message box and (possibly) continue
void wxError(const wxString& msg, const wxString& title)
{
- sprintf(wxBuffer, "%s\nContinue?", WXSTRINGCAST msg);
- if (MessageBox(NULL, (LPCSTR)wxBuffer, (LPCSTR)WXSTRINGCAST title,
+ wxSprintf(wxBuffer, _T("%s\nContinue?"), WXSTRINGCAST msg);
+ if (MessageBox(NULL, (LPCTSTR)wxBuffer, (LPCTSTR)WXSTRINGCAST title,
MB_ICONSTOP | MB_YESNO) == IDNO)
wxExit();
}
// Fatal error: pop up message box and abort
void wxFatalError(const wxString& msg, const wxString& title)
{
- sprintf(wxBuffer, "%s: %s", WXSTRINGCAST title, WXSTRINGCAST msg);
- FatalAppExit(0, (LPCSTR)wxBuffer);
+ wxSprintf(wxBuffer, _T("%s: %s"), WXSTRINGCAST title, WXSTRINGCAST msg);
+ FatalAppExit(0, (LPCTSTR)wxBuffer);
}
// Emit a beeeeeep
#if wxUSE_RESOURCES
bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file)
{
- if (file != "")
- return (WritePrivateProfileString((LPCSTR)WXSTRINGCAST section, (LPCSTR)WXSTRINGCAST entry, (LPCSTR)value, (LPCSTR)WXSTRINGCAST file) != 0);
+ if (file != _T(""))
+ return (WritePrivateProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)value, (LPCTSTR)WXSTRINGCAST file) != 0);
else
- return (WriteProfileString((LPCSTR)WXSTRINGCAST section, (LPCSTR)WXSTRINGCAST entry, (LPCSTR)WXSTRINGCAST value) != 0);
+ return (WriteProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)WXSTRINGCAST value) != 0);
}
bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file)
{
- char buf[50];
- sprintf(buf, "%.4f", value);
+ wxChar buf[50];
+ wxSprintf(buf, _T("%.4f"), value);
return wxWriteResource(section, entry, buf, file);
}
bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file)
{
- char buf[50];
- sprintf(buf, "%ld", value);
+ wxChar buf[50];
+ wxSprintf(buf, _T("%ld"), value);
return wxWriteResource(section, entry, buf, file);
}
bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file)
{
- char buf[50];
- sprintf(buf, "%d", value);
+ wxChar buf[50];
+ wxSprintf(buf, _T("%d"), value);
return wxWriteResource(section, entry, buf, file);
}
-bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file)
+bool wxGetResource(const wxString& section, const wxString& entry, wxChar **value, const wxString& file)
{
- static const char defunkt[] = "$$default";
- if (file != "")
+ static const wxChar defunkt[] = _T("$$default");
+ if (file != _T(""))
{
- int n = GetPrivateProfileString((LPCSTR)WXSTRINGCAST section, (LPCSTR)WXSTRINGCAST entry, (LPCSTR)defunkt,
- (LPSTR)wxBuffer, 1000, (LPCSTR)WXSTRINGCAST file);
- if (n == 0 || strcmp(wxBuffer, defunkt) == 0)
+ int n = GetPrivateProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)defunkt,
+ (LPTSTR)wxBuffer, 1000, (LPCTSTR)WXSTRINGCAST file);
+ if (n == 0 || wxStrcmp(wxBuffer, defunkt) == 0)
return FALSE;
}
else
{
- int n = GetProfileString((LPCSTR)WXSTRINGCAST section, (LPCSTR)WXSTRINGCAST entry, (LPCSTR)defunkt,
- (LPSTR)wxBuffer, 1000);
- if (n == 0 || strcmp(wxBuffer, defunkt) == 0)
+ int n = GetProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)defunkt,
+ (LPTSTR)wxBuffer, 1000);
+ if (n == 0 || wxStrcmp(wxBuffer, defunkt) == 0)
return FALSE;
}
if (*value) delete[] (*value);
bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file)
{
- char *s = NULL;
- bool succ = wxGetResource(section, entry, (char **)&s, file);
+ wxChar *s = NULL;
+ bool succ = wxGetResource(section, entry, (wxChar **)&s, file);
if (succ)
{
- *value = (float)strtod(s, NULL);
+ *value = (float)wxStrtod(s, NULL);
delete[] s;
return TRUE;
}
bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file)
{
- char *s = NULL;
- bool succ = wxGetResource(section, entry, (char **)&s, file);
+ wxChar *s = NULL;
+ bool succ = wxGetResource(section, entry, (wxChar **)&s, file);
if (succ)
{
- *value = strtol(s, NULL, 10);
+ *value = wxStrtol(s, NULL, 10);
delete[] s;
return TRUE;
}
bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file)
{
- char *s = NULL;
- bool succ = wxGetResource(section, entry, (char **)&s, file);
+ wxChar *s = NULL;
+ bool succ = wxGetResource(section, entry, (wxChar **)&s, file);
if (succ)
{
- *value = (int)strtol(s, NULL, 10);
+ *value = (int)wxStrtol(s, NULL, 10);
delete[] s;
return TRUE;
}
void wxEndBusyCursor()
{
wxCHECK_RET( gs_wxBusyCursorCount > 0,
- "no matching wxBeginBusyCursor() for wxEndBusyCursor()" );
+ _T("no matching wxBeginBusyCursor() for wxEndBusyCursor()") );
if ( --gs_wxBusyCursorCount == 0 )
{
}
// ---------------------------------------------------------------------------
-const char* wxGetHomeDir(wxString *pstr)
+const wxChar* wxGetHomeDir(wxString *pstr)
{
wxString& strDir = *pstr;
#if defined(__UNIX__) && !defined(__TWIN32__)
- const char *szHome = getenv("HOME");
+ const wxChar *szHome = wxGetenv("HOME");
if ( szHome == NULL ) {
// we're homeless...
wxLogWarning(_("can't find user's HOME, using current directory."));
- strDir = ".";
+ strDir = _T(".");
}
else
strDir = szHome;
// add a trailing slash if needed
- if ( strDir.Last() != '/' )
- strDir << '/';
+ if ( strDir.Last() != _T('/') )
+ strDir << _T('/');
#else // Windows
#ifdef __WIN32__
- const char *szHome = getenv("HOMEDRIVE");
+ const wxChar *szHome = wxGetenv(_T("HOMEDRIVE"));
if ( szHome != NULL )
strDir << szHome;
- szHome = getenv("HOMEPATH");
+ szHome = wxGetenv(_T("HOMEPATH"));
if ( szHome != NULL ) {
strDir << szHome;
// create it in our program's dir. However, if the user took care
// to set HOMEPATH to something other than "\\", we suppose that he
// knows what he is doing and use the supplied value.
- if ( strcmp(szHome, "\\") != 0 )
+ if ( wxStrcmp(szHome, _T("\\")) != 0 )
return strDir.c_str();
}
}
// Hack for MS-DOS
-char *wxGetUserHome (const wxString& user)
+wxChar *wxGetUserHome (const wxString& user)
{
- char *home;
+ wxChar *home;
wxString user1(user);
- if (user1 != "") {
- char tmp[64];
+ if (user1 != _T("")) {
+ wxChar tmp[64];
if (wxGetUserId(tmp, sizeof(tmp)/sizeof(char))) {
// Guests belong in the temp dir
- if (Stricmp(tmp, "annonymous") == 0) {
- if ((home = getenv("TMP")) != NULL ||
- (home = getenv("TMPDIR")) != NULL ||
- (home = getenv("TEMP")) != NULL)
- return *home ? home : (char*)"\\";
+ if (wxStricmp(tmp, _T("annonymous")) == 0) {
+ if ((home = wxGetenv(_T("TMP"))) != NULL ||
+ (home = wxGetenv(_T("TMPDIR"))) != NULL ||
+ (home = wxGetenv(_T("TEMP"))) != NULL)
+ return *home ? home : (wxChar*)_T("\\");
}
- if (Stricmp(tmp, WXSTRINGCAST user1) == 0)
- user1 = "";
+ if (wxStricmp(tmp, WXSTRINGCAST user1) == 0)
+ user1 = _T("");
}
}
- if (user1 == "")
- if ((home = getenv("HOME")) != NULL)
+ if (user1 == _T(""))
+ if ((home = wxGetenv(_T("HOME"))) != NULL)
{
- strcpy(wxBuffer, home);
+ wxStrcpy(wxBuffer, home);
Unix2DosFilename(wxBuffer);
return wxBuffer;
}
return TRUE;//*** temporary?
}
else{
- wxFAIL_MSG("wnd==NULL !!!");
+ wxFAIL_MSG(_T("wnd==NULL !!!"));
return FALSE;//*** temporary?
}
// Returns NULL or newly-allocated memory, so use delete[] to clean up.
#ifdef __WXMSW__
-char *wxLoadUserResource(const wxString& resourceName, const wxString& resourceType)
+wxChar *wxLoadUserResource(const wxString& resourceName, const wxString& resourceType)
{
- char *s = NULL;
+ wxChar *s = NULL;
#if !defined(__WIN32__) || defined(__TWIN32__)
HRSRC hResource = ::FindResource(wxGetInstance(), WXSTRINGCAST resourceName, WXSTRINGCAST resourceType);
#else
HGLOBAL hData = ::LoadResource(wxGetInstance(), hResource);
if (hData == 0)
return NULL;
- char *theText = (char *)LockResource(hData);
+ wxChar *theText = (wxChar *)LockResource(hData);
if (!theText)
return NULL;
#include <process.h>
#endif
-void OutputDebugStringW95(const char* lpOutputString, ...)
+void OutputDebugStringW95(const wxChar* lpOutputString, ...)
{
HANDLE heventDBWIN; /* DBWIN32 synchronization object */
HANDLE heventData; /* data passing synch object */
HANDLE hSharedFile; /* memory mapped file shared data */
LPSTR lpszSharedMem;
- char achBuffer[500];
+ wxChar achBuffer[500];
/* create the output buffer */
va_list args;
va_start(args, lpOutputString);
- vsprintf(achBuffer, lpOutputString, args);
+ wxVsprintf(achBuffer, lpOutputString, args);
va_end(args);
/*
}
/* make sure DBWIN is open and waiting */
- heventDBWIN = OpenEvent(EVENT_MODIFY_STATE, FALSE, "DBWIN_BUFFER_READY");
+ heventDBWIN = OpenEvent(EVENT_MODIFY_STATE, FALSE, _T("DBWIN_BUFFER_READY"));
if ( !heventDBWIN )
{
- //MessageBox(NULL, "DBWIN_BUFFER_READY nonexistent", NULL, MB_OK);
+ //MessageBox(NULL, _T("DBWIN_BUFFER_READY nonexistent"), NULL, MB_OK);
return;
}
/* get a handle to the data synch object */
- heventData = OpenEvent(EVENT_MODIFY_STATE, FALSE, "DBWIN_DATA_READY");
+ heventData = OpenEvent(EVENT_MODIFY_STATE, FALSE, _T("DBWIN_DATA_READY"));
if ( !heventData )
{
- // MessageBox(NULL, "DBWIN_DATA_READY nonexistent", NULL, MB_OK);
+ // MessageBox(NULL, _T("DBWIN_DATA_READY nonexistent"), NULL, MB_OK);
CloseHandle(heventDBWIN);
return;
}
- hSharedFile = CreateFileMapping((HANDLE)-1, NULL, PAGE_READWRITE, 0, 4096, "DBWIN_BUFFER");
+ hSharedFile = CreateFileMapping((HANDLE)-1, NULL, PAGE_READWRITE, 0, 4096, _T("DBWIN_BUFFER"));
if (!hSharedFile)
{
- //MessageBox(NULL, "DebugTrace: Unable to create file mapping object DBWIN_BUFFER", "Error", MB_OK);
+ //MessageBox(NULL, _T("DebugTrace: Unable to create file mapping object DBWIN_BUFFER"), _T("Error"), MB_OK);
CloseHandle(heventDBWIN);
CloseHandle(heventData);
return;
lpszSharedMem = (LPSTR)MapViewOfFile(hSharedFile, FILE_MAP_WRITE, 0, 0, 512);
if (!lpszSharedMem)
{
- //MessageBox(NULL, "DebugTrace: Unable to map shared memory", "Error", MB_OK);
+ //MessageBox(NULL, _T("DebugTrace: Unable to map shared memory"), _T("Error"), MB_OK);
CloseHandle(heventDBWIN);
CloseHandle(heventData);
return;
*((LPDWORD)lpszSharedMem) = _getpid();
#endif
- wsprintf(lpszSharedMem + sizeof(DWORD), "%s", achBuffer);
+ wsprintf((LPTSTR)(lpszSharedMem + sizeof(DWORD)), _T("%s"), achBuffer);
/* signal data ready event */
SetEvent(heventData);
}
wxASSERT_MSG( data->dwExitCode != STILL_ACTIVE,
- "process should have terminated" );
+ _T("process should have terminated") );
// send a message indicating process termination to the window
SendMessage(data->hWnd, wxWM_PROC_TERMINATED, 0, (LPARAM)data);
return 0;
}
-extern char wxPanelClassName[];
+extern wxChar wxPanelClassName[];
long wxExecute(const wxString& command, bool sync, wxProcess *handler)
{
- wxCHECK_MSG( !!command, 0, "empty command in wxExecute" );
+ wxCHECK_MSG( !!command, 0, _T("empty command in wxExecute") );
#if defined(__WIN32__) && !defined(__TWIN32__)
// the old code is disabled because we really need a process handle
if ( ::CreateProcess(
NULL, // application name (use only cmd line)
- (char *)command.c_str(), // full command line
+ (wxChar *)command.c_str(), // full command line
NULL, // security attributes: defaults for both
NULL, // the process and its main thread
FALSE, // don't inherit handles
// termination
HWND hwnd = ::CreateWindow(wxPanelClassName, NULL, 0, 0, 0, 0, 0, NULL,
(HMENU)NULL, wxGetInstance(), 0);
- wxASSERT_MSG( hwnd, "can't create a hidden window for wxExecute" );
+ wxASSERT_MSG( hwnd, _T("can't create a hidden window for wxExecute") );
FARPROC ExecuteWindowInstance = MakeProcInstance((FARPROC)wxExecuteWindowCbk,
wxGetInstance());
data->state = sync;
if ( sync )
{
- wxASSERT_MSG( !handler, "wxProcess param ignored for sync execution" );
+ wxASSERT_MSG( !handler, _T("wxProcess param ignored for sync execution") );
data->handler = NULL;
}
HRSRC hresInfo;
#if defined(__WIN32__) && !defined(__TWIN32__)
- hresInfo = ::FindResourceA((HMODULE) wxhInstance, fileName, "WAVE");
+#ifdef _UNICODE
+ hresInfo = ::FindResourceW((HMODULE) wxhInstance, fileName, _T("WAVE"));
#else
- hresInfo = ::FindResource((HMODULE) wxhInstance, fileName, "WAVE");
+ hresInfo = ::FindResourceA((HMODULE) wxhInstance, fileName, _T("WAVE"));
+#endif
+#else
+ hresInfo = ::FindResource((HMODULE) wxhInstance, fileName, _T("WAVE"));
#endif
if (!hresInfo)
return FALSE;
return FALSE;
#ifdef __WIN32__
- return ( ::PlaySound((LPCSTR)m_waveData, NULL, SND_MEMORY |
+ return ( ::PlaySound((LPCTSTR)m_waveData, NULL, SND_MEMORY |
SND_NODEFAULT | (async ? SND_ASYNC : SND_SYNC) | (looped ? (SND_LOOP | SND_ASYNC) : 0)) != 0 );
#else
return ( ::sndPlaySound((LPCSTR)m_waveData, SND_MEMORY |
wxMenu *wxCurrentPopupMenu = NULL;
extern wxList WXDLLEXPORT wxPendingDelete;
-extern char wxCanvasClassName[];
+extern wxChar wxCanvasClassName[];
#ifdef __WXDEBUG__
// see comments in dcclient.cpp where g_isPainting is defined
long style,
const wxString& name)
{
- wxCHECK_MSG( parent, FALSE, "can't create wxWindow without parent" );
+ wxCHECK_MSG( parent, FALSE, _T("can't create wxWindow without parent") );
CreateBase(parent, id, pos, size, style, name);
void wxWindow::SubclassWin(WXHWND hWnd)
{
- wxASSERT_MSG( !m_oldWndProc, "subclassing window twice?" );
+ wxASSERT_MSG( !m_oldWndProc, _T("subclassing window twice?") );
wxAssociateWinWithHandle((HWND)hWnd, this);
SIZE sizeRect;
TEXTMETRIC tm;
- GetTextExtentPoint(dc, (const char *)string, (int)string.Length(), &sizeRect);
+ GetTextExtentPoint(dc, (const wxChar *)string, (int)string.Length(), &sizeRect);
GetTextMetrics(dc, &tm);
if ( fontToUse && fnt && hfontOld )
{
// trace all messages - useful for the debugging
#ifdef __WXDEBUG__
- wxLogTrace(wxTraceMessages, "Processing %s(wParam=%8lx, lParam=%8lx)",
+ wxLogTrace(wxTraceMessages, _T("Processing %s(wParam=%8lx, lParam=%8lx)"),
wxGetMessageName(message), wParam, lParam);
#endif // __WXDEBUG__
if ( !processed )
{
#ifdef __WXDEBUG__
- wxLogTrace(wxTraceMessages, "Forwarding %s to DefWindowProc.",
+ wxLogTrace(wxTraceMessages, _T("Forwarding %s to DefWindowProc."),
wxGetMessageName(message));
#endif // __WXDEBUG__
rc.result = MSWDefWindowProc(message, wParam, lParam);
// adding NULL hWnd is (first) surely a result of an error and
// (secondly) breaks menu command processing
wxCHECK_RET( hWnd != (HWND)NULL,
- "attempt to add a NULL hWnd to window list ignored" );
+ _T("attempt to add a NULL hWnd to window list ignored") );
if ( !wxWinHandleList->Find((long)hWnd) )
wxWinHandleList->Append((long)hWnd, win);
int i;
for (i = 0; i < N; i++)
{
- char buf[100];
+ wxChar buf[100];
int chars = GetMenuString(hMenu, i, buf, 100, MF_BYPOSITION);
if ( !chars )
{
- wxLogLastError("GetMenuString");
+ wxLogLastError(_T("GetMenuString"));
continue;
}
- if ( strcmp(buf, "&Window") == 0 )
+ if ( wxStrcmp(buf, _T("&Window")) == 0 )
{
RemoveMenu(hMenu, i, MF_BYPOSITION);
bool wxWindow::MSWCreate(int id,
wxWindow *parent,
- const char *wclass,
+ const wxChar *wclass,
wxWindow *wx_win,
- const char *title,
+ const wxChar *title,
int x,
int y,
int width,
int height,
WXDWORD style,
- const char *dialog_template,
+ const wxChar *dialog_template,
WXDWORD extendedStyle)
{
int x1 = CW_USEDEFAULT;
if ( !::SetWindowPos(GetHwnd(), HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE) )
{
- wxLogLastError("SetWindowPos");
+ wxLogLastError(_T("SetWindowPos"));
}
}
// move the dialog to its initial position without forcing repainting
if ( !::MoveWindow(GetHwnd(), x1, y1, width1, height1, FALSE) )
{
- wxLogLastError("MoveWindow");
+ wxLogLastError(_T("MoveWindow"));
}
}
else
m_hWnd = (WXHWND)CreateWindowEx(extendedStyle,
wclass,
- title ? title : "",
+ title ? title : _T(""),
style,
x1, y1,
width1, height1,
if ( hdr->code == TTN_NEEDTEXT && m_tooltip )
{
TOOLTIPTEXT *ttt = (TOOLTIPTEXT *)lParam;
- ttt->lpszText = (char *)m_tooltip->GetTip().c_str();
+ ttt->lpszText = (wxChar *)m_tooltip->GetTip().c_str();
// processed
return TRUE;
int wIndex;
for (wIndex=0; wIndex < (int)gwFilesDropped; wIndex++)
{
- DragQueryFile (hFilesInfo, wIndex, (LPSTR) wxBuffer, 1000);
+ DragQueryFile (hFilesInfo, wIndex, (LPTSTR) wxBuffer, 1000);
files[wIndex] = wxBuffer;
}
DragFinish (hFilesInfo);
break;
default:
- wxFAIL_MSG("no such joystick event");
+ wxFAIL_MSG(_T("no such joystick event"));
return FALSE;
}
if (dc)
{
xpmAttr.valuemask = XpmReturnPixels;
- int errorStatus = XpmReadFileToImage(&dc, WXSTRINGCAST name, &ximage, (XImage **) NULL, &xpmAttr);
+ int errorStatus = XpmReadFileToImage(&dc, MBSTRINGCAST name.mb_str(wxConvFile), &ximage, (XImage **) NULL, &xpmAttr);
DeleteDC(dc);
if (errorStatus == XpmSuccess)
{
ximage.height = M_BITMAPHANDLERDATA->m_height;
ximage.depth = M_BITMAPHANDLERDATA->m_depth;
ximage.bitmap = (HBITMAP)M_BITMAPHANDLERDATA->m_hBitmap;
- int errorStatus = XpmWriteFileFromImage(&dc, WXSTRINGCAST name,
+ int errorStatus = XpmWriteFileFromImage(&dc, MBSTRINGCAST name.mb_str(wxConvFile),
&ximage, (XImage *) NULL, (XpmAttributes *) NULL);
if (dc)