mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
initial wxWidgets sample
This commit is contained in:
7
samples/CPlusPlusWidgets/.gitignore
vendored
Normal file
7
samples/CPlusPlusWidgets/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
build
|
||||
build-dbg
|
||||
.DS_Store
|
||||
cmake-build-debug
|
||||
cmake-build-release
|
||||
.vscode
|
||||
.idea
|
||||
36
samples/CPlusPlusWidgets/CMakeLists.txt
Normal file
36
samples/CPlusPlusWidgets/CMakeLists.txt
Normal file
@@ -0,0 +1,36 @@
|
||||
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
|
||||
|
||||
project(VelopackCppWidgetsSample LANGUAGES CXX)
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(wxBUILD_SHARED OFF)
|
||||
|
||||
message(STATUS "Fetching wxWidgets...")
|
||||
|
||||
FetchContent_Declare(
|
||||
wxWidgets
|
||||
GIT_REPOSITORY https://github.com/wxWidgets/wxWidgets.git
|
||||
GIT_SHALLOW ON
|
||||
)
|
||||
FetchContent_MakeAvailable(wxWidgets)
|
||||
|
||||
set(SRCS main.cpp)
|
||||
|
||||
if(APPLE)
|
||||
# create bundle on apple compiles
|
||||
add_executable(main MACOSX_BUNDLE ${SRCS})
|
||||
|
||||
# Set a custom plist file for the app bundle - needed for Mac OS Retina display
|
||||
set_target_properties(main PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
|
||||
else()
|
||||
# the WIN32 is needed for Windows in order for it to look for WinMain
|
||||
# instead of the main function. This is ignored on other systems,
|
||||
# so it works on all platforms
|
||||
add_executable(main WIN32 ${SRCS} main.exe.manifest)
|
||||
endif()
|
||||
|
||||
target_link_libraries(main PRIVATE wxcore wxnet)
|
||||
28
samples/CPlusPlusWidgets/main.cpp
Normal file
28
samples/CPlusPlusWidgets/main.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include <wx/wx.h>
|
||||
|
||||
class MyApp : public wxApp
|
||||
{
|
||||
public:
|
||||
virtual bool OnInit();
|
||||
};
|
||||
|
||||
class MyFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
|
||||
};
|
||||
|
||||
wxIMPLEMENT_APP(MyApp);
|
||||
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
MyFrame* frame = new MyFrame("Hello Everyone!", wxDefaultPosition, wxDefaultSize);
|
||||
frame->Show(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
: wxFrame(NULL, wxID_ANY, title, pos, size)
|
||||
{
|
||||
new wxStaticText(this, wxID_ANY, "Good Morning!"); // no need to delete - the parent will do it automatically
|
||||
}
|
||||
9
samples/CPlusPlusWidgets/main.exe.manifest
Normal file
9
samples/CPlusPlusWidgets/main.exe.manifest
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
Reference in New Issue
Block a user