Skip to content
API Documentation
BastionGuard™
PhishingCheckCard.hpp
Go to the documentation of this file.
1/*
2 * BastionGuard™
3 * Copyright (C) 2025–2026 Calogero Scarnà
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 *
17 * BastionGuard™ is a trademark of Calogero Scarnà.
18 * The BastionGuard™ name and branding are not licensed under the GPL.
19 */
20
21#pragma once
22
23#include <gtkmm.h>
24#include <sigc++/sigc++.h>
25
26class PhishingCheckCard : public Gtk::Box {
27public:
29 virtual ~PhishingCheckCard() = default;
30
31 sigc::signal<void(const Glib::ustring&)>& signal_analyze_requested();
32
33 void set_title(const Glib::ustring& text);
34 void set_description(const Glib::ustring& text);
35 void set_placeholder(const Glib::ustring& text);
36 void set_button_label(const Glib::ustring& text);
37 void set_feedback(const Glib::ustring& text, bool is_error = false);
38 void clear_feedback();
39
40 Glib::ustring get_url() const;
41 void set_url(const Glib::ustring& url);
42
43private:
44 void on_analyze_clicked();
45 bool is_valid_url(const Glib::ustring& url) const;
46
47 Gtk::Box root_box_{Gtk::Orientation::HORIZONTAL, 16};
48 Gtk::Box icon_box_{Gtk::Orientation::VERTICAL, 0};
49 Gtk::Box content_box_{Gtk::Orientation::VERTICAL, 8};
50 Gtk::Box action_row_{Gtk::Orientation::HORIZONTAL, 12};
51
52 Gtk::Image icon_;
53 Gtk::Label lbl_title_;
54 Gtk::Label lbl_description_;
55 Gtk::Entry entry_url_;
56 Gtk::Button btn_analyze_;
57 Gtk::Label lbl_feedback_;
58
59 sigc::signal<void(const Glib::ustring&)> signal_analyze_requested_;
60};
void set_url(const Glib::ustring &url)
virtual ~PhishingCheckCard()=default
void set_button_label(const Glib::ustring &text)
sigc::signal< void(const Glib::ustring &)> signal_analyze_requested_
void set_placeholder(const Glib::ustring &text)
Glib::ustring get_url() const
void set_description(const Glib::ustring &text)
bool is_valid_url(const Glib::ustring &url) const
sigc::signal< void(const Glib::ustring &)> & signal_analyze_requested()
void set_feedback(const Glib::ustring &text, bool is_error=false)
void set_title(const Glib::ustring &text)