ORE Studio 0.0.4
Loading...
Searching...
No Matches
country_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_COUNTRY_LIST_WIDGET_HPP
21#define ORES_WT_SERVICE_APP_COUNTRY_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 alpha2_code;
38 std::string alpha3_code;
39 std::string name;
40 std::string numeric_code;
41 int version = 0;
42};
43
47class country_list_widget : public Wt::WContainerWidget {
48public:
50
51 Wt::Signal<>& add_requested() { return add_requested_; }
52 Wt::Signal<std::string>& edit_requested() { return edit_requested_; }
53 Wt::Signal<std::string>& delete_requested() { return delete_requested_; }
54
55 void refresh();
56 void set_countries(const std::vector<country_row>& countries);
57
58private:
59 void setup_toolbar();
60 void setup_table();
61 void populate_table();
62
63 Wt::WTable* table_;
64 Wt::WText* status_text_;
65 Wt::WPushButton* add_button_;
66 Wt::WPushButton* refresh_button_;
67
68 std::vector<country_row> countries_;
69 Wt::Signal<> add_requested_;
70 Wt::Signal<std::string> edit_requested_;
71 Wt::Signal<std::string> delete_requested_;
72};
73
74}
75
76#endif
Country data for display.
Definition country_list_widget.hpp:36
Widget displaying list of countries with CRUD operations.
Definition country_list_widget.hpp:47