diff --git a/.vscode/settings.json b/.vscode/settings.json index 17dc76d..2cad951 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,7 +7,7 @@ "console": "integratedTerminal" }, "cmake.environment": { - "PATH": "${env:PATH};C:\\binary\\wxWidgets-3.2.4\\lib\\vc_x64_dll" + "PATH": "${env:PATH};C:/dev/wxWidgets/lib/vc_x64_dll" }, "cmake.options.statusBarVisibility": "visible", "cmake.generator": "Ninja", diff --git a/CMakeLists.txt b/CMakeLists.txt index afa1cab..73aff4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.8) project (wxWidgetStudy) set(CMAKE_CXX_STANDARD 11) -set(CMAKE_PREFIX_PATH "C:\\binary\\wxWidgets-3.2.4") +set(CMAKE_PREFIX_PATH "C:/dev/wxWidgets") if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() @@ -15,9 +15,12 @@ endif() find_package(wxWidgets REQUIRED COMPONENTS core base) include(${wxWidgets_USE_FILE}) +add_subdirectory(console) + add_executable(wxWidgetStudy main.cpp) add_executable(wxEvent event_binary.cpp src/event_demo.cpp) add_executable(wxWindowSign window_sign_bin.cpp src/window_sign.cpp) + target_link_libraries(wxWidgetStudy PRIVATE ${wxWidgets_LIBRARIES}) target_link_libraries(wxEvent PRIVATE ${wxWidgets_LIBRARIES}) target_link_libraries(wxWindowSign PRIVATE ${wxWidgets_LIBRARIES}) diff --git a/console/CMakeLists.txt b/console/CMakeLists.txt new file mode 100644 index 0000000..88c07e4 --- /dev/null +++ b/console/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required (VERSION 3.8) +project (wxConsole) +set(CMAKE_CXX_STANDARD 11) + +add_executable(wxConsole demo.cpp demo.h main.cpp) +target_link_libraries(wxConsole PRIVATE ${wxWidgets_LIBRARIES}) \ No newline at end of file diff --git a/console/demo.cpp b/console/demo.cpp new file mode 100644 index 0000000..8aafdc8 --- /dev/null +++ b/console/demo.cpp @@ -0,0 +1,25 @@ +#include "demo.h" + +void demoA() +{ + // 分割字符示例 + wxString demo_str("Java,Cpp"); + wxStringTokenizer token(demo_str, ","); + std::vector vec; + while (token.HasMoreTokens()) { + vec.push_back(token.GetNextToken().ToStdString()); + } + + // 拼接字符串 + demo_str.Append("php, 中文。"); + + // 大小写转换 + wxString upper = demo_str.Upper(); + std::cout << upper << std::endl; + std::cout << demo_str << std::endl; + + // 包含 + if (demo_str.Contains("Cpp")) { + std::cout << "contains." << std::endl; + } +} \ No newline at end of file diff --git a/console/demo.h b/console/demo.h new file mode 100644 index 0000000..c4d1388 --- /dev/null +++ b/console/demo.h @@ -0,0 +1,11 @@ +#ifndef WX_DEMO_HEADER +#define WX_DEMO_HEADER + +#include +#include +#include + +void demoA(); + + +#endif \ No newline at end of file diff --git a/console/main.cpp b/console/main.cpp new file mode 100644 index 0000000..a3e6f14 --- /dev/null +++ b/console/main.cpp @@ -0,0 +1,8 @@ +#include +#include "demo.h" + +int main() +{ + demoA(); + return 0; +} \ No newline at end of file