/* * Copyright (c) 2025 Aldrik Ramaekers * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #pragma once #include "imgui.h" #include "administration.hpp" #define STATUS_TEXT_LEN 64 namespace ui { typedef enum { UI_INVOICES = 0, UI_EXPENSES = 1, UI_CONTACTS = 2, UI_REPORT_RESULTS = 3, UI_REPORT_TAX = 4, UI_PROJECTS = 5, UI_SETTINGS = 6, UI_LOG = 7, UI_END } main_state; typedef enum { LIST_ALL, EDIT_EXISTING, CREATE, VIEW_EXISTING, VIEW_IMPORT_REQUEST, } view_state; extern ImFont* fontBold; extern ImFont* fontBig; void set_state(main_state state); // Draw calls. void draw_main(); void draw_contacts(); void draw_projects(); void draw_invoices(); void draw_settings(); void draw_expenses(); void draw_earnings(); void draw_log(); void draw_tax_report(); // Setup calls. void setup_invoices(); void setup_contacts(); void setup_projects(); void setup_settings(); void setup_expenses(); void setup_earnings(); void setup_tax_report(); // Destroy calls. void destroy_invoices(); void destroy_settings(); void destroy_expenses(); void destroy_earnings(); void destroy_tax_report(); } namespace ImGui { bool WarningIcon(float radius); bool Button(const char* label, bool block_while_writing_to_disk, bool show_loading_indicator_while_blocked = true); bool CheckboxX(const char* label, bool* v, bool disabled = false, bool show_loading_indicator_while_disabled = false); void InputTextWithError(const char* text, char* buffer, size_t buf_size, bool has_error); int InputTextWithAutocomplete(const char* hint, char* buffer, size_t buf_size, char** suggestions, int suggestion_count, bool has_error); void InputTextWithErrorHint(const char* hint, char* buffer, size_t buf_size, bool has_error); bool FileSelect(char* text, char* buffer); void ContactForm(contact* buffer, bool viewing_only = false, bool with_autocomplete = false, bool active_countries_only = false); void DeliveryInfoForm(delivery_info* buffer, bool viewing_only = false); void AddressForm(address* buffer, a_err last_err, bool active_countries_only = false); void CountryDropdown(char* buffer, size_t buf_size, bool activated_only = false); void ContactTypeDropdown(contact_type* type); void CostCenterDropdown(char* costcenter_id); void ProjectDropdown(char* project_id); void TaxRateDropdown(char* tax_internal_code, bool outgoing, bool has_error); bool CurrencyDropdown(char* currency); void ToggleDropdown(bool *buffer, char* option1, char* option2); }