comparison dwtestoo.cpp @ 2938:1184f58135ba

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.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 31 Dec 2022 21:42:12 +0000
parents 440de3640522
children ebbc5b16899e
comparison
equal deleted inserted replaced
2937:cacb6610abfc 2938:1184f58135ba
347 break; 347 break;
348 } 348 }
349 } 349 }
350 350
351 // Request that the render widgets redraw... 351 // Request that the render widgets redraw...
352 // If not using direct rendering, call update_render() to 352 // If not using direct rendering, call UpdateRender() to
353 // redraw the in memory pixmaps. Then trigger the expose events. 353 // redraw the in memory pixmaps. Then trigger the expose events.
354 // Expose will call update_render() to draw directly or bitblt the pixmaps. 354 // Expose will call update_render() to draw directly or bitblt the pixmaps.
355 void RenderDraw() { 355 void RenderDraw() {
356 // If we are double buffered, draw to the pixmaps 356 // If we are double buffered, draw to the pixmaps
357 if(render_type != SHAPES_DIRECT) 357 if(render_type != SHAPES_DIRECT)
513 app->MainSleep(1000 * threadnum); 513 app->MainSleep(1000 * threadnum);
514 514
515 // Increment the ready count while protected by mutex 515 // Increment the ready count while protected by mutex
516 mutex->Lock(); 516 mutex->Lock();
517 ready++; 517 ready++;
518 sprintf(buf, "Thread %d work done. ready=%d", threadnum, ready); 518 snprintf(buf, BUF_SIZE, "Thread %d work done. ready=%d", threadnum, ready);
519 // If all 4 threads have incrememted the ready count... 519 // If all 4 threads have incrememted the ready count...
520 // Post the control event semaphore so things will get started. 520 // Post the control event semaphore so things will get started.
521 if(ready == 4) 521 if(ready == 4)
522 { 522 {
523 controlevent->Post(); 523 controlevent->Post();
820 820
821 // Notebook page 2 821 // Notebook page 2
822 void CreateRender(DW::Box *notebookbox) { 822 void CreateRender(DW::Box *notebookbox) {
823 int vscrollbarwidth, hscrollbarheight; 823 int vscrollbarwidth, hscrollbarheight;
824 wchar_t widestring[100] = L"DWTest Wide"; 824 wchar_t widestring[100] = L"DWTest Wide";
825 char *utf8string = dw_wchar_to_utf8(widestring); 825 char *utf8string = app->WideToUTF8(widestring);
826 826
827 // create a box to pack into the notebook page 827 // create a box to pack into the notebook page
828 DW::Box *pagebox = new DW::Box(DW_HORZ, 2); 828 DW::Box *pagebox = new DW::Box(DW_HORZ, 2);
829 notebookbox->PackStart(pagebox, 0, 0, TRUE, TRUE, 0); 829 notebookbox->PackStart(pagebox, 0, 0, TRUE, TRUE, 0);
830 830
1584 this->app->Debug("got combobox_select_event for index: %d, iteration: %d\n", index, iteration++); 1584 this->app->Debug("got combobox_select_event for index: %d, iteration: %d\n", index, iteration++);
1585 return FALSE; 1585 return FALSE;
1586 }); 1586 });
1587 1587
1588 // add LOTS of items 1588 // add LOTS of items
1589 app->Debug("before appending 500 items to combobox using dw_listbox_list_append()\n"); 1589 app->Debug("before appending 500 items to combobox using DW::ListBox::ListAppend()\n");
1590 char **text = (char **)malloc(500*sizeof(char *)); 1590 char **text = (char **)malloc(500*sizeof(char *));
1591 for(int i = 0; i < 500; i++) 1591 for(int i = 0; i < 500; i++)
1592 { 1592 {
1593 text[i] = (char *)calloc(1, 50); 1593 text[i] = (char *)calloc(1, 50);
1594 snprintf(text[i], 50, "item %d", i); 1594 snprintf(text[i], 50, "item %d", i);
2047 2047
2048 // Test all the features and display the results 2048 // Test all the features and display the results
2049 for(int intfeat=DW_FEATURE_HTML; intfeat<DW_FEATURE_MAX; intfeat++) 2049 for(int intfeat=DW_FEATURE_HTML; intfeat<DW_FEATURE_MAX; intfeat++)
2050 { 2050 {
2051 DWFEATURE feat = static_cast<DWFEATURE>(intfeat); 2051 DWFEATURE feat = static_cast<DWFEATURE>(intfeat);
2052 int result = dw_feature_get(feat); 2052 int result = app->GetFeature(feat);
2053 const char *status = "Unsupported"; 2053 const char *status = "Unsupported";
2054 2054
2055 if(result == 0) 2055 if(result == 0)
2056 status = "Disabled"; 2056 status = "Disabled";
2057 else if(result > 0) 2057 else if(result > 0)