summaryrefslogtreecommitdiff
path: root/src/dialogs
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2022-06-23 00:48:00 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2022-06-23 00:48:00 -0400
commitd841a2c862eddc6b2053b48907f8e1400e2d1391 (patch)
tree77741f5d2cb9908f86cd7c1c737b2c52ade4fd3e /src/dialogs
parent4ee7025ab09b606a2556bf9f42c1218d7fd72843 (diff)
downloadabaddon-portaudio-d841a2c862eddc6b2053b48907f8e1400e2d1391.tar.gz
abaddon-portaudio-d841a2c862eddc6b2053b48907f8e1400e2d1391.zip
add change filename
Diffstat (limited to 'src/dialogs')
-rw-r--r--src/dialogs/textinput.cpp26
-rw-r--r--src/dialogs/textinput.hpp14
2 files changed, 40 insertions, 0 deletions
diff --git a/src/dialogs/textinput.cpp b/src/dialogs/textinput.cpp
new file mode 100644
index 0000000..ae75f70
--- /dev/null
+++ b/src/dialogs/textinput.cpp
@@ -0,0 +1,26 @@
+#include "textinput.hpp"
+
+TextInputDialog::TextInputDialog(const Glib::ustring &prompt, const Glib::ustring &title, const Glib::ustring &placeholder, Gtk::Window &parent)
+ : Gtk::Dialog(title, parent, true)
+ , m_label(prompt) {
+ get_style_context()->add_class("app-window");
+ get_style_context()->add_class("app-popup");
+
+ auto ok = add_button("OK", Gtk::RESPONSE_OK);
+ auto cancel = add_button("Cancel", Gtk::RESPONSE_CANCEL);
+
+ get_content_area()->add(m_label);
+ get_content_area()->add(m_entry);
+
+ m_entry.set_text(placeholder);
+
+ m_entry.set_activates_default(true);
+ ok->set_can_default(true);
+ ok->grab_default();
+
+ show_all_children();
+}
+
+Glib::ustring TextInputDialog::GetInput() const {
+ return m_entry.get_text();
+}
diff --git a/src/dialogs/textinput.hpp b/src/dialogs/textinput.hpp
new file mode 100644
index 0000000..fd2d2b8
--- /dev/null
+++ b/src/dialogs/textinput.hpp
@@ -0,0 +1,14 @@
+#pragma once
+#include <gtkmm/dialog.h>
+#include <gtkmm/entry.h>
+
+class TextInputDialog : public Gtk::Dialog {
+public:
+ TextInputDialog(const Glib::ustring &prompt, const Glib::ustring &title, const Glib::ustring &placeholder, Gtk::Window &parent);
+
+ Glib::ustring GetInput() const;
+
+private:
+ Gtk::Label m_label;
+ Gtk::Entry m_entry;
+};