summaryrefslogtreecommitdiff
path: root/include/administration.hpp
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-09-13 08:54:05 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-09-13 08:54:05 +0200
commitfb1ae39f1abe0dd0335489451e09a24e2336e606 (patch)
tree8bd482a824c11b67581679e6a445a39e11b607e7 /include/administration.hpp
parent5159a53e58cd4b3652ce6255856d50e15c275f80 (diff)
handle file saving through administration callbacks
Diffstat (limited to 'include/administration.hpp')
-rw-r--r--include/administration.hpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/include/administration.hpp b/include/administration.hpp
index 9df4335..b971e2c 100644
--- a/include/administration.hpp
+++ b/include/administration.hpp
@@ -307,6 +307,15 @@ typedef struct
quarterly_report quarters[MAX_LEN_INCOME_STATEMENT_REPORT_QUARTERS];
} income_statement;
+// Administration callback functions.
+typedef void (*data_changed_event)();
+typedef void (*data_deleted_event)(char id[MAX_LEN_ID]);
+typedef void (*invoice_changed_event)(invoice* invoice);
+typedef void (*contact_changed_event)(contact* contact);
+typedef void (*taxbracket_changed_event)(country_tax_bracket* bracket);
+typedef void (*costcenter_changed_event)(cost_center* cost_center);
+typedef void (*project_changed_event)(project* project);
+
typedef struct
{
contact company_info; // Company info used for invoices. User cannot create invoices when this is empty/invalid.
@@ -333,9 +342,19 @@ void administration_create();
void administration_destroy();
void administration_create_empty(char* save_file);
+// Callback functions.
+// =======================
+void administration_set_data_changed_event_callback(data_changed_event ev);
+void administration_set_data_deleted_event_callback(data_deleted_event ev);
+void administration_set_invoice_changed_event_callback(invoice_changed_event ev);
+void administration_set_contact_changed_event_callback(contact_changed_event ev);
+void administration_set_taxbracket_changed_event_callback(taxbracket_changed_event ev);
+void administration_set_costcenter_changed_event_callback(costcenter_changed_event ev);
+void administration_set_project_changed_event_callback(project_changed_event ev);
+
// Other functions.
// =======================
-administration* administration_get();
+administration* administration_get(); // TODO get rid of this and make indivual getters and setters
char* administration_file_path_get();
contact administration_company_info_get();
void administration_company_info_set(contact data);
@@ -343,7 +362,7 @@ void administration_create_income_statement(income_statement* statement);
char* administration_get_currency_symbol_from_currency(char* code);
char* administration_get_default_currency();
bool administration_can_create_invoices();
-bool administration_is_loaded();
+bool administration_has_save_path();
// Contact functions.
// =======================