Files
m-aXimilian c00c2c71ac
MegaLinter / MegaLinter (push) Has been cancelled
CI Workflow / build-ubuntu (push) Has been cancelled
CI Workflow / build-windows (push) Has been cancelled
CI Workflow / generate-docs (push) Has been cancelled
build system and module refactoring + simple histogram scratch (#20)
* scratch adding histogram to image views

Histograms should come from some sort of histogram service. This is
currently just a POC.

* custom logger implementation w/o spdlog

* missing cmake file

* fix tests

* use operator<< over direct stream exposure

* rm print header

* add threading test + refactor towards interface libraries

omits the need for =target_include_directories= calls /everywhere/

* rm print header

* rm constexpr

* templated thread_pool

* fix doxyfile

* default enable doc building

* czi reader refactor

* rm erroneous include expression

* clang-format

* single lib include with PUBLIC visibility

* compile imgui stdlib

* clang format

* documentation update

centralize `LogLevelToString` to `ILog.hpp`

update docs and examples
2026-02-16 20:36:48 +01:00

81 lines
2.2 KiB
C++

#pragma once
#include <GLFW/glfw3.h>
#include <format>
#include "ILog.hpp"
#include "imgui_proxy.hpp"
namespace pixelarium::application
{
/// @brief Base class providing scaffolding with GLFW and some default
/// implementations that can be extended and/or overridden by consumers
class AppGLFW
{
public:
explicit AppGLFW(const utils::log::ILog& log) : logger_(log), plot_context_(ImPlot::CreateContext())
{
this->InitMainWindow();
}
~AppGLFW() { ImPlot::DestroyContext(plot_context_); }
AppGLFW(AppGLFW&) = delete;
AppGLFW(const AppGLFW&) = delete;
AppGLFW(AppGLFW&&) = delete;
AppGLFW& operator=(AppGLFW&) = delete;
AppGLFW& operator=(AppGLFW&&) = delete;
/// @brief Start the main render loop
void Start() { this->RunLoop(); }
void SetStatusTimed(const std::string& status, size_t second);
void SetStatus(const std::string& status)
{
logger_.Info(std::format("{}(): {}", __PRETTY_FUNCTION__, status));
status_message_ = status;
show_status_ = true;
}
void ResetStatus()
{
status_message_.clear();
show_status_ = false;
}
protected:
/// @brief Function implementing the first column of the menu bar (e.g. "Menu")
virtual void MenuBarOptionsColumn1() {}
/// @brief Function implementing the second column of the menu bar (e.g. "File")
virtual void MenuBarOptionsColumn2() {}
/// @brief Function implementing the third column of the menu bar (e.g. "Options")
virtual void MenuBarOptionsColumn3() {}
/// @brief Function implementing the fourth column of the menu bar (e.g. "More")
virtual void MenuBarOptionsColumn4() {}
/// @brief Function implementing the first column of the menu bar (e.g. "Help")
virtual void MenuBarOptionsColumn5() {}
/// @brief Main function that gets called within the render loop.
virtual void Run() {}
const utils::log::ILog& logger_;
private:
int RunLoop();
void InitMainWindow();
void MenuBar();
void LogLevelSelect();
int log_level_{0};
GLFWwindow* window = nullptr;
ImPlotContext* plot_context_ = nullptr;
bool show_status_{false};
std::string status_message_{};
};
} // namespace pixelarium::application