ORE Studio 0.0.4
Loading...
Searching...
No Matches
currency_list_widget.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_WT_SERVICE_APP_CURRENCY_LIST_WIDGET_HPP
21#define ORES_WT_SERVICE_APP_CURRENCY_LIST_WIDGET_HPP
22
23#include <Wt/WContainerWidget.h>
24#include <Wt/WTable.h>
25#include <Wt/WPushButton.h>
26#include <Wt/WText.h>
27#include <Wt/WSignal.h>
28#include <vector>
29#include <string>
30
31namespace ores::wt::service::app {
32
37 std::string iso_code;
38 std::string name;
39 std::string symbol;
40 std::string numeric_code;
41 std::string monetary_nature;
42 std::string market_tier;
43 int version = 0;
44};
45
49class currency_list_widget : public Wt::WContainerWidget {
50public:
52
53 Wt::Signal<>& add_requested() { return add_requested_; }
54 Wt::Signal<std::string>& edit_requested() { return edit_requested_; }
55 Wt::Signal<std::string>& delete_requested() { return delete_requested_; }
56
57 void refresh();
58 void set_currencies(const std::vector<currency_row>& currencies);
59
60private:
61 void setup_toolbar();
62 void setup_table();
63 void populate_table();
64
65 Wt::WTable* table_;
66 Wt::WText* status_text_;
67 Wt::WPushButton* add_button_;
68 Wt::WPushButton* refresh_button_;
69
70 std::vector<currency_row> currencies_;
71 Wt::Signal<> add_requested_;
72 Wt::Signal<std::string> edit_requested_;
73 Wt::Signal<std::string> delete_requested_;
74};
75
76}
77
78#endif
Currency data for display.
Definition currency_list_widget.hpp:36
Widget displaying list of currencies with CRUD operations.
Definition currency_list_widget.hpp:49