diff --git a/launcher/.gitignore b/launcher/.gitignore new file mode 100644 index 00000000..2863a0bd --- /dev/null +++ b/launcher/.gitignore @@ -0,0 +1,80 @@ +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ +build/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +Testing diff --git a/launcher/.idea/.gitignore b/launcher/.idea/.gitignore new file mode 100644 index 00000000..13566b81 --- /dev/null +++ b/launcher/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/launcher/.idea/editor.xml b/launcher/.idea/editor.xml new file mode 100644 index 00000000..f16511fa --- /dev/null +++ b/launcher/.idea/editor.xml @@ -0,0 +1,108 @@ + + + + + \ No newline at end of file diff --git a/launcher/.idea/launcher.iml b/launcher/.idea/launcher.iml new file mode 100644 index 00000000..f08604bb --- /dev/null +++ b/launcher/.idea/launcher.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/launcher/.idea/misc.xml b/launcher/.idea/misc.xml new file mode 100644 index 00000000..0b76fe51 --- /dev/null +++ b/launcher/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/launcher/.idea/modules.xml b/launcher/.idea/modules.xml new file mode 100644 index 00000000..1515be04 --- /dev/null +++ b/launcher/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/launcher/.idea/vcs.xml b/launcher/.idea/vcs.xml new file mode 100644 index 00000000..6c0b8635 --- /dev/null +++ b/launcher/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt new file mode 100644 index 00000000..ffa1261d --- /dev/null +++ b/launcher/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.10) +project(launcher) + +if (SANITIZE STREQUAL "YES") + message(WARNING "Enabling sanitizers!") + add_compile_options(-Wall -Wextra -pedantic -Wshadow -Wformat=2 -Wfloat-equal -D_GLIBCXX_DEBUG -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2) + add_compile_options(-fsanitize=address -fsanitize=undefined -fno-sanitize-recover) + add_link_options(-fsanitize=address -fsanitize=undefined -fno-sanitize-recover) +endif () + +if (CMAKE_BUILD_TYPE STREQUAL "Release") + add_compile_options(-flto) + add_link_options(-flto) +endif () + +if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + add_compile_options(-O3) + add_link_options(-O3) +endif () + +find_package(wxWidgets REQUIRED COMPONENTS net core base) +if (wxWidgets_USE_FILE) # not defined in CONFIG mode + include(${wxWidgets_USE_FILE}) +endif () + +add_subdirectory(src) \ No newline at end of file diff --git a/launcher/src/CMakeLists.txt b/launcher/src/CMakeLists.txt new file mode 100644 index 00000000..292298b4 --- /dev/null +++ b/launcher/src/CMakeLists.txt @@ -0,0 +1,7 @@ +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +add_executable(launcher + LauncherApp.cpp +) +target_link_libraries(launcher ${wxWidgets_LIBRARIES}) diff --git a/launcher/src/LauncherApp.cpp b/launcher/src/LauncherApp.cpp new file mode 100644 index 00000000..fd7a9d11 --- /dev/null +++ b/launcher/src/LauncherApp.cpp @@ -0,0 +1,58 @@ +// +// Created by Stepan Usatiuk on 11.07.2024. +// + +// For compilers that don't support precompilation, include "wx/wx.h" +#include "wx/wxprec.h" + +#ifndef WX_PRECOMP +# include "wx/wx.h" +#endif + +#include "wx/notebook.h" + +#include "LauncherApp.h" + +#include "wx/taskbar.h" + +IMPLEMENT_APP(LauncherApp) + +// This is executed upon startup, like 'main()' in non-wxWidgets programs. +bool LauncherApp::OnInit() { + wxFrame* frame = new MainFrame(_T("DHFS Launcher"), wxDefaultPosition); + frame->CreateStatusBar(); + frame->SetStatusText(_T("Hello World")); + frame->Show(true); + SetTopWindow(frame); + + wxTaskBarIcon* tb = new wxTaskBarIcon(); + auto img = new wxImage(32, 32, false); + img->Clear(128); + tb->SetIcon(*(new wxBitmapBundle(*(new wxBitmap(*img)))), "e"); + + return true; +} + +BEGIN_EVENT_TABLE(MainFrame, wxFrame) + EVT_BUTTON(BUTTON_Hello, MainFrame::OnExit) // Tell the OS to run MainFrame::OnExit when +END_EVENT_TABLE() // The button is pressed + +MainFrame::MainFrame(const wxString& title, const wxPoint& pos) + : wxFrame((wxFrame*) NULL, -1, title, pos) { + Notebook = new wxNotebook(this, NOTEBOOK_Main); + + Panel = new wxPanel(Notebook); + Panel2 = new wxPanel(Notebook); + Notebook->AddPage(Panel, "Hello"); + Notebook->AddPage(Panel2, "Hello2"); + + Panel->SetBackgroundColour(wxColour(0xFF0000)); + + HelloWorld = new wxButton(Panel, BUTTON_Hello, _T("Hello World"), + // shows a button on this window + wxDefaultPosition, wxDefaultSize, 0); // with the text "hello World" +} + +void MainFrame::OnExit(wxCommandEvent& event) { + Close(TRUE); +} diff --git a/launcher/src/LauncherApp.h b/launcher/src/LauncherApp.h new file mode 100644 index 00000000..7d019b89 --- /dev/null +++ b/launcher/src/LauncherApp.h @@ -0,0 +1,38 @@ +// +// Created by Stepan Usatiuk on 11.07.2024. +// + +#ifndef HELLOWORLDAPP_H +#define HELLOWORLDAPP_H + +// The HelloWorldApp class. This class shows a window +// containing a statusbar with the text "Hello World" +class LauncherApp : public wxApp { +public: + virtual bool OnInit(); +}; + +class MainFrame : public wxFrame // MainFrame is the class for our window, +{ + // It contains the window and all objects in it +public: + MainFrame(const wxString& title, const wxPoint& pos); + + wxButton* HelloWorld; + wxNotebook* Notebook; + wxPanel *Panel; + wxPanel *Panel2; + + void OnExit(wxCommandEvent& event); + + DECLARE_EVENT_TABLE() +}; + +enum { + BUTTON_Hello = wxID_HIGHEST + 1, // declares an id which will be used to call our button + NOTEBOOK_Main = wxID_HIGHEST + 2 // declares an id which will be used to call our button +}; + +DECLARE_APP(LauncherApp) + +#endif //HELLOWORLDAPP_H