Mercurial > dwindows
comparison dwtestoo.cpp @ 2960:1dabe9c6c67b
C++: Step 2 of the std::string transition.
Implement std::string versions of the Connect callback functions.
Add "C" to the name of the UTF8 returning functions.
Reimplement the functions as std::string by default.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 16 Feb 2023 12:04:52 +0000 |
parents | 217ebbee034f |
children | b9bd130f438a |
comparison
equal
deleted
inserted
replaced
2959:cde59690d3dd | 2960:1dabe9c6c67b |
---|---|
754 this->app->Debug("Folder picked: %s\n", tmp ? tmp : "None"); | 754 this->app->Debug("Folder picked: %s\n", tmp ? tmp : "None"); |
755 return FALSE; | 755 return FALSE; |
756 }); | 756 }); |
757 | 757 |
758 copybutton->ConnectClicked([this, copypastefield, entryfield]() -> int { | 758 copybutton->ConnectClicked([this, copypastefield, entryfield]() -> int { |
759 char *test = copypastefield->GetText(); | 759 char *test = copypastefield->GetCText(); |
760 | 760 |
761 if(test) { | 761 if(test) { |
762 this->app->SetClipboard(test); | 762 this->app->SetClipboard(test); |
763 this->app->Free(test); | 763 this->app->Free(test); |
764 } | 764 } |
766 return TRUE; | 766 return TRUE; |
767 }); | 767 }); |
768 | 768 |
769 pastebutton->ConnectClicked([this, copypastefield]() -> int | 769 pastebutton->ConnectClicked([this, copypastefield]() -> int |
770 { | 770 { |
771 char *test = this->app->GetClipboard(); | 771 char *test = this->app->GetCClipboard(); |
772 if(test) { | 772 if(test) { |
773 copypastefield->SetText(test); | 773 copypastefield->SetText(test); |
774 this->app->Free(test); | 774 this->app->Free(test); |
775 } | 775 } |
776 return TRUE; | 776 return TRUE; |
915 image = new DW::Pixmap(render1, "image/test"); | 915 image = new DW::Pixmap(render1, "image/test"); |
916 if(!image || !image->GetHPIXMAP()) | 916 if(!image || !image->GetHPIXMAP()) |
917 image = new DW::Pixmap(render1, "~/test"); | 917 image = new DW::Pixmap(render1, "~/test"); |
918 if(!image || !image->GetHPIXMAP()) | 918 if(!image || !image->GetHPIXMAP()) |
919 { | 919 { |
920 char *appdir = app->GetDir(); | 920 char *appdir = app->GetCDir(); |
921 char pathbuff[1025] = {0}; | 921 char pathbuff[1025] = {0}; |
922 int pos = (int)strlen(appdir); | 922 int pos = (int)strlen(appdir); |
923 | 923 |
924 strncpy(pathbuff, appdir, 1024); | 924 strncpy(pathbuff, appdir, 1024); |
925 pathbuff[pos] = DW_DIR_SEPARATOR; | 925 pathbuff[pos] = DW_DIR_SEPARATOR; |
1209 tree->Insert("tree file 4", fileicon, t2, DW_INT_TO_POINTER(6)); | 1209 tree->Insert("tree file 4", fileicon, t2, DW_INT_TO_POINTER(6)); |
1210 tree->Change(t1, "tree folder 1", foldericon); | 1210 tree->Change(t1, "tree folder 1", foldericon); |
1211 tree->Change(t2, "tree folder 2", foldericon); | 1211 tree->Change(t2, "tree folder 2", foldericon); |
1212 tree->SetData(t2, DW_INT_TO_POINTER(100)); | 1212 tree->SetData(t2, DW_INT_TO_POINTER(100)); |
1213 tree->Expand(t1); | 1213 tree->Expand(t1); |
1214 char *title = tree->GetTitle(t1); | 1214 char *title = tree->GetCTitle(t1); |
1215 this->app->Debug("t1 title \"%s\" data %d t2 data %d\n", title, DW_POINTER_TO_INT(tree->GetData(t1)), | 1215 this->app->Debug("t1 title \"%s\" data %d t2 data %d\n", title, DW_POINTER_TO_INT(tree->GetData(t1)), |
1216 DW_POINTER_TO_INT(tree->GetData(t2))); | 1216 DW_POINTER_TO_INT(tree->GetData(t2))); |
1217 this->app->Free(title); | 1217 this->app->Free(title); |
1218 } | 1218 } |
1219 else | 1219 else |
1429 char colortext[101] = {0}; | 1429 char colortext[101] = {0}; |
1430 ULONG fore = DW_CLR_DEFAULT, back = DW_CLR_DEFAULT; | 1430 ULONG fore = DW_CLR_DEFAULT, back = DW_CLR_DEFAULT; |
1431 | 1431 |
1432 mlefore->GetListText(pos, colortext, 100); | 1432 mlefore->GetListText(pos, colortext, 100); |
1433 fore = ComboboxColor(colortext); | 1433 fore = ComboboxColor(colortext); |
1434 char *text = mleback->GetText(); | 1434 char *text = mleback->GetCText(); |
1435 | 1435 |
1436 if(text && *text) | 1436 if(text && *text) |
1437 { | 1437 { |
1438 back = ComboboxColor(text); | 1438 back = ComboboxColor(text); |
1439 this->app->Free(text); | 1439 this->app->Free(text); |
1447 char colortext[101] = {0}; | 1447 char colortext[101] = {0}; |
1448 ULONG fore = DW_CLR_DEFAULT, back = DW_CLR_DEFAULT; | 1448 ULONG fore = DW_CLR_DEFAULT, back = DW_CLR_DEFAULT; |
1449 | 1449 |
1450 mleback->GetListText(pos, colortext, 100); | 1450 mleback->GetListText(pos, colortext, 100); |
1451 back = ComboboxColor(colortext); | 1451 back = ComboboxColor(colortext); |
1452 char *text = mlefore->GetText(); | 1452 char *text = mlefore->GetCText(); |
1453 | 1453 |
1454 if(text && *text) | 1454 if(text && *text) |
1455 { | 1455 { |
1456 fore = ComboboxColor(text); | 1456 fore = ComboboxColor(text); |
1457 this->app->Free(text); | 1457 this->app->Free(text); |
1469 return FALSE; | 1469 return FALSE; |
1470 }); | 1470 }); |
1471 | 1471 |
1472 fontsize->ConnectValueChanged([this, fontname, container_mle](int size) -> int | 1472 fontsize->ConnectValueChanged([this, fontname, container_mle](int size) -> int |
1473 { | 1473 { |
1474 char *font = fontname->GetText(); | 1474 char *font = fontname->GetCText(); |
1475 | 1475 |
1476 if(font) | 1476 if(font) |
1477 { | 1477 { |
1478 MLESetFont(container_mle, size, strcmp(font, "Default") == 0 ? NULL : font); | 1478 MLESetFont(container_mle, size, strcmp(font, "Default") == 0 ? NULL : font); |
1479 this->app->Free(font); | 1479 this->app->Free(font); |
1697 | 1697 |
1698 button = new DW::Button("Run"); | 1698 button = new DW::Button("Run"); |
1699 hbox->PackStart(button, FALSE, FALSE, 0); | 1699 hbox->PackStart(button, FALSE, FALSE, 0); |
1700 button->ConnectClicked([this, javascript, html]() -> int | 1700 button->ConnectClicked([this, javascript, html]() -> int |
1701 { | 1701 { |
1702 char *script = javascript->GetText(); | 1702 char *script = javascript->GetCText(); |
1703 | 1703 |
1704 html->JavascriptRun(script); | 1704 html->JavascriptRun(script); |
1705 this->app->Free(script); | 1705 this->app->Free(script); |
1706 return FALSE; | 1706 return FALSE; |
1707 }); | 1707 }); |
1855 #endif | 1855 #endif |
1856 | 1856 |
1857 // Finally try from the platform application directory | 1857 // Finally try from the platform application directory |
1858 if(!foldericon && !fileicon) | 1858 if(!foldericon && !fileicon) |
1859 { | 1859 { |
1860 char *appdir = app->GetDir(); | 1860 char *appdir = app->GetCDir(); |
1861 char pathbuff[1025] = {0}; | 1861 char pathbuff[1025] = {0}; |
1862 int pos = (int)strlen(appdir); | 1862 int pos = (int)strlen(appdir); |
1863 | 1863 |
1864 strncpy(pathbuff, appdir, 1024); | 1864 strncpy(pathbuff, appdir, 1024); |
1865 pathbuff[pos] = DW_DIR_SEPARATOR; | 1865 pathbuff[pos] = DW_DIR_SEPARATOR; |