summaryrefslogtreecommitdiff
path: root/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'dialogs')
-rw-r--r--dialogs/confirm.cpp30
-rw-r--r--dialogs/confirm.hpp14
2 files changed, 44 insertions, 0 deletions
diff --git a/dialogs/confirm.cpp b/dialogs/confirm.cpp
new file mode 100644
index 0000000..1300aff
--- /dev/null
+++ b/dialogs/confirm.cpp
@@ -0,0 +1,30 @@
+#include "confirm.hpp"
+
+ConfirmDialog::ConfirmDialog(Gtk::Window &parent)
+ : Gtk::Dialog("Confirm", parent, true)
+ , m_layout(Gtk::ORIENTATION_VERTICAL)
+ , m_bbox(Gtk::ORIENTATION_HORIZONTAL)
+ , m_ok("OK")
+ , m_cancel("Cancel") {
+ set_default_size(300, 50);
+
+ m_label.set_text("Are you sure?");
+
+ m_ok.signal_clicked().connect([&]() {
+ response(Gtk::RESPONSE_OK);
+ });
+
+ m_cancel.signal_clicked().connect([&]() {
+ response(Gtk::RESPONSE_CANCEL);
+ });
+
+ m_bbox.pack_start(m_ok, Gtk::PACK_SHRINK);
+ m_bbox.pack_start(m_cancel, Gtk::PACK_SHRINK);
+ m_bbox.set_layout(Gtk::BUTTONBOX_END);
+
+ m_layout.add(m_label);
+ m_layout.add(m_bbox);
+ get_content_area()->add(m_layout);
+
+ show_all_children();
+}
diff --git a/dialogs/confirm.hpp b/dialogs/confirm.hpp
new file mode 100644
index 0000000..3bf338d
--- /dev/null
+++ b/dialogs/confirm.hpp
@@ -0,0 +1,14 @@
+#pragma once
+#include <gtkmm.h>
+
+class ConfirmDialog : public Gtk::Dialog {
+public:
+ ConfirmDialog(Gtk::Window &parent);
+
+protected:
+ Gtk::Label m_label;
+ Gtk::Box m_layout;
+ Gtk::Button m_ok;
+ Gtk::Button m_cancel;
+ Gtk::ButtonBox m_bbox;
+};