# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1672522932 0 # Node ID 1184f58135bacf59fa720e7fda9b057b97a04afe # Parent cacb6610abfc87acbf80ba18d18fe115a4d31630 C++: Eliminate remnants of C code I missed while porting to C++. Only exception is the Android specific dw_file_open() call... it is a replacement for a C API and a macro on most platforms... Plus I really don't like that call, but Android required it... so leaving it as is for now. diff -r cacb6610abfc -r 1184f58135ba dw.hpp --- a/dw.hpp Sat Dec 31 04:29:47 2022 +0000 +++ b/dw.hpp Sat Dec 31 21:42:12 2022 +0000 @@ -2129,6 +2129,8 @@ void FreeIcon(HICN icon) { dw_icon_free(icon); } void TaskBarInsert(Widget *handle, HICN icon, const char *bubbletext) { dw_taskbar_insert(handle ? handle->GetHWND() : DW_NOHWND, icon, bubbletext); } void TaskBarDelete(Widget *handle, HICN icon) { dw_taskbar_delete(handle ? handle->GetHWND() : DW_NOHWND, icon); } + char * WideToUTF8(const wchar_t * wstring) { return dw_wchar_to_utf8(wstring); } + wchar_t *UTF8ToWide(const char * utf8string) { return dw_utf8_to_wchar(utf8string); } }; // Static singleton reference declared outside of the class diff -r cacb6610abfc -r 1184f58135ba dwtestoo.cpp --- a/dwtestoo.cpp Sat Dec 31 04:29:47 2022 +0000 +++ b/dwtestoo.cpp Sat Dec 31 21:42:12 2022 +0000 @@ -349,7 +349,7 @@ } // Request that the render widgets redraw... - // If not using direct rendering, call update_render() to + // If not using direct rendering, call UpdateRender() to // redraw the in memory pixmaps. Then trigger the expose events. // Expose will call update_render() to draw directly or bitblt the pixmaps. void RenderDraw() { @@ -515,7 +515,7 @@ // Increment the ready count while protected by mutex mutex->Lock(); ready++; - sprintf(buf, "Thread %d work done. ready=%d", threadnum, ready); + snprintf(buf, BUF_SIZE, "Thread %d work done. ready=%d", threadnum, ready); // If all 4 threads have incrememted the ready count... // Post the control event semaphore so things will get started. if(ready == 4) @@ -822,7 +822,7 @@ void CreateRender(DW::Box *notebookbox) { int vscrollbarwidth, hscrollbarheight; wchar_t widestring[100] = L"DWTest Wide"; - char *utf8string = dw_wchar_to_utf8(widestring); + char *utf8string = app->WideToUTF8(widestring); // create a box to pack into the notebook page DW::Box *pagebox = new DW::Box(DW_HORZ, 2); @@ -1586,7 +1586,7 @@ }); // add LOTS of items - app->Debug("before appending 500 items to combobox using dw_listbox_list_append()\n"); + app->Debug("before appending 500 items to combobox using DW::ListBox::ListAppend()\n"); char **text = (char **)malloc(500*sizeof(char *)); for(int i = 0; i < 500; i++) { @@ -2049,7 +2049,7 @@ for(int intfeat=DW_FEATURE_HTML; intfeat(intfeat); - int result = dw_feature_get(feat); + int result = app->GetFeature(feat); const char *status = "Unsupported"; if(result == 0)