From a3a62396a9474aa7dcc5b4ca86ffd68ee91a7cf6 Mon Sep 17 00:00:00 2001 From: Chris Blume Date: Thu, 15 Sep 2022 11:14:47 -0400 Subject: [PATCH 01/13] Add initial Linux implementation This commit starts adding Linux support to maxGUI. It is still very broken (only supporting some things, and not completely). But it paves the path for those things to be added. --- .../EntryPoint.cpp | 2 +- .../EntryPoint.cpp | 0 .../EntryPoint.cpp | 0 .../EntryPoint.cpp | 0 Code/maxGUI/Control.hpp | 6 +- Code/maxGUI/EntryPoint.cpp | 66 ++++++++++++------- Code/maxGUI/EntryPoint.hpp | 46 +++++++------ Code/maxGUI/Form.cpp | 49 +++++++++++++- Code/maxGUI/Form.hpp | 53 +++++++++++++-- Code/maxGUI/Form.inl | 30 ++++++++- Code/maxGUI/MultilineTextBox.cpp | 24 ++++++- Code/maxGUI/MultilineTextBox.hpp | 23 ++++++- Code/maxGUI/ProgressBar.cpp | 33 +++++++++- Code/maxGUI/ProgressBar.hpp | 22 ++++++- Projects/Clang X86 Make/Makefile | 31 ++++++--- Projects/Clang X86-64 Make/Makefile | 31 ++++++--- Projects/GCC X86 Make/Makefile | 31 ++++++--- Projects/GCC X86-64 Make/Makefile | 25 ++++--- 18 files changed, 376 insertions(+), 96 deletions(-) rename Code/Examples/{1 - SimpleExample => 1-SimpleExample}/EntryPoint.cpp (99%) rename Code/Examples/{2 - StylingExample => 2-StylingExample}/EntryPoint.cpp (100%) rename Code/Examples/{3 - ControlGalleryExample => 3-ControlGalleryExample}/EntryPoint.cpp (100%) rename Code/Examples/{4 - CustomPaintingExample => 4-CustomPaintingExample}/EntryPoint.cpp (100%) diff --git a/Code/Examples/1 - SimpleExample/EntryPoint.cpp b/Code/Examples/1-SimpleExample/EntryPoint.cpp similarity index 99% rename from Code/Examples/1 - SimpleExample/EntryPoint.cpp rename to Code/Examples/1-SimpleExample/EntryPoint.cpp index 348938c..317b313 100644 --- a/Code/Examples/1 - SimpleExample/EntryPoint.cpp +++ b/Code/Examples/1-SimpleExample/EntryPoint.cpp @@ -47,4 +47,4 @@ int maxGUIEntryPoint(maxGUI::FormContainer form_container) noexcept { // The message pump will loop until we call maxGUI::PostExitMessage(), which is the default behavior // when a form is closed. return maxGUI::MessagePump(form_container); -} \ No newline at end of file +} diff --git a/Code/Examples/2 - StylingExample/EntryPoint.cpp b/Code/Examples/2-StylingExample/EntryPoint.cpp similarity index 100% rename from Code/Examples/2 - StylingExample/EntryPoint.cpp rename to Code/Examples/2-StylingExample/EntryPoint.cpp diff --git a/Code/Examples/3 - ControlGalleryExample/EntryPoint.cpp b/Code/Examples/3-ControlGalleryExample/EntryPoint.cpp similarity index 100% rename from Code/Examples/3 - ControlGalleryExample/EntryPoint.cpp rename to Code/Examples/3-ControlGalleryExample/EntryPoint.cpp diff --git a/Code/Examples/4 - CustomPaintingExample/EntryPoint.cpp b/Code/Examples/4-CustomPaintingExample/EntryPoint.cpp similarity index 100% rename from Code/Examples/4 - CustomPaintingExample/EntryPoint.cpp rename to Code/Examples/4-CustomPaintingExample/EntryPoint.cpp diff --git a/Code/maxGUI/Control.hpp b/Code/maxGUI/Control.hpp index f66a6e3..0632589 100644 --- a/Code/maxGUI/Control.hpp +++ b/Code/maxGUI/Control.hpp @@ -14,6 +14,8 @@ #define WIN32_LEAN_AND_MEAN #endif #include +#elif defined(MAX_PLATFORM_LINUX) + #include #endif namespace maxGUI @@ -53,6 +55,8 @@ namespace maxGUI #if defined(MAX_PLATFORM_WINDOWS) virtual std::unique_ptr CreateControl(HWND parent_window_handle) const noexcept = 0; +#elif defined(MAX_PLATFORM_LINUX) + virtual std::unique_ptr CreateControl(QWidget* parent_window) const noexcept = 0; #endif Rectangle rectangle_; @@ -61,4 +65,4 @@ namespace maxGUI } // namespace maxGUI -#endif // #ifndef MAXGUI_CONTROL_HPP \ No newline at end of file +#endif // #ifndef MAXGUI_CONTROL_HPP diff --git a/Code/maxGUI/EntryPoint.cpp b/Code/maxGUI/EntryPoint.cpp index 5de73c9..bbfd4ea 100644 --- a/Code/maxGUI/EntryPoint.cpp +++ b/Code/maxGUI/EntryPoint.cpp @@ -4,42 +4,62 @@ #include -int -#if !defined(_MAC) -#if defined(_M_CEE_PURE) -__clrcall -#else -WINAPI +#if defined(MAX_PLATFORM_LINUX) + #include #endif -#else -CALLBACK + +#if defined(MAX_PLATFORM_WINDOWS) + int + #if !defined(_MAC) + #if defined(_M_CEE_PURE) + __clrcall + #else + WINAPI + #endif + #else + CALLBACK + #endif + WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE /*hPrevInstance*/, _In_ LPSTR /*lpCmdLine*/, _In_ int /*nShowCmd*/) + { + return maxGUIEntryPoint(maxGUI::FormContainer(hInstance)); + } +#elif defined(MAX_PLATFORM_LINUX) + int main(int argc, char** argv) { + QApplication app(argc, argv); + return maxGUIEntryPoint(maxGUI::FormContainer(&app)); + } #endif -WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE /*hPrevInstance*/, _In_ LPSTR /*lpCmdLine*/, _In_ int /*nShowCmd*/) -{ - return maxGUIEntryPoint(maxGUI::FormContainer(hInstance)); -} namespace maxGUI { void PostExitMessage(const int exit_code) noexcept { +#if defined(MAX_PLATFORM_WINDOWS) PostQuitMessage(exit_code); +#elif defined(MAX_PLATFORM_LINUX) + // TODO: Can we do this with Qt? + (void)exit_code; +#endif } int MessagePump(const FormContainer& form_container) noexcept { - MSG Message = {0}; - while (GetMessage(&Message, NULL, 0, 0) > 0) - { - for (const auto& form : form_container.forms_) { - if (IsDialogMessage(form->window_handle_, &Message) == 0) - { - //TranslateAccelerator - TranslateMessage(&Message); - DispatchMessage(&Message); + #if defined(MAX_PLATFORM_WINDOWS) + MSG Message = {0}; + while (GetMessage(&Message, NULL, 0, 0) > 0) + { + for (const auto& form : form_container.forms_) { + if (IsDialogMessage(form->window_handle_, &Message) == 0) + { + //TranslateAccelerator + TranslateMessage(&Message); + DispatchMessage(&Message); + } } } - } - return static_cast(Message.wParam); + return static_cast(Message.wParam); + #elif defined(MAX_PLATFORM_LINUX) + return form_container.app_->exec(); + #endif } } // namespace maxGUI diff --git a/Code/maxGUI/EntryPoint.hpp b/Code/maxGUI/EntryPoint.hpp index 77c44f7..2f8c6da 100644 --- a/Code/maxGUI/EntryPoint.hpp +++ b/Code/maxGUI/EntryPoint.hpp @@ -5,33 +5,39 @@ #ifndef MAXGUI_ENTRYPOINT_HPP #define MAXGUI_ENTRYPOINT_HPP +#include #include -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -// This instructs Microsoft Visual C++ 2005 and later to use ComCtl32.dll version 6. -// That gives the modern visual styles. -#pragma comment(linker,"\"/manifestdependency:type='win32' \ -name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \ -processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") +#if defined(MAX_PLATFORM_WINDOWS) + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif + #include + + // This instructs Microsoft Visual C++ 2005 and later to use ComCtl32.dll version 6. + // That gives the modern visual styles. + #pragma comment(linker,"\"/manifestdependency:type='win32' \ + name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \ + processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") +#endif // The user should implement this function. // maxGUI calls this when the program begins. int maxGUIEntryPoint(maxGUI::FormContainer form_container) noexcept; -int -#if !defined(_MAC) -#if defined(_M_CEE_PURE) -__clrcall -#else -WINAPI -#endif -#else -CALLBACK +#if defined(MAX_PLATFORM_WINDOWS) + int + #if !defined(_MAC) + #if defined(_M_CEE_PURE) + __clrcall + #else + WINAPI + #endif + #else + CALLBACK + #endif + WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nShowCmd); #endif -WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nShowCmd); namespace maxGUI { @@ -40,4 +46,4 @@ namespace maxGUI { } // namespace maxGUI -#endif // #ifndef MAXGUI_ENTRYPOINT_HPP \ No newline at end of file +#endif // #ifndef MAXGUI_ENTRYPOINT_HPP diff --git a/Code/maxGUI/Form.cpp b/Code/maxGUI/Form.cpp index d0377f5..485030c 100644 --- a/Code/maxGUI/Form.cpp +++ b/Code/maxGUI/Form.cpp @@ -4,9 +4,14 @@ #include #include -#include + +#if defined(MAX_PLATFORM_WINDOWS) + #include +#endif + #include +#if defined(MAX_PLATFORM_WINDOWS) namespace { static LPCTSTR maxgui_window_class_name = TEXT("maxGUI Window Class"); @@ -114,28 +119,59 @@ namespace { } } // anonymous namespace +#endif namespace maxGUI { +#if defined(MAX_PLATFORM_WINDOWS) FormConcept::FormConcept(HWND window_handle) noexcept : window_handle_(std::move(window_handle)) {} +#elif defined(MAX_PLATFORM_LINUX) + FormConcept::FormConcept(int height, int width, std::string title, FormStyles styles) noexcept + : window_() + { + window_.setFixedSize(width, height); + + // TODO: Set the title & styles + (void)title; + (void)styles; + + // TODO: Ideally, once all controls are added the form will be shown. + //window_.show(); + } +#endif Control* FormConcept::AddControl(const ControlFactory* control_factory) noexcept { +#if defined(MAX_PLATFORM_WINDOWS) std::unique_ptr control_ptr = control_factory->CreateControl(window_handle_); +#elif defined(MAX_PLATFORM_LINUX) + std::unique_ptr control_ptr = control_factory->CreateControl(&window_); +#endif Control* raw_control_ptr = control_ptr.get(); controls_.push_back(std::move(control_ptr)); +#if defined(MAX_PLATFORM_LINUX) + // TODO: We should only show after all controls are added. + window_.show(); +#endif return raw_control_ptr; } +#if defined(MAX_PLATFORM_WINDOWS) FormContainer::FormContainer(HINSTANCE instance_handle) noexcept : instance_handle_(instance_handle) {} +#elif defined(MAX_PLATFORM_LINUX) + FormContainer::FormContainer(QApplication* app) noexcept + : app_(std::move(app)) + {} +#endif FormFactory::FormFactory(std::unique_ptr form_allocator) noexcept : form_allocator_(std::move(form_allocator)) {} +#if defined(MAX_PLATFORM_WINDOWS) bool FormFactory::CreateForm(HINSTANCE instance_handle, int height, int width, std::string title, FormStyles styles) noexcept { WNDCLASSEX wcx = {0}; wcx.cbSize = sizeof(wcx); @@ -212,5 +248,14 @@ namespace maxGUI { return true; } +#elif defined(MAX_PLATFORM_LINUX) + bool FormFactory::CreateForm(int height, int width, std::string title, FormStyles styles) noexcept { + std::unique_ptr created_form = form_allocator_->AllocateForm(std::move(height), std::move(width), std::move(title), std::move(styles)); + FormConcept* form = created_form.get(); + form_container_->forms_.push_back(std::move(created_form)); + form->OnCreated(form); + return true; + } +#endif -} // namespace maxGUI \ No newline at end of file +} // namespace maxGUI diff --git a/Code/maxGUI/Form.hpp b/Code/maxGUI/Form.hpp index 4a04a00..b85f5b2 100644 --- a/Code/maxGUI/Form.hpp +++ b/Code/maxGUI/Form.hpp @@ -5,16 +5,22 @@ #ifndef MAXGUI_FORM_HPP #define MAXGUI_FORM_HPP +#include #include #include #include #include #include #include -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN + +#if defined(MAX_PLATFORM_WINDOWS) + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif + #include +#elif defined(MAX_PLATFORM_LINUX) + #include #endif -#include namespace maxGUI { @@ -35,18 +41,28 @@ namespace maxGUI class FormConcept { public: +#if defined(MAX_PLATFORM_WINDOWS) explicit FormConcept(HWND window_handle) noexcept; +#elif defined(MAX_PLATFORM_LINUX) + FormConcept(int height, int width, std::string title, FormStyles styles) noexcept; +#endif virtual ~FormConcept() noexcept = default; virtual void OnResized(FormConcept* form, int height, int width) noexcept = 0; virtual void OnClosed(FormConcept* form) noexcept = 0; virtual void OnCreated(FormConcept* form) noexcept = 0; +#if defined(MAX_PLATFORM_WINDOWS) virtual LRESULT OnWindowMessage(FormConcept* form, UINT message, WPARAM wparam, LPARAM lparam) noexcept = 0; +#endif // TODO: Can this be templated so the factories don't need to be templated? Control* AddControl(const ControlFactory* control_factory) noexcept; +#if defined(MAX_PLATFORM_WINDOWS) HWND window_handle_; +#elif defined(MAX_PLATFORM_LINUX) + QWidget window_; +#endif std::vector> controls_; }; @@ -55,13 +71,19 @@ namespace maxGUI class FormModel : public FormConcept { public: +#if defined(MAX_PLATFORM_WINDOWS) FormModel(std::unique_ptr form, HWND window_handle) noexcept; +#elif defined(MAX_PLATFORM_LINUX) + FormModel(std::unique_ptr form, int height, int width, std::string title, FormStyles styles) noexcept; +#endif ~FormModel() noexcept override = default; void OnResized(FormConcept* form, int height, int width) noexcept override; void OnClosed(FormConcept* form) noexcept override; void OnCreated(FormConcept* form) noexcept override; +#if defined(MAX_PLATFORM_WINDOWS) LRESULT OnWindowMessage(FormConcept* form, UINT message, WPARAM wparam, LPARAM lparam) noexcept override; +#endif private: @@ -74,7 +96,11 @@ namespace maxGUI virtual ~FormAllocatorConcept() noexcept = default; +#if defined(MAX_PLATFORM_WINDOWS) virtual std::unique_ptr AllocateForm(HWND window_handle) noexcept = 0; +#elif defined(MAX_PLATFORM_LINUX) + virtual std::unique_ptr AllocateForm(int height, int width, std::string title, FormStyles styles) noexcept = 0; +#endif }; @@ -83,7 +109,11 @@ namespace maxGUI public: virtual ~FormAllocatorModel() noexcept override = default; +#if defined(MAX_PLATFORM_WINDOWS) std::unique_ptr AllocateForm(HWND window_handle) noexcept override; +#elif defined(MAX_PLATFORM_LINUX) + std::unique_ptr AllocateForm(int height, int width, std::string title, FormStyles styles) noexcept override; +#endif }; @@ -93,7 +123,11 @@ namespace maxGUI class FormContainer { public: +#if defined(MAX_PLATFORM_WINDOWS) explicit FormContainer(HINSTANCE instance_handle) noexcept; +#elif defined(MAX_PLATFORM_LINUX) + explicit FormContainer(QApplication* app) noexcept; +#endif template bool CreateForm(FormFactoryType& form_factory, int height, int width, std::string title) noexcept; @@ -102,7 +136,12 @@ namespace maxGUI bool CreateForm(FormFactoryType& form_factory, int height, int width, std::string title, FormStyles styles) noexcept; std::vector> forms_; + +#if defined(MAX_PLATFORM_WINDOWS) HINSTANCE instance_handle_; +#elif defined(MAX_PLATFORM_LINUX) + QApplication* app_; +#endif }; @@ -114,9 +153,13 @@ namespace maxGUI FormFactory(const FormFactory& rhs) = delete; FormFactory& operator =(const FormFactory& rhs) = delete; +#if defined(MAX_PLATFORM_WINDOWS) bool CreateForm(HINSTANCE instance_handle, int height, int width, std::string title, FormStyles styles) noexcept; +#elif defined(MAX_PLATFORM_LINUX) + bool CreateForm(int height, int width, std::string title, FormStyles style) noexcept; +#endif - // This is set by FormContainer::CreateForm() and needs to remain set until WM_CREATE is received + // On Windows, this is set by FormContainer::CreateForm() and needs to remain set until WM_CREATE is received FormContainer* form_container_ = nullptr; std::unique_ptr form_allocator_; @@ -126,4 +169,4 @@ namespace maxGUI #include -#endif // #ifndef MAXGUI_FORM_HPP \ No newline at end of file +#endif // #ifndef MAXGUI_FORM_HPP diff --git a/Code/maxGUI/Form.inl b/Code/maxGUI/Form.inl index 2fdc2f1..7b07dfc 100644 --- a/Code/maxGUI/Form.inl +++ b/Code/maxGUI/Form.inl @@ -4,7 +4,11 @@ #include #include -#include + +#if defined(MAX_PLATFORM_WINDOWS) + #include +#endif + #include namespace { @@ -61,11 +65,19 @@ namespace { namespace maxGUI { +#if defined(MAX_PLATFORM_WINDOWS) template FormModel::FormModel(std::unique_ptr form, HWND window_handle) noexcept : FormConcept(std::move(window_handle)) , form_(std::move(form)) {} +#elif defined(MAX_PLATFORM_LINUX) + template + FormModel::FormModel(std::unique_ptr form, int height, int width, std::string title, FormStyles styles) noexcept + : FormConcept(std::move(height), std::move(width), std::move(title), std::move(styles)) + , form_(std::move(form)) + {} +#endif template void FormModel::OnResized(FormConcept* form, int height, int width) noexcept { @@ -91,6 +103,7 @@ namespace maxGUI { } } +#if defined(MAX_PLATFORM_WINDOWS) template LRESULT FormModel::OnWindowMessage(FormConcept* form, UINT message, WPARAM wparam, LPARAM lparam) noexcept { //if (HasOnWindowMessage::value) { @@ -100,6 +113,7 @@ namespace maxGUI { return DefWindowProc(window_handle_, message, wparam, lparam); } } +#endif template bool FormContainer::CreateForm(FormFactoryType& form_factory, int height, int width, std::string title) noexcept { @@ -109,14 +123,26 @@ namespace maxGUI { template bool FormContainer::CreateForm(FormFactoryType& form_factory, int height, int width, std::string title, FormStyles styles) noexcept { form_factory.form_container_ = this; +#if defined(MAX_PLATFORM_WINDOWS) return form_factory.CreateForm(instance_handle_, std::move(height), std::move(width), std::move(title), std::move(styles)); +#elif defined(MAX_PLATFORM_LINUX) + return form_factory.CreateForm(std::move(height), std::move(width), std::move(title), std::move(styles)); +#endif } +#if defined(MAX_PLATFORM_WINDOWS) template std::unique_ptr FormAllocatorModel::AllocateForm(HWND window_handle) noexcept { auto form = std::make_unique(); return std::make_unique>(std::move(form), window_handle); } +#elif defined(MAX_PLATFORM_LINUX) + template + std::unique_ptr FormAllocatorModel::AllocateForm(int height, int width, std::string title, FormStyles styles) noexcept { + auto form = std::make_unique(); + return std::make_unique>(std::move(form), std::move(height), std::move(width), std::move(title), std::move(styles)); + } +#endif template std::unique_ptr GetDefaultFormAllocator() noexcept { @@ -124,4 +150,4 @@ namespace maxGUI { } -} // namespace maxGUI \ No newline at end of file +} // namespace maxGUI diff --git a/Code/maxGUI/MultilineTextBox.cpp b/Code/maxGUI/MultilineTextBox.cpp index 3efc3a9..6d38bc1 100644 --- a/Code/maxGUI/MultilineTextBox.cpp +++ b/Code/maxGUI/MultilineTextBox.cpp @@ -4,16 +4,28 @@ #include -#include +#if defined(MAX_PLATFORM_WINDOWS) + #include +#endif + #include namespace maxGUI { +#if defined(MAX_PLATFORM_WINDOWS) MultilineTextBox::MultilineTextBox(HWND window_handle) noexcept : ControlWithText(std::move(window_handle)) {} +#elif defined(MAX_PLATFORM_LINUX) + MultilineTextBox::MultilineTextBox(QTextEdit* widget) noexcept + : ControlWithText() + { + (void)widget; + } +#endif +#if defined(MAX_PLATFORM_WINDOWS) HWND MultilineTextBoxFactoryImplementationDetails::CreateMultilineTextBox(std::string text, Rectangle rectangle, MultilineTextBoxStyles styles, HWND parent_window_handle) noexcept { DWORD win32_styles = WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP | ES_MULTILINE | ES_WANTRETURN | ES_AUTOVSCROLL | ES_AUTOHSCROLL; // MSVC at warning level 4 issues C26813 because it wants "if (styles & ButtonStyles::Default) {" @@ -28,5 +40,13 @@ namespace maxGUI Win32String win32_text = Utf8ToWin32String(std::move(text)); return CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("EDIT"), win32_text.text_, win32_styles, rectangle.left_, rectangle.top_, rectangle.width_, rectangle.height_, parent_window_handle, NULL, reinterpret_cast(GetWindowLongPtr(parent_window_handle, GWLP_HINSTANCE)), NULL); } +#elif defined(MAX_PLATFORM_LINUX) + QTextEdit* MultilineTextBoxFactoryImplementationDetails::CreateMultilineTextBox(std::string text, Rectangle rectangle, MultilineTextBoxStyles styles, QWidget* parent_window) noexcept { + QTextEdit* multiline_textbox = new QTextEdit(text.c_str(), parent_window); + multiline_textbox->setGeometry(rectangle.left_, rectangle.top_, rectangle.width_, rectangle.height_); + // TODO: Handle MultilineTextBoxStyles styles + return multiline_textbox; + } +#endif -} // namespace maxGUI \ No newline at end of file +} // namespace maxGUI diff --git a/Code/maxGUI/MultilineTextBox.hpp b/Code/maxGUI/MultilineTextBox.hpp index f62122d..5b8a3bb 100644 --- a/Code/maxGUI/MultilineTextBox.hpp +++ b/Code/maxGUI/MultilineTextBox.hpp @@ -5,12 +5,17 @@ #ifndef MAXGUI_MULTILINETEXTBOX_HPP #define MAXGUI_MULTILINETEXTBOX_HPP +#include #include #include #include #include #include +#if defined(MAX_PLATFORM_LINUX) + #include +#endif + namespace maxGUI { @@ -30,8 +35,11 @@ namespace maxGUI { public: +#if defined(MAX_PLATFORM_WINDOWS) explicit MultilineTextBox(HWND window_handle) noexcept; - +#elif defined(MAX_PLATFORM_LINUX) + explicit MultilineTextBox(QTextEdit* widget) noexcept; +#endif ~MultilineTextBox() noexcept override = default; }; @@ -40,7 +48,11 @@ namespace maxGUI { public: +#if defined(MAX_PLATFORM_WINDOWS) static HWND CreateMultilineTextBox(std::string text, Rectangle rectangle, MultilineTextBoxStyles styles, HWND parent_window_handle) noexcept; +#elif defined(MAX_PLATFORM_LINUX) + static QTextEdit* CreateMultilineTextBox(std::string text, Rectangle rectangle, MultilineTextBoxStyles styles, QWidget* parent_window) noexcept; +#endif }; @@ -60,10 +72,17 @@ namespace maxGUI ~MultilineTextBoxFactory() noexcept override = default; +#if defined(MAX_PLATFORM_WINDOWS) std::unique_ptr CreateControl(HWND parent_window_handle) const noexcept override { HWND window_handle = MultilineTextBoxFactoryImplementationDetails::CreateMultilineTextBox(text_, rectangle_, styles_, parent_window_handle); return std::make_unique(std::move(window_handle)); } +#elif defined(MAX_PLATFORM_LINUX) + std::unique_ptr CreateControl(QWidget* parent_window) const noexcept override { + QTextEdit* widget = MultilineTextBoxFactoryImplementationDetails::CreateMultilineTextBox(text_, rectangle_, styles_, parent_window); + return std::make_unique(std::move(widget)); + } +#endif private: @@ -73,4 +92,4 @@ namespace maxGUI } // namespace maxGUI -#endif // #ifndef MAXGUI_MULTILINETEXTBOX_HPP \ No newline at end of file +#endif // #ifndef MAXGUI_MULTILINETEXTBOX_HPP diff --git a/Code/maxGUI/ProgressBar.cpp b/Code/maxGUI/ProgressBar.cpp index 5aeb02e..161639b 100644 --- a/Code/maxGUI/ProgressBar.cpp +++ b/Code/maxGUI/ProgressBar.cpp @@ -4,34 +4,53 @@ #include -#include +#if defined(MAX_PLATFORM_WINDOWS) + #include +#endif namespace maxGUI { +#if defined(MAX_PLATFORM_WINDOWS) ProgressBar::ProgressBar(HWND window_handle) noexcept : Control(std::move(window_handle)) {} +#elif defined(MAX_PLATFORM_LINUX) + ProgressBar::ProgressBar(QProgressBar* widget) noexcept + : Control() + {} +#endif void ProgressBar::SetRange(int min, int max) noexcept { +#if defined(MAX_PLATFORM_WINDOWS) SendMessage(window_handle_, PBM_SETRANGE32, static_cast(min), static_cast(max)); +#endif } void ProgressBar::GetRange(int& min, int& max) noexcept { +#if defined(MAX_PLATFORM_WINDOWS) PBRANGE range = {0}; SendMessage(window_handle_, PBM_GETRANGE, TRUE, reinterpret_cast(&range)); min = range.iLow; max = range.iHigh; +#endif } void ProgressBar::SetValue(int value) noexcept { +#if defined(MAX_PALTFORM_WINDOWS) SendMessage(window_handle_, PBM_SETPOS, static_cast(value), 0); +#endif } int ProgressBar::GetValue() noexcept { +#if defined(MAX_PLATFORM_WINDOWS) return static_cast(SendMessage(window_handle_, PBM_GETPOS, 0, 0)); +#elif defined(MAX_PLATFORM_LINUX) + return 0; +#endif } +#if defined(MAX_PLATFORM_WINDOWS) HWND ProgressBarFactoryImplementationDetails::CreateProgressBar(Rectangle rectangle, int min, int max, int value, ProgressBarStyles styles, HWND parent_window_handle) noexcept { DWORD win32_styles = WS_CHILD | WS_VISIBLE; // MSVC at warning level 4 issues C26813 because it wants "if (styles & ButtonStyles::Default) {" @@ -53,5 +72,15 @@ namespace maxGUI return window_handle; } +#elif defined(MAX_PLATFORM_LINUX) + QProgressBar* ProgressBarFactoryImplementationDetails::CreateProgressBar(Rectangle rectangle, int min, int max, int value, ProgressBarStyles styles, QWidget* parent_window) noexcept { + QProgressBar* progress_bar = new QProgressBar(parent_window); + progress_bar->setGeometry(rectangle.left_, rectangle.top_, rectangle.width_, rectangle.height_); + progress_bar->setRange(min, max); + progress_bar->setValue(value); + // TODO: Handle ProgressBarStyles styles + return progress_bar; + } +#endif -} // namespace maxGUI \ No newline at end of file +} // namespace maxGUI diff --git a/Code/maxGUI/ProgressBar.hpp b/Code/maxGUI/ProgressBar.hpp index c91853d..9cd9b78 100644 --- a/Code/maxGUI/ProgressBar.hpp +++ b/Code/maxGUI/ProgressBar.hpp @@ -5,11 +5,16 @@ #ifndef MAXGUI_PROGRESSBAR_HPP #define MAXGUI_PROGRESSBAR_HPP +#include #include #include #include #include +#if defined(MAX_PLATFORM_LINUX) + #include +#endif + namespace maxGUI { @@ -30,7 +35,11 @@ namespace maxGUI { public: +#if defined(MAX_PLATFORM_WINDOWS) explicit ProgressBar(HWND window_handle) noexcept; +#elif defined(MAX_PLATFORM_LINUX) + explicit ProgressBar(QProgressBar* widget) noexcept; +#endif ~ProgressBar() noexcept override = default; @@ -45,7 +54,11 @@ namespace maxGUI { public: +#if defined(MAX_PLATFORM_WINDOWS) static HWND CreateProgressBar(Rectangle rectangle, int min, int max, int value, ProgressBarStyles styles, HWND parent_window_handle) noexcept; +#elif defiend(MAX_PLATFORM_LINUX) + static QProgressBar* CreateProgressBar(Rectangle rectangle, int min, int max, int value, ProgressBarStyles styles, QWidget* parent_window) noexcept; +#endif }; @@ -68,10 +81,17 @@ namespace maxGUI ~ProgressBarFactory() noexcept override = default; +#if defined(MAX_PLATFORM_WINDOWS) std::unique_ptr CreateControl(HWND parent_window_handle) const noexcept override { HWND window_handle = ProgressBarFactoryImplementationDetails::CreateProgressBar(rectangle_, min_, max_, value_, styles_, std::move(parent_window_handle)); return std::make_unique(std::move(window_handle)); } +#elif defined(MAX_PLATFORM_LINUX) + std::unique_ptr CreateControl(QWidget* parent_window) const noexcept override { + QProgressBar* progress_bar = ProgressBarFactoryImplementationDetails::CreateProgressBar(rectangle_, min_, max_, value_, styles_, std::move(parent_window)); + return std::make_unique(std::move(progress_bar)); + } +#endif int min_; int max_; @@ -82,4 +102,4 @@ namespace maxGUI } // namespace maxGUI -#endif // #ifndef MAXGUI_PROGRESSBAR_HPP \ No newline at end of file +#endif // #ifndef MAXGUI_PROGRESSBAR_HPP diff --git a/Projects/Clang X86 Make/Makefile b/Projects/Clang X86 Make/Makefile index 13f967d..74ed99d 100644 --- a/Projects/Clang X86 Make/Makefile +++ b/Projects/Clang X86 Make/Makefile @@ -2,25 +2,29 @@ PROGRAM_NAME = maxGUI CXX_SRCS = \ ../../Code/maxGUI/Button.cpp \ ../../Code/maxGUI/Control.cpp \ - ../../Code/maxGUI/ControlWithText.cpp + ../../Code/maxGUI/ControlWithText.cpp \ + ../../Code/maxGUI/EntryPoint.cpp \ + ../../Code/maxGUI/Form.cpp \ + ../../Code/maxGUI/MultilineTextBox.cpp \ + ../../Code/maxGUI/Rectangle.cpp #../../Code/maxGUI/CheckBox.cpp \ #../../Code/maxGUI/ControlWithList.cpp \ #../../Code/maxGUI/DropDownBox.cpp \ - #../../Code/maxGUI/EntryPoint.cpp \ - #../../Code/maxGUI/Form.cpp \ #../../Code/maxGUI/Frame.cpp \ #../../Code/maxGUI/Label.cpp \ #../../Code/maxGUI/ListBox.cpp \ - #../../Code/maxGUI/MultilineTextBox.cpp \ #../../Code/maxGUI/ProgressBar.cpp \ #../../Code/maxGUI/RadioButton.cpp \ - #../../Code/maxGUI/Rectangle.cpp \ #../../Code/maxGUI/TextBox.cpp CXX_OBJS = $(CXX_SRCS:.cpp=.o) INCLUDE_PATHS = \ ../../Code \ - ../../Dependencies/max/Code + ../../Dependencies/max/Code \ + /usr/include/qt/QtWidgets \ + /usr/include/qt \ + /usr/include/qt/QtCore \ + /usr/include/qt/QtGui INCLUDE_PATHS_FLAGS = $(foreach d, $(INCLUDE_PATHS), -I$d) LIBRARY_PATHS = \ @@ -31,13 +35,17 @@ AUTOMATED_TEST_CXX_SRCS = \ ../../Code/maxGUI/TestingEntryPoint.cpp AUTOMATED_TEST_CXX_OBJS = $(AUTOMATED_TEST_CXX_SRCS:.cpp=.o) -CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -std=c++14 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -LINKER_FLAGS += $(LIBRARY_PATHS_FLAGS) +EXAMPLE1_CXX_SRCS = \ + ../../Code/Examples/1-SimpleExample/EntryPoint.cpp +EXAMPLE1_CXX_OBJS = $(EXAMPLE1_CXX_SRCS:.cpp=.o) +CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -std=c++20 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion +LINKER_FLAGS += $(LIBRARY_PATHS_FLAGS) -lQt5Widgets -lQt5Gui -lQt5Core -all: lib$(PROGRAM_NAME).a maxGUIAutomatedTests + +all: lib$(PROGRAM_NAME).a maxGUIAutomatedTests example1 lib$(PROGRAM_NAME).a: $(PCH_OBJS) $(CXX_OBJS) ar rcs lib$(PROGRAM_NAME).a $(CXX_OBJS) @@ -45,6 +53,9 @@ lib$(PROGRAM_NAME).a: $(PCH_OBJS) $(CXX_OBJS) maxGUIAutomatedTests: $(AUTOMATED_TEST_CXX_OBJS) clang++ -g $(AUTOMATED_TEST_CXX_OBJS) $(LINKER_FLAGS) -l$(PROGRAM_NAME) -o maxGUIAutomatedTests +example1: $(EXAMPLE1_CXX_OBJS) + clang++ -g $(EXAMPLE1_CXX_OBJS) $(LINKER_FLAGS) -l$(PROGRAM_NAME) -o example1 + .cpp.o: clang++ -g $(CPPFLAGS) -c $< -o $@ @@ -53,5 +64,7 @@ clean: @- $(RM) $(CXX_OBJS) @- $(RM) maxGUIAutomatedTests @- $(RM) $(AUTOMATED_TEST_CXX_OBJS) + @- $(RM) example1 + @- $(RM) $(EXAMPLE1_CXX_OBJS) distclean: clean diff --git a/Projects/Clang X86-64 Make/Makefile b/Projects/Clang X86-64 Make/Makefile index ded60fd..771393a 100644 --- a/Projects/Clang X86-64 Make/Makefile +++ b/Projects/Clang X86-64 Make/Makefile @@ -2,25 +2,29 @@ PROGRAM_NAME = maxGUI CXX_SRCS = \ ../../Code/maxGUI/Button.cpp \ ../../Code/maxGUI/Control.cpp \ - ../../Code/maxGUI/ControlWithText.cpp + ../../Code/maxGUI/ControlWithText.cpp \ + ../../Code/maxGUI/EntryPoint.cpp \ + ../../Code/maxGUI/Form.cpp \ + ../../Code/maxGUI/MultilineTextBox.cpp \ + ../../Code/maxGUI/Rectangle.cpp #../../Code/maxGUI/CheckBox.cpp \ #../../Code/maxGUI/ControlWithList.cpp \ #../../Code/maxGUI/DropDownBox.cpp \ - #../../Code/maxGUI/EntryPoint.cpp \ - #../../Code/maxGUI/Form.cpp \ #../../Code/maxGUI/Frame.cpp \ #../../Code/maxGUI/Label.cpp \ #../../Code/maxGUI/ListBox.cpp \ - #../../Code/maxGUI/MultilineTextBox.cpp \ #../../Code/maxGUI/ProgressBar.cpp \ #../../Code/maxGUI/RadioButton.cpp \ - #../../Code/maxGUI/Rectangle.cpp \ #../../Code/maxGUI/TextBox.cpp CXX_OBJS = $(CXX_SRCS:.cpp=.o) INCLUDE_PATHS = \ ../../Code \ - ../../Dependencies/max/Code + ../../Dependencies/max/Code \ + /usr/include/qt/QtWidgets \ + /usr/include/qt \ + /usr/include/qt/QtCore \ + /usr/include/qt/QtGui INCLUDE_PATHS_FLAGS = $(foreach d, $(INCLUDE_PATHS), -I$d) LIBRARY_PATHS = \ @@ -31,13 +35,17 @@ AUTOMATED_TEST_CXX_SRCS = \ ../../Code/maxGUI/TestingEntryPoint.cpp AUTOMATED_TEST_CXX_OBJS = $(AUTOMATED_TEST_CXX_SRCS:.cpp=.o) -CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -std=c++14 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -LINKER_FLAGS += $(LIBRARY_PATHS_FLAGS) +EXAMPLE1_CXX_SRCS = \ + ../../Code/Examples/1-SimpleExample/EntryPoint.cpp +EXAMPLE1_CXX_OBJS = $(EXAMPLE1_CXX_SRCS:.cpp=.o) +CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -std=c++20 +LINKER_FLAGS += $(LIBRARY_PATHS_FLAGS) -lQt5Widgets -lQt5Gui -lQt5Core -all: lib$(PROGRAM_NAME).a maxGUIAutomatedTests + +all: lib$(PROGRAM_NAME).a maxGUIAutomatedTests example1 lib$(PROGRAM_NAME).a: $(PCH_OBJS) $(CXX_OBJS) ar rcs lib$(PROGRAM_NAME).a $(CXX_OBJS) @@ -45,6 +53,9 @@ lib$(PROGRAM_NAME).a: $(PCH_OBJS) $(CXX_OBJS) maxGUIAutomatedTests: $(AUTOMATED_TEST_CXX_OBJS) clang++ -g $(AUTOMATED_TEST_CXX_OBJS) $(LINKER_FLAGS) -l$(PROGRAM_NAME) -o maxGUIAutomatedTests +example1: $(EXAMPLE1_CXX_OBJS) + clang++ -g $(EXAMPLE1_CXX_OBJS) $(LINKER_FLAGS) -l$(PROGRAM_NAME) -o example1 + .cpp.o: clang++ -g $(CPPFLAGS) -c $< -o $@ @@ -53,5 +64,7 @@ clean: @- $(RM) $(CXX_OBJS) @- $(RM) maxAutomatedTests @- $(RM) $(AUTOMATED_TEST_CXX_OBJS) + @- $(RM) example1 + @- $(RM) $(EXAMPLE1_CXX_OBJS) distclean: clean diff --git a/Projects/GCC X86 Make/Makefile b/Projects/GCC X86 Make/Makefile index 9123854..bb9d277 100644 --- a/Projects/GCC X86 Make/Makefile +++ b/Projects/GCC X86 Make/Makefile @@ -2,25 +2,29 @@ PROGRAM_NAME = maxGUI CXX_SRCS = \ ../../Code/maxGUI/Button.cpp \ ../../Code/maxGUI/Control.cpp \ - ../../Code/maxGUI/ControlWithText.cpp + ../../Code/maxGUI/ControlWithText.cpp \ + ../../Code/maxGUI/EntryPoint.cpp \ + ../../Code/maxGUI/Form.cpp \ + ../../Code/maxGUI/MultilineTextBox.cpp \ + ../../Code/maxGUI/Rectangle.cpp #../../Code/maxGUI/CheckBox.cpp \ #../../Code/maxGUI/ControlWithList.cpp \ #../../Code/maxGUI/DropDownBox.cpp \ - #../../Code/maxGUI/EntryPoint.cpp \ - #../../Code/maxGUI/Form.cpp \ #../../Code/maxGUI/Frame.cpp \ #../../Code/maxGUI/Label.cpp \ #../../Code/maxGUI/ListBox.cpp \ - #../../Code/maxGUI/MultilineTextBox.cpp \ #../../Code/maxGUI/ProgressBar.cpp \ #../../Code/maxGUI/RadioButton.cpp \ - #../../Code/maxGUI/Rectangle.cpp \ #../../Code/maxGUI/TextBox.cpp CXX_OBJS = $(CXX_SRCS:.cpp=.o) INCLUDE_PATHS = \ ../../Code \ - ../../Dependencies/max/Code + ../../Dependencies/max/Code \ + /usr/include/qt/QtWidgets \ + /usr/include/qt \ + /usr/include/qt/QtCore \ + /usr/include/qt/QtGui INCLUDE_PATHS_FLAGS = $(foreach d, $(INCLUDE_PATHS), -I$d) LIBRARY_PATHS = \ @@ -31,13 +35,17 @@ AUTOMATED_TEST_CXX_SRCS = \ ../../Code/maxGUI/TestingEntryPoint.cpp AUTOMATED_TEST_CXX_OBJS = $(AUTOMATED_TEST_CXX_SRCS:.cpp=.o) -CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -std=c++14 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -LINKER_FLAGS += $(LIBRARY_PATHS_FLAGS) +EXAMPLE1_CXX_SRCS = \ + ../../Code/Examples/1-SimpleExample/EntryPoint.cpp +EXAMPLE1_CXX_OBJS = $(EXAMPLE1_CXX_SRCS:.cpp=.o) +CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -std=c++20 +LINKER_FLAGS += $(LIBRARY_PATHS_FLAGS) -lQt5Widgets -lQt5Gui -lQt5Core -all: lib$(PROGRAM_NAME).a maxGUIAutomatedTests + +all: lib$(PROGRAM_NAME).a maxGUIAutomatedTests example1 lib$(PROGRAM_NAME).a: $(PCH_OBJS) $(CXX_OBJS) ar rcs lib$(PROGRAM_NAME).a $(CXX_OBJS) @@ -45,6 +53,9 @@ lib$(PROGRAM_NAME).a: $(PCH_OBJS) $(CXX_OBJS) maxGUIAutomatedTests: $(AUTOMATED_TEST_CXX_OBJS) g++ -g $(AUTOMATED_TEST_CXX_OBJS) $(LINKER_FLAGS) -l$(PROGRAM_NAME) -o maxGUIAutomatedTests +example1: $(EXAMPLE1_CXX_OBJS) + clang++ -g $(EXAMPLE1_CXX_OBJS) $(LINKER_FLAGS) -l$(PROGRAM_NAME) -o example1 + .cpp.o: g++ -g $(CPPFLAGS) -c $< -o $@ @@ -53,5 +64,7 @@ clean: @- $(RM) $(CXX_OBJS) @- $(RM) maxAutomatedTests @- $(RM) $(AUTOMATED_TEST_CXX_OBJS) + @- $(RM) example1 + @- $(RM) $(EXAMPLE1_CXX_OBJS) distclean: clean diff --git a/Projects/GCC X86-64 Make/Makefile b/Projects/GCC X86-64 Make/Makefile index 9123854..f2aea02 100644 --- a/Projects/GCC X86-64 Make/Makefile +++ b/Projects/GCC X86-64 Make/Makefile @@ -2,25 +2,29 @@ PROGRAM_NAME = maxGUI CXX_SRCS = \ ../../Code/maxGUI/Button.cpp \ ../../Code/maxGUI/Control.cpp \ - ../../Code/maxGUI/ControlWithText.cpp + ../../Code/maxGUI/ControlWithText.cpp \ + ../../Code/maxGUI/EntryPoint.cpp \ + ../../Code/maxGUI/Form.cpp \ + ../../Code/maxGUI/MultilineTextBox.cpp \ + ../../Code/maxGUI/Rectangle.cpp #../../Code/maxGUI/CheckBox.cpp \ #../../Code/maxGUI/ControlWithList.cpp \ #../../Code/maxGUI/DropDownBox.cpp \ - #../../Code/maxGUI/EntryPoint.cpp \ - #../../Code/maxGUI/Form.cpp \ #../../Code/maxGUI/Frame.cpp \ #../../Code/maxGUI/Label.cpp \ #../../Code/maxGUI/ListBox.cpp \ - #../../Code/maxGUI/MultilineTextBox.cpp \ #../../Code/maxGUI/ProgressBar.cpp \ #../../Code/maxGUI/RadioButton.cpp \ - #../../Code/maxGUI/Rectangle.cpp \ #../../Code/maxGUI/TextBox.cpp CXX_OBJS = $(CXX_SRCS:.cpp=.o) INCLUDE_PATHS = \ ../../Code \ - ../../Dependencies/max/Code + ../../Dependencies/max/Code \ + /usr/include/qt/QtWidgets \ + /usr/include/qt \ + /usr/include/qt/QtCore \ + /usr/include/qt/QtGui INCLUDE_PATHS_FLAGS = $(foreach d, $(INCLUDE_PATHS), -I$d) LIBRARY_PATHS = \ @@ -31,8 +35,8 @@ AUTOMATED_TEST_CXX_SRCS = \ ../../Code/maxGUI/TestingEntryPoint.cpp AUTOMATED_TEST_CXX_OBJS = $(AUTOMATED_TEST_CXX_SRCS:.cpp=.o) -CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -std=c++14 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -LINKER_FLAGS += $(LIBRARY_PATHS_FLAGS) +CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -std=c++20 +LINKER_FLAGS += $(LIBRARY_PATHS_FLAGS) -lQt5Widgets -lQt5Gui -lQt5Core @@ -45,6 +49,9 @@ lib$(PROGRAM_NAME).a: $(PCH_OBJS) $(CXX_OBJS) maxGUIAutomatedTests: $(AUTOMATED_TEST_CXX_OBJS) g++ -g $(AUTOMATED_TEST_CXX_OBJS) $(LINKER_FLAGS) -l$(PROGRAM_NAME) -o maxGUIAutomatedTests +example1: $(EXAMPLE1_CXX_OBJS) + clang++ -g $(EXAMPLE1_CXX_OBJS) $(LINKER_FLAGS) -l$(PROGRAM_NAME) -o example1 + .cpp.o: g++ -g $(CPPFLAGS) -c $< -o $@ @@ -53,5 +60,7 @@ clean: @- $(RM) $(CXX_OBJS) @- $(RM) maxAutomatedTests @- $(RM) $(AUTOMATED_TEST_CXX_OBJS) + @- $(RM) example1 + @- $(RM) $(EXAMPLE1_CXX_OBJS) distclean: clean From 06088bd67ef2be6de21da575d1092f84c613447a Mon Sep 17 00:00:00 2001 From: Chris Blume Date: Thu, 15 Sep 2022 11:20:17 -0400 Subject: [PATCH 02/13] Fix typo --- Code/maxGUI/ProgressBar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/maxGUI/ProgressBar.cpp b/Code/maxGUI/ProgressBar.cpp index 161639b..41e2ea1 100644 --- a/Code/maxGUI/ProgressBar.cpp +++ b/Code/maxGUI/ProgressBar.cpp @@ -37,7 +37,7 @@ namespace maxGUI } void ProgressBar::SetValue(int value) noexcept { -#if defined(MAX_PALTFORM_WINDOWS) +#if defined(MAX_PLATFORM_WINDOWS) SendMessage(window_handle_, PBM_SETPOS, static_cast(value), 0); #endif } From e55956c45a53334748855ad8f7a16777b972e808 Mon Sep 17 00:00:00 2001 From: Chris Blume Date: Thu, 15 Sep 2022 11:33:23 -0400 Subject: [PATCH 03/13] CI to install Qt headers --- .github/workflows/build-and-test.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 62690f6..c6dd2ba 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -49,6 +49,11 @@ jobs: # sudo apt update # sudo apt install g++-9 g++-10 llvm-10 clang-10 + - name: Install Qt 5 + run: | + sudo apt update + sudo apt install libqt5-headers + - name: Build #env: # CXX: g++-10 @@ -56,4 +61,4 @@ jobs: run: make - name: Test - run: ${{ github.workspace }}/Projects/${{ matrix.compiler }}\ ${{ matrix.platform }}\ Make/maxGUIAutomatedTests \ No newline at end of file + run: ${{ github.workspace }}/Projects/${{ matrix.compiler }}\ ${{ matrix.platform }}\ Make/maxGUIAutomatedTests From 0a8c6445904dab15e7425ecbbcb2d20681ae6b85 Mon Sep 17 00:00:00 2001 From: Chris Blume Date: Thu, 15 Sep 2022 11:38:53 -0400 Subject: [PATCH 04/13] Fix Windows builds --- .../ControlGalleryExample.vcxproj | 2 +- .../ControlGalleryExample.vcxproj.filters | 10 +- .../CustomPaintingExample.vcxproj | 2 +- .../CustomPaintingExample.vcxproj.filters | 10 +- .../SimpleExample/SimpleExample.vcxproj | 2 +- .../SimpleExample.vcxproj.filters | 10 +- .../StylingExample/StylingExample.vcxproj | 2 +- .../StylingExample.vcxproj.filters | 10 +- Projects/VisualStudio/maxGUI.sln | 180 ++++++++---------- 9 files changed, 108 insertions(+), 120 deletions(-) diff --git a/Projects/VisualStudio/ControlGalleryExample/ControlGalleryExample.vcxproj b/Projects/VisualStudio/ControlGalleryExample/ControlGalleryExample.vcxproj index ddf76e1..dd372da 100644 --- a/Projects/VisualStudio/ControlGalleryExample/ControlGalleryExample.vcxproj +++ b/Projects/VisualStudio/ControlGalleryExample/ControlGalleryExample.vcxproj @@ -19,7 +19,7 @@ - + 16.0 diff --git a/Projects/VisualStudio/ControlGalleryExample/ControlGalleryExample.vcxproj.filters b/Projects/VisualStudio/ControlGalleryExample/ControlGalleryExample.vcxproj.filters index 8b9cc14..601dbf1 100644 --- a/Projects/VisualStudio/ControlGalleryExample/ControlGalleryExample.vcxproj.filters +++ b/Projects/VisualStudio/ControlGalleryExample/ControlGalleryExample.vcxproj.filters @@ -1,6 +1,6 @@ - - - - - + + + + + \ No newline at end of file diff --git a/Projects/VisualStudio/CustomPaintingExample/CustomPaintingExample.vcxproj b/Projects/VisualStudio/CustomPaintingExample/CustomPaintingExample.vcxproj index 6fcea36..ac535ec 100644 --- a/Projects/VisualStudio/CustomPaintingExample/CustomPaintingExample.vcxproj +++ b/Projects/VisualStudio/CustomPaintingExample/CustomPaintingExample.vcxproj @@ -19,7 +19,7 @@ - + 16.0 diff --git a/Projects/VisualStudio/CustomPaintingExample/CustomPaintingExample.vcxproj.filters b/Projects/VisualStudio/CustomPaintingExample/CustomPaintingExample.vcxproj.filters index 863ae17..c16e49d 100644 --- a/Projects/VisualStudio/CustomPaintingExample/CustomPaintingExample.vcxproj.filters +++ b/Projects/VisualStudio/CustomPaintingExample/CustomPaintingExample.vcxproj.filters @@ -1,6 +1,6 @@ - - - - - + + + + + \ No newline at end of file diff --git a/Projects/VisualStudio/SimpleExample/SimpleExample.vcxproj b/Projects/VisualStudio/SimpleExample/SimpleExample.vcxproj index 9fa0757..1e73afe 100644 --- a/Projects/VisualStudio/SimpleExample/SimpleExample.vcxproj +++ b/Projects/VisualStudio/SimpleExample/SimpleExample.vcxproj @@ -19,7 +19,7 @@ - + 16.0 diff --git a/Projects/VisualStudio/SimpleExample/SimpleExample.vcxproj.filters b/Projects/VisualStudio/SimpleExample/SimpleExample.vcxproj.filters index ed20c06..815b380 100644 --- a/Projects/VisualStudio/SimpleExample/SimpleExample.vcxproj.filters +++ b/Projects/VisualStudio/SimpleExample/SimpleExample.vcxproj.filters @@ -1,6 +1,6 @@ - - - - - + + + + + \ No newline at end of file diff --git a/Projects/VisualStudio/StylingExample/StylingExample.vcxproj b/Projects/VisualStudio/StylingExample/StylingExample.vcxproj index 6a9880f..0284e7d 100644 --- a/Projects/VisualStudio/StylingExample/StylingExample.vcxproj +++ b/Projects/VisualStudio/StylingExample/StylingExample.vcxproj @@ -19,7 +19,7 @@ - + 16.0 diff --git a/Projects/VisualStudio/StylingExample/StylingExample.vcxproj.filters b/Projects/VisualStudio/StylingExample/StylingExample.vcxproj.filters index c2b5737..ac764b0 100644 --- a/Projects/VisualStudio/StylingExample/StylingExample.vcxproj.filters +++ b/Projects/VisualStudio/StylingExample/StylingExample.vcxproj.filters @@ -1,6 +1,6 @@ - - - - - + + + + + \ No newline at end of file diff --git a/Projects/VisualStudio/maxGUI.sln b/Projects/VisualStudio/maxGUI.sln index 05dfa4e..c1c4b87 100644 --- a/Projects/VisualStudio/maxGUI.sln +++ b/Projects/VisualStudio/maxGUI.sln @@ -1,96 +1,84 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.28917.181 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "maxGUI", "maxGUI\maxGUI.vcxproj", "{3A9E3E87-9F00-4240-8E5D-489DC37C73DA}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "maxGUIAutomatedTests", "maxGUIAutomatedTests\maxGUIAutomatedTests.vcxproj", "{0C521B83-BF62-47CC-82F0-6CA9B6EC3E29}" - ProjectSection(ProjectDependencies) = postProject - {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} = {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleExample", "SimpleExample\SimpleExample.vcxproj", "{9ED630F4-C410-42C7-96A2-8F26BC44ED2D}" - ProjectSection(ProjectDependencies) = postProject - {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} = {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ControlGalleryExample", "ControlGalleryExample\ControlGalleryExample.vcxproj", "{5085246A-5C05-4257-8E5C-129E139500EF}" - ProjectSection(ProjectDependencies) = postProject - {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} = {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StylingExample", "StylingExample\StylingExample.vcxproj", "{D6501A01-B7E4-4FAD-BE1C-9044216735E0}" - ProjectSection(ProjectDependencies) = postProject - {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} = {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CustomPaintingExample", "CustomPaintingExample\CustomPaintingExample.vcxproj", "{4DA98E98-E98F-4473-85FD-31698746CAE2}" - ProjectSection(ProjectDependencies) = postProject - {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} = {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3A9E3E87-9F00-4240-8E5D-489DC37C73DA}.Debug|Win32.ActiveCfg = Debug|Win32 - {3A9E3E87-9F00-4240-8E5D-489DC37C73DA}.Debug|Win32.Build.0 = Debug|Win32 - {3A9E3E87-9F00-4240-8E5D-489DC37C73DA}.Debug|x64.ActiveCfg = Debug|x64 - {3A9E3E87-9F00-4240-8E5D-489DC37C73DA}.Debug|x64.Build.0 = Debug|x64 - {3A9E3E87-9F00-4240-8E5D-489DC37C73DA}.Release|Win32.ActiveCfg = Release|Win32 - {3A9E3E87-9F00-4240-8E5D-489DC37C73DA}.Release|Win32.Build.0 = Release|Win32 - {3A9E3E87-9F00-4240-8E5D-489DC37C73DA}.Release|x64.ActiveCfg = Release|x64 - {3A9E3E87-9F00-4240-8E5D-489DC37C73DA}.Release|x64.Build.0 = Release|x64 - {0C521B83-BF62-47CC-82F0-6CA9B6EC3E29}.Debug|Win32.ActiveCfg = Debug|Win32 - {0C521B83-BF62-47CC-82F0-6CA9B6EC3E29}.Debug|Win32.Build.0 = Debug|Win32 - {0C521B83-BF62-47CC-82F0-6CA9B6EC3E29}.Debug|x64.ActiveCfg = Debug|x64 - {0C521B83-BF62-47CC-82F0-6CA9B6EC3E29}.Debug|x64.Build.0 = Debug|x64 - {0C521B83-BF62-47CC-82F0-6CA9B6EC3E29}.Release|Win32.ActiveCfg = Release|Win32 - {0C521B83-BF62-47CC-82F0-6CA9B6EC3E29}.Release|Win32.Build.0 = Release|Win32 - {0C521B83-BF62-47CC-82F0-6CA9B6EC3E29}.Release|x64.ActiveCfg = Release|x64 - {0C521B83-BF62-47CC-82F0-6CA9B6EC3E29}.Release|x64.Build.0 = Release|x64 - {9ED630F4-C410-42C7-96A2-8F26BC44ED2D}.Debug|Win32.ActiveCfg = Debug|Win32 - {9ED630F4-C410-42C7-96A2-8F26BC44ED2D}.Debug|Win32.Build.0 = Debug|Win32 - {9ED630F4-C410-42C7-96A2-8F26BC44ED2D}.Debug|x64.ActiveCfg = Debug|x64 - {9ED630F4-C410-42C7-96A2-8F26BC44ED2D}.Debug|x64.Build.0 = Debug|x64 - {9ED630F4-C410-42C7-96A2-8F26BC44ED2D}.Release|Win32.ActiveCfg = Release|Win32 - {9ED630F4-C410-42C7-96A2-8F26BC44ED2D}.Release|Win32.Build.0 = Release|Win32 - {9ED630F4-C410-42C7-96A2-8F26BC44ED2D}.Release|x64.ActiveCfg = Release|x64 - {9ED630F4-C410-42C7-96A2-8F26BC44ED2D}.Release|x64.Build.0 = Release|x64 - {5085246A-5C05-4257-8E5C-129E139500EF}.Debug|Win32.ActiveCfg = Debug|Win32 - {5085246A-5C05-4257-8E5C-129E139500EF}.Debug|Win32.Build.0 = Debug|Win32 - {5085246A-5C05-4257-8E5C-129E139500EF}.Debug|x64.ActiveCfg = Debug|x64 - {5085246A-5C05-4257-8E5C-129E139500EF}.Debug|x64.Build.0 = Debug|x64 - {5085246A-5C05-4257-8E5C-129E139500EF}.Release|Win32.ActiveCfg = Release|Win32 - {5085246A-5C05-4257-8E5C-129E139500EF}.Release|Win32.Build.0 = Release|Win32 - {5085246A-5C05-4257-8E5C-129E139500EF}.Release|x64.ActiveCfg = Release|x64 - {5085246A-5C05-4257-8E5C-129E139500EF}.Release|x64.Build.0 = Release|x64 - {D6501A01-B7E4-4FAD-BE1C-9044216735E0}.Debug|Win32.ActiveCfg = Debug|Win32 - {D6501A01-B7E4-4FAD-BE1C-9044216735E0}.Debug|Win32.Build.0 = Debug|Win32 - {D6501A01-B7E4-4FAD-BE1C-9044216735E0}.Debug|x64.ActiveCfg = Debug|x64 - {D6501A01-B7E4-4FAD-BE1C-9044216735E0}.Debug|x64.Build.0 = Debug|x64 - {D6501A01-B7E4-4FAD-BE1C-9044216735E0}.Release|Win32.ActiveCfg = Release|Win32 - {D6501A01-B7E4-4FAD-BE1C-9044216735E0}.Release|Win32.Build.0 = Release|Win32 - {D6501A01-B7E4-4FAD-BE1C-9044216735E0}.Release|x64.ActiveCfg = Release|x64 - {D6501A01-B7E4-4FAD-BE1C-9044216735E0}.Release|x64.Build.0 = Release|x64 - {4DA98E98-E98F-4473-85FD-31698746CAE2}.Debug|Win32.ActiveCfg = Debug|Win32 - {4DA98E98-E98F-4473-85FD-31698746CAE2}.Debug|Win32.Build.0 = Debug|Win32 - {4DA98E98-E98F-4473-85FD-31698746CAE2}.Debug|x64.ActiveCfg = Debug|x64 - {4DA98E98-E98F-4473-85FD-31698746CAE2}.Debug|x64.Build.0 = Debug|x64 - {4DA98E98-E98F-4473-85FD-31698746CAE2}.Release|Win32.ActiveCfg = Release|Win32 - {4DA98E98-E98F-4473-85FD-31698746CAE2}.Release|Win32.Build.0 = Release|Win32 - {4DA98E98-E98F-4473-85FD-31698746CAE2}.Release|x64.ActiveCfg = Release|x64 - {4DA98E98-E98F-4473-85FD-31698746CAE2}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {8648D57F-04B8-4076-8E3E-1E8F2D5D3915} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32811.315 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "maxGUI", "maxGUI\maxGUI.vcxproj", "{3A9E3E87-9F00-4240-8E5D-489DC37C73DA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "maxGUIAutomatedTests", "maxGUIAutomatedTests\maxGUIAutomatedTests.vcxproj", "{0C521B83-BF62-47CC-82F0-6CA9B6EC3E29}" + ProjectSection(ProjectDependencies) = postProject + {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} = {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ControlGalleryExample", "ControlGalleryExample\ControlGalleryExample.vcxproj", "{5085246A-5C05-4257-8E5C-129E139500EF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CustomPaintingExample", "CustomPaintingExample\CustomPaintingExample.vcxproj", "{4DA98E98-E98F-4473-85FD-31698746CAE2}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleExample", "SimpleExample\SimpleExample.vcxproj", "{9ED630F4-C410-42C7-96A2-8F26BC44ED2D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StylingExample", "StylingExample\StylingExample.vcxproj", "{D6501A01-B7E4-4FAD-BE1C-9044216735E0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3A9E3E87-9F00-4240-8E5D-489DC37C73DA}.Debug|Win32.ActiveCfg = Debug|Win32 + {3A9E3E87-9F00-4240-8E5D-489DC37C73DA}.Debug|Win32.Build.0 = Debug|Win32 + {3A9E3E87-9F00-4240-8E5D-489DC37C73DA}.Debug|x64.ActiveCfg = Debug|x64 + {3A9E3E87-9F00-4240-8E5D-489DC37C73DA}.Debug|x64.Build.0 = Debug|x64 + {3A9E3E87-9F00-4240-8E5D-489DC37C73DA}.Release|Win32.ActiveCfg = Release|Win32 + {3A9E3E87-9F00-4240-8E5D-489DC37C73DA}.Release|Win32.Build.0 = Release|Win32 + {3A9E3E87-9F00-4240-8E5D-489DC37C73DA}.Release|x64.ActiveCfg = Release|x64 + {3A9E3E87-9F00-4240-8E5D-489DC37C73DA}.Release|x64.Build.0 = Release|x64 + {0C521B83-BF62-47CC-82F0-6CA9B6EC3E29}.Debug|Win32.ActiveCfg = Debug|Win32 + {0C521B83-BF62-47CC-82F0-6CA9B6EC3E29}.Debug|Win32.Build.0 = Debug|Win32 + {0C521B83-BF62-47CC-82F0-6CA9B6EC3E29}.Debug|x64.ActiveCfg = Debug|x64 + {0C521B83-BF62-47CC-82F0-6CA9B6EC3E29}.Debug|x64.Build.0 = Debug|x64 + {0C521B83-BF62-47CC-82F0-6CA9B6EC3E29}.Release|Win32.ActiveCfg = Release|Win32 + {0C521B83-BF62-47CC-82F0-6CA9B6EC3E29}.Release|Win32.Build.0 = Release|Win32 + {0C521B83-BF62-47CC-82F0-6CA9B6EC3E29}.Release|x64.ActiveCfg = Release|x64 + {0C521B83-BF62-47CC-82F0-6CA9B6EC3E29}.Release|x64.Build.0 = Release|x64 + {5085246A-5C05-4257-8E5C-129E139500EF}.Debug|Win32.ActiveCfg = Debug|Win32 + {5085246A-5C05-4257-8E5C-129E139500EF}.Debug|Win32.Build.0 = Debug|Win32 + {5085246A-5C05-4257-8E5C-129E139500EF}.Debug|x64.ActiveCfg = Debug|x64 + {5085246A-5C05-4257-8E5C-129E139500EF}.Debug|x64.Build.0 = Debug|x64 + {5085246A-5C05-4257-8E5C-129E139500EF}.Release|Win32.ActiveCfg = Release|Win32 + {5085246A-5C05-4257-8E5C-129E139500EF}.Release|Win32.Build.0 = Release|Win32 + {5085246A-5C05-4257-8E5C-129E139500EF}.Release|x64.ActiveCfg = Release|x64 + {5085246A-5C05-4257-8E5C-129E139500EF}.Release|x64.Build.0 = Release|x64 + {4DA98E98-E98F-4473-85FD-31698746CAE2}.Debug|Win32.ActiveCfg = Debug|Win32 + {4DA98E98-E98F-4473-85FD-31698746CAE2}.Debug|Win32.Build.0 = Debug|Win32 + {4DA98E98-E98F-4473-85FD-31698746CAE2}.Debug|x64.ActiveCfg = Debug|x64 + {4DA98E98-E98F-4473-85FD-31698746CAE2}.Debug|x64.Build.0 = Debug|x64 + {4DA98E98-E98F-4473-85FD-31698746CAE2}.Release|Win32.ActiveCfg = Release|Win32 + {4DA98E98-E98F-4473-85FD-31698746CAE2}.Release|Win32.Build.0 = Release|Win32 + {4DA98E98-E98F-4473-85FD-31698746CAE2}.Release|x64.ActiveCfg = Release|x64 + {4DA98E98-E98F-4473-85FD-31698746CAE2}.Release|x64.Build.0 = Release|x64 + {9ED630F4-C410-42C7-96A2-8F26BC44ED2D}.Debug|Win32.ActiveCfg = Debug|Win32 + {9ED630F4-C410-42C7-96A2-8F26BC44ED2D}.Debug|Win32.Build.0 = Debug|Win32 + {9ED630F4-C410-42C7-96A2-8F26BC44ED2D}.Debug|x64.ActiveCfg = Debug|x64 + {9ED630F4-C410-42C7-96A2-8F26BC44ED2D}.Debug|x64.Build.0 = Debug|x64 + {9ED630F4-C410-42C7-96A2-8F26BC44ED2D}.Release|Win32.ActiveCfg = Release|Win32 + {9ED630F4-C410-42C7-96A2-8F26BC44ED2D}.Release|Win32.Build.0 = Release|Win32 + {9ED630F4-C410-42C7-96A2-8F26BC44ED2D}.Release|x64.ActiveCfg = Release|x64 + {9ED630F4-C410-42C7-96A2-8F26BC44ED2D}.Release|x64.Build.0 = Release|x64 + {D6501A01-B7E4-4FAD-BE1C-9044216735E0}.Debug|Win32.ActiveCfg = Debug|Win32 + {D6501A01-B7E4-4FAD-BE1C-9044216735E0}.Debug|Win32.Build.0 = Debug|Win32 + {D6501A01-B7E4-4FAD-BE1C-9044216735E0}.Debug|x64.ActiveCfg = Debug|x64 + {D6501A01-B7E4-4FAD-BE1C-9044216735E0}.Debug|x64.Build.0 = Debug|x64 + {D6501A01-B7E4-4FAD-BE1C-9044216735E0}.Release|Win32.ActiveCfg = Release|Win32 + {D6501A01-B7E4-4FAD-BE1C-9044216735E0}.Release|Win32.Build.0 = Release|Win32 + {D6501A01-B7E4-4FAD-BE1C-9044216735E0}.Release|x64.ActiveCfg = Release|x64 + {D6501A01-B7E4-4FAD-BE1C-9044216735E0}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8648D57F-04B8-4076-8E3E-1E8F2D5D3915} + EndGlobalSection +EndGlobal From ba49dc80e42e4962d780ecf3d1dc4086ddc28a23 Mon Sep 17 00:00:00 2001 From: Chris Blume Date: Thu, 15 Sep 2022 11:43:29 -0400 Subject: [PATCH 05/13] Fix build dependencies --- Projects/VisualStudio/maxGUI.sln | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Projects/VisualStudio/maxGUI.sln b/Projects/VisualStudio/maxGUI.sln index c1c4b87..da7c0ad 100644 --- a/Projects/VisualStudio/maxGUI.sln +++ b/Projects/VisualStudio/maxGUI.sln @@ -11,12 +11,24 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "maxGUIAutomatedTests", "max EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ControlGalleryExample", "ControlGalleryExample\ControlGalleryExample.vcxproj", "{5085246A-5C05-4257-8E5C-129E139500EF}" + ProjectSection(ProjectDependencies) = postProject + {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} = {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CustomPaintingExample", "CustomPaintingExample\CustomPaintingExample.vcxproj", "{4DA98E98-E98F-4473-85FD-31698746CAE2}" + ProjectSection(ProjectDependencies) = postProject + {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} = {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleExample", "SimpleExample\SimpleExample.vcxproj", "{9ED630F4-C410-42C7-96A2-8F26BC44ED2D}" + ProjectSection(ProjectDependencies) = postProject + {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} = {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StylingExample", "StylingExample\StylingExample.vcxproj", "{D6501A01-B7E4-4FAD-BE1C-9044216735E0}" + ProjectSection(ProjectDependencies) = postProject + {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} = {3A9E3E87-9F00-4240-8E5D-489DC37C73DA} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution From 386730174f9aa065c5e8d858841e167f741adf33 Mon Sep 17 00:00:00 2001 From: Chris Blume Date: Thu, 15 Sep 2022 11:47:48 -0400 Subject: [PATCH 06/13] Try a different package name for installing Qt 5 --- .github/workflows/build-and-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index c6dd2ba..a8f5b3e 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -52,7 +52,7 @@ jobs: - name: Install Qt 5 run: | sudo apt update - sudo apt install libqt5-headers + sudo apt install qt5-default - name: Build #env: From 9f1d34f85176a98d62733ce8f5045ec90036c99d Mon Sep 17 00:00:00 2001 From: Chris Blume Date: Thu, 15 Sep 2022 11:55:27 -0400 Subject: [PATCH 07/13] Try another package name --- .github/workflows/build-and-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index a8f5b3e..d55605e 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -52,7 +52,7 @@ jobs: - name: Install Qt 5 run: | sudo apt update - sudo apt install qt5-default + sudo apt install qtbase5-dev - name: Build #env: From edd339b7cdced73470525e976ce514d81b8f63ba Mon Sep 17 00:00:00 2001 From: Chris Blume Date: Thu, 15 Sep 2022 12:00:48 -0400 Subject: [PATCH 08/13] Use -std=c++2a for GCC --- Projects/GCC X86 Make/Makefile | 3 ++- Projects/GCC X86-64 Make/Makefile | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Projects/GCC X86 Make/Makefile b/Projects/GCC X86 Make/Makefile index bb9d277..e65fd65 100644 --- a/Projects/GCC X86 Make/Makefile +++ b/Projects/GCC X86 Make/Makefile @@ -39,7 +39,8 @@ EXAMPLE1_CXX_SRCS = \ ../../Code/Examples/1-SimpleExample/EntryPoint.cpp EXAMPLE1_CXX_OBJS = $(EXAMPLE1_CXX_SRCS:.cpp=.o) -CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -std=c++20 +# TODO: Ubuntu 20.04 (one of our test machines) has a version of GCC which recognizes c++2a, not c++20 +CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -std=c++2a LINKER_FLAGS += $(LIBRARY_PATHS_FLAGS) -lQt5Widgets -lQt5Gui -lQt5Core diff --git a/Projects/GCC X86-64 Make/Makefile b/Projects/GCC X86-64 Make/Makefile index f2aea02..2009e0f 100644 --- a/Projects/GCC X86-64 Make/Makefile +++ b/Projects/GCC X86-64 Make/Makefile @@ -35,7 +35,8 @@ AUTOMATED_TEST_CXX_SRCS = \ ../../Code/maxGUI/TestingEntryPoint.cpp AUTOMATED_TEST_CXX_OBJS = $(AUTOMATED_TEST_CXX_SRCS:.cpp=.o) -CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -std=c++20 +# TODO: Ubuntu 20.04 (one of our test machines) has a version of GCC which recognizes c++2a, not c++20 +CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -std=c++2a LINKER_FLAGS += $(LIBRARY_PATHS_FLAGS) -lQt5Widgets -lQt5Gui -lQt5Core From ae3df39e507200e93568abea19c9c7f09bf5e022 Mon Sep 17 00:00:00 2001 From: Chris Blume Date: Thu, 15 Sep 2022 12:07:53 -0400 Subject: [PATCH 09/13] Find Qt install path --- .github/workflows/build-and-test.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index d55605e..1d6aaf2 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -54,6 +54,11 @@ jobs: sudo apt update sudo apt install qtbase5-dev + - name: Find Qt + run: | + find /opt/Qt -name QWidget + find /usr/include -name QWidget + - name: Build #env: # CXX: g++-10 From a269a9b4e4a081772d5de33466ec6e500245652f Mon Sep 17 00:00:00 2001 From: Chris Blume Date: Thu, 15 Sep 2022 12:09:33 -0400 Subject: [PATCH 10/13] Foo --- .github/workflows/build-and-test.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 1d6aaf2..d68352c 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -56,7 +56,6 @@ jobs: - name: Find Qt run: | - find /opt/Qt -name QWidget find /usr/include -name QWidget - name: Build From ce33bb9b70a4887e637b8b573bc64bd6275c03f6 Mon Sep 17 00:00:00 2001 From: Chris Blume Date: Thu, 15 Sep 2022 12:14:43 -0400 Subject: [PATCH 11/13] Add paths that the build bots recognize --- Projects/Clang X86 Make/Makefile | 7 ++++++- Projects/Clang X86-64 Make/Makefile | 7 ++++++- Projects/GCC X86 Make/Makefile | 7 ++++++- Projects/GCC X86-64 Make/Makefile | 7 ++++++- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Projects/Clang X86 Make/Makefile b/Projects/Clang X86 Make/Makefile index 74ed99d..0e3ad6c 100644 --- a/Projects/Clang X86 Make/Makefile +++ b/Projects/Clang X86 Make/Makefile @@ -24,7 +24,12 @@ INCLUDE_PATHS = \ /usr/include/qt/QtWidgets \ /usr/include/qt \ /usr/include/qt/QtCore \ - /usr/include/qt/QtGui + /usr/include/qt/QtGui \ + /usr/include/x86_64-linux-gnu/qt5/QtWidgets \ + /usr/include/x86_64-linux-gnu/qt5 \ + /usr/include/x86_64-linux-gnu/QtCore \ + /usr/include/x86_64-linux-gnu/QtGui + INCLUDE_PATHS_FLAGS = $(foreach d, $(INCLUDE_PATHS), -I$d) LIBRARY_PATHS = \ diff --git a/Projects/Clang X86-64 Make/Makefile b/Projects/Clang X86-64 Make/Makefile index 771393a..d1bb0a3 100644 --- a/Projects/Clang X86-64 Make/Makefile +++ b/Projects/Clang X86-64 Make/Makefile @@ -24,7 +24,12 @@ INCLUDE_PATHS = \ /usr/include/qt/QtWidgets \ /usr/include/qt \ /usr/include/qt/QtCore \ - /usr/include/qt/QtGui + /usr/include/qt/QtGui \ + /usr/include/x86_64-linux-gnu/qt5/QtWidgets \ + /usr/include/x86_64-linux-gnu/qt5 \ + /usr/include/x86_64-linux-gnu/QtCore \ + /usr/include/x86_64-linux-gnu/QtGui + INCLUDE_PATHS_FLAGS = $(foreach d, $(INCLUDE_PATHS), -I$d) LIBRARY_PATHS = \ diff --git a/Projects/GCC X86 Make/Makefile b/Projects/GCC X86 Make/Makefile index e65fd65..762bee1 100644 --- a/Projects/GCC X86 Make/Makefile +++ b/Projects/GCC X86 Make/Makefile @@ -24,7 +24,12 @@ INCLUDE_PATHS = \ /usr/include/qt/QtWidgets \ /usr/include/qt \ /usr/include/qt/QtCore \ - /usr/include/qt/QtGui + /usr/include/qt/QtGui \ + /usr/include/x86_64-linux-gnu/qt5/QtWidgets \ + /usr/include/x86_64-linux-gnu/qt5 \ + /usr/include/x86_64-linux-gnu/QtCore \ + /usr/include/x86_64-linux-gnu/QtGui + INCLUDE_PATHS_FLAGS = $(foreach d, $(INCLUDE_PATHS), -I$d) LIBRARY_PATHS = \ diff --git a/Projects/GCC X86-64 Make/Makefile b/Projects/GCC X86-64 Make/Makefile index 2009e0f..7135102 100644 --- a/Projects/GCC X86-64 Make/Makefile +++ b/Projects/GCC X86-64 Make/Makefile @@ -24,7 +24,12 @@ INCLUDE_PATHS = \ /usr/include/qt/QtWidgets \ /usr/include/qt \ /usr/include/qt/QtCore \ - /usr/include/qt/QtGui + /usr/include/qt/QtGui \ + /usr/include/x86_64-linux-gnu/qt5/QtWidgets \ + /usr/include/x86_64-linux-gnu/qt5 \ + /usr/include/x86_64-linux-gnu/QtCore \ + /usr/include/x86_64-linux-gnu/QtGui + INCLUDE_PATHS_FLAGS = $(foreach d, $(INCLUDE_PATHS), -I$d) LIBRARY_PATHS = \ From 7ae4101b18b7a1c2b1ecf460974f82e53d39019d Mon Sep 17 00:00:00 2001 From: Chris Blume Date: Thu, 15 Sep 2022 12:18:15 -0400 Subject: [PATCH 12/13] Compile with -fPIC to make the build bots happy --- Projects/Clang X86 Make/Makefile | 2 +- Projects/Clang X86-64 Make/Makefile | 2 +- Projects/GCC X86 Make/Makefile | 2 +- Projects/GCC X86-64 Make/Makefile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Projects/Clang X86 Make/Makefile b/Projects/Clang X86 Make/Makefile index 0e3ad6c..bba5866 100644 --- a/Projects/Clang X86 Make/Makefile +++ b/Projects/Clang X86 Make/Makefile @@ -44,7 +44,7 @@ EXAMPLE1_CXX_SRCS = \ ../../Code/Examples/1-SimpleExample/EntryPoint.cpp EXAMPLE1_CXX_OBJS = $(EXAMPLE1_CXX_SRCS:.cpp=.o) -CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -std=c++20 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion +CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -std=c++20 -fPIC LINKER_FLAGS += $(LIBRARY_PATHS_FLAGS) -lQt5Widgets -lQt5Gui -lQt5Core diff --git a/Projects/Clang X86-64 Make/Makefile b/Projects/Clang X86-64 Make/Makefile index d1bb0a3..cf83d10 100644 --- a/Projects/Clang X86-64 Make/Makefile +++ b/Projects/Clang X86-64 Make/Makefile @@ -44,7 +44,7 @@ EXAMPLE1_CXX_SRCS = \ ../../Code/Examples/1-SimpleExample/EntryPoint.cpp EXAMPLE1_CXX_OBJS = $(EXAMPLE1_CXX_SRCS:.cpp=.o) -CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -std=c++20 +CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -std=c++20 -fPIC LINKER_FLAGS += $(LIBRARY_PATHS_FLAGS) -lQt5Widgets -lQt5Gui -lQt5Core diff --git a/Projects/GCC X86 Make/Makefile b/Projects/GCC X86 Make/Makefile index 762bee1..f99c4f0 100644 --- a/Projects/GCC X86 Make/Makefile +++ b/Projects/GCC X86 Make/Makefile @@ -45,7 +45,7 @@ EXAMPLE1_CXX_SRCS = \ EXAMPLE1_CXX_OBJS = $(EXAMPLE1_CXX_SRCS:.cpp=.o) # TODO: Ubuntu 20.04 (one of our test machines) has a version of GCC which recognizes c++2a, not c++20 -CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -std=c++2a +CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -std=c++2a -fPIC LINKER_FLAGS += $(LIBRARY_PATHS_FLAGS) -lQt5Widgets -lQt5Gui -lQt5Core diff --git a/Projects/GCC X86-64 Make/Makefile b/Projects/GCC X86-64 Make/Makefile index 7135102..d3df63f 100644 --- a/Projects/GCC X86-64 Make/Makefile +++ b/Projects/GCC X86-64 Make/Makefile @@ -41,7 +41,7 @@ AUTOMATED_TEST_CXX_SRCS = \ AUTOMATED_TEST_CXX_OBJS = $(AUTOMATED_TEST_CXX_SRCS:.cpp=.o) # TODO: Ubuntu 20.04 (one of our test machines) has a version of GCC which recognizes c++2a, not c++20 -CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -std=c++2a +CPPFLAGS += $(INCLUDE_PATHS_FLAGS) -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -std=c++2a -fPIC LINKER_FLAGS += $(LIBRARY_PATHS_FLAGS) -lQt5Widgets -lQt5Gui -lQt5Core From e57ec54fd6f83e0dd21d4b3285299db21fec5130 Mon Sep 17 00:00:00 2001 From: Chris Blume Date: Wed, 4 Jan 2023 22:29:51 -0500 Subject: [PATCH 13/13] Fix example 1 on Linux Previously, example 1's text box didn't resize with the form. Additionally, the form's title was not set and the form size was fixed. Now, the form's style is respected (allowing resizing), the custom form receives a resize notification, and controls can be resized. Additionally, the form's title is now set. This bring Linux example 1 to parity with Windows. --- Code/maxGUI/Control.cpp | 10 +++++-- Code/maxGUI/Control.hpp | 4 +++ Code/maxGUI/ControlWithText.cpp | 6 ++++- Code/maxGUI/ControlWithText.hpp | 4 ++- Code/maxGUI/Form.cpp | 46 +++++++++++++++++++++++--------- Code/maxGUI/Form.hpp | 21 ++++++++++++++- Code/maxGUI/MultilineTextBox.cpp | 6 ++--- 7 files changed, 76 insertions(+), 21 deletions(-) diff --git a/Code/maxGUI/Control.cpp b/Code/maxGUI/Control.cpp index 82311b6..7d906bc 100644 --- a/Code/maxGUI/Control.cpp +++ b/Code/maxGUI/Control.cpp @@ -14,6 +14,10 @@ namespace maxGUI Control::Control(HWND window_handle) noexcept : window_handle_(std::move(window_handle)) {} +#elif defined(MAX_PLATFORM_LINUX) + Control::Control(QWidget* widget) noexcept + : widget_(std::move(widget)) + {} #endif void Control::Move(Rectangle rectangle) noexcept { @@ -21,7 +25,9 @@ namespace maxGUI SetWindowPos(window_handle_, NULL, rectangle.left_, rectangle.top_, rectangle.width_, rectangle.height_, SWP_NOZORDER); #endif #if defined(MAX_PLATFORM_LINUX) - (void)rectangle; + if (this) { + widget_->setGeometry(rectangle.left_, rectangle.top_, rectangle.width_, rectangle.height_); + } #endif } @@ -34,4 +40,4 @@ namespace maxGUI : rectangle_(std::move(rectangle)) {} -} // namespace maxGUI \ No newline at end of file +} // namespace maxGUI diff --git a/Code/maxGUI/Control.hpp b/Code/maxGUI/Control.hpp index 0632589..49892e7 100644 --- a/Code/maxGUI/Control.hpp +++ b/Code/maxGUI/Control.hpp @@ -27,6 +27,8 @@ namespace maxGUI #if defined(MAX_PLATFORM_WINDOWS) explicit Control(HWND window_handle) noexcept; +#elif defined(MAX_PLATFORM_LINUX) + explicit Control(QWidget* widget) noexcept; #endif virtual ~Control() noexcept = default; @@ -35,6 +37,8 @@ namespace maxGUI #if defined(MAX_PLATFORM_WINDOWS) HWND window_handle_; +#elif defined(MAX_PLATFORM_LINUX) + QWidget* widget_; #endif //protected: diff --git a/Code/maxGUI/ControlWithText.cpp b/Code/maxGUI/ControlWithText.cpp index 24def1e..d15023a 100644 --- a/Code/maxGUI/ControlWithText.cpp +++ b/Code/maxGUI/ControlWithText.cpp @@ -17,6 +17,10 @@ namespace maxGUI ControlWithText::ControlWithText(HWND window_handle) noexcept : Control(std::move(window_handle)) {} +#elif defined(MAX_PLATFORM_LINUX) + ControlWithText::ControlWithText(QWidget* widget) noexcept + : Control(std::move(widget)) + {} #endif std::string ControlWithText::GetText() const noexcept { @@ -47,4 +51,4 @@ namespace maxGUI , text_(std::move(text)) {} -} // namespace maxGUI \ No newline at end of file +} // namespace maxGUI diff --git a/Code/maxGUI/ControlWithText.hpp b/Code/maxGUI/ControlWithText.hpp index 3db2a06..cf5490a 100644 --- a/Code/maxGUI/ControlWithText.hpp +++ b/Code/maxGUI/ControlWithText.hpp @@ -25,6 +25,8 @@ namespace maxGUI #if defined(MAX_PLATFORM_WINDOWS) explicit ControlWithText(HWND window_handle) noexcept; +#elif defined(MAX_PLATFORM_LINUX) + explicit ControlWithText(QWidget* widget) noexcept; #endif ~ControlWithText() noexcept override = default; @@ -47,4 +49,4 @@ namespace maxGUI } // namespace maxGUI -#endif // #ifndef MAXGUI_CONTROLWITHTEXT_HPP \ No newline at end of file +#endif // #ifndef MAXGUI_CONTROLWITHTEXT_HPP diff --git a/Code/maxGUI/Form.cpp b/Code/maxGUI/Form.cpp index 485030c..eed4159 100644 --- a/Code/maxGUI/Form.cpp +++ b/Code/maxGUI/Form.cpp @@ -7,6 +7,10 @@ #if defined(MAX_PLATFORM_WINDOWS) #include +#elif defined(MAX_PLATFORM_LINUX) + #include + #include + #include #endif #include @@ -123,22 +127,43 @@ namespace { namespace maxGUI { +#if defined(MAX_PLATFORM_LINUX) + MaxGUIMainWindow::MaxGUIMainWindow(FormConcept* form) + : QMainWindow(nullptr) + , form_(std::move(form)) + {} + + void MaxGUIMainWindow::resizeEvent(QResizeEvent* event) { + form_->OnResized(form_, event->size().height(), event->size().width()); + QMainWindow::resizeEvent(event); + }; + + void MaxGUIMainWindow::closeEvent(QCloseEvent* event) { + form_->OnClosed(form_); + } +#endif + #if defined(MAX_PLATFORM_WINDOWS) FormConcept::FormConcept(HWND window_handle) noexcept : window_handle_(std::move(window_handle)) {} #elif defined(MAX_PLATFORM_LINUX) FormConcept::FormConcept(int height, int width, std::string title, FormStyles styles) noexcept - : window_() + : window_(this) { - window_.setFixedSize(width, height); - - // TODO: Set the title & styles - (void)title; - (void)styles; + switch (styles) { + case FormStyles::None: + break; + case FormStyles::DialogBox: + window_.setWindowFlags(Qt::WindowMinMaxButtonsHint); + window_.setGeometry(0, 0, width, height); + break; + case FormStyles::FixedSize: + window_.setFixedSize(width, height); + break; + } - // TODO: Ideally, once all controls are added the form will be shown. - //window_.show(); + window_.setWindowTitle(title.c_str()); } #endif @@ -150,10 +175,6 @@ namespace maxGUI { #endif Control* raw_control_ptr = control_ptr.get(); controls_.push_back(std::move(control_ptr)); -#if defined(MAX_PLATFORM_LINUX) - // TODO: We should only show after all controls are added. - window_.show(); -#endif return raw_control_ptr; } @@ -254,6 +275,7 @@ namespace maxGUI { FormConcept* form = created_form.get(); form_container_->forms_.push_back(std::move(created_form)); form->OnCreated(form); + form->window_.show(); return true; } #endif diff --git a/Code/maxGUI/Form.hpp b/Code/maxGUI/Form.hpp index b85f5b2..9f6941b 100644 --- a/Code/maxGUI/Form.hpp +++ b/Code/maxGUI/Form.hpp @@ -20,6 +20,7 @@ #include #elif defined(MAX_PLATFORM_LINUX) #include + #include #endif namespace maxGUI @@ -38,6 +39,24 @@ MAX_BITMASKABLE_ENUM_CLASS(maxGUI::FormStyles); namespace maxGUI { +#if defined(MAX_PLATFORM_LINUX) + class FormConcept; + + class MaxGUIMainWindow : public QMainWindow { + public: + explicit MaxGUIMainWindow(FormConcept* form); + + protected: + void resizeEvent(QResizeEvent* event) override; + void closeEvent(QCloseEvent* event) override; + + private: + FormConcept* form_; + + }; +#endif + + class FormConcept { public: @@ -61,7 +80,7 @@ namespace maxGUI #if defined(MAX_PLATFORM_WINDOWS) HWND window_handle_; #elif defined(MAX_PLATFORM_LINUX) - QWidget window_; + MaxGUIMainWindow window_; #endif std::vector> controls_; diff --git a/Code/maxGUI/MultilineTextBox.cpp b/Code/maxGUI/MultilineTextBox.cpp index 6d38bc1..0430d67 100644 --- a/Code/maxGUI/MultilineTextBox.cpp +++ b/Code/maxGUI/MultilineTextBox.cpp @@ -19,10 +19,8 @@ namespace maxGUI {} #elif defined(MAX_PLATFORM_LINUX) MultilineTextBox::MultilineTextBox(QTextEdit* widget) noexcept - : ControlWithText() - { - (void)widget; - } + : ControlWithText(std::move(widget)) + {} #endif #if defined(MAX_PLATFORM_WINDOWS)