#include <gtkmm/inputdialog.h>
#include <gtkmm/accelmap.h>
#include <gtkmm/uimanager.h>
+#include <gtkmm/textview.h>
#include <gtk/gtk.h>
Gtk::Dialog dialog(
title, // Title
true, // Modal
- true // use_separator
- );
+ true); // use_separator
+
Gtk::Label label(message);
label.show();
dialog.get_vbox()->pack_start(label);
entry.set_text(text);
entry.show();
entry.set_activates_default(true);
+
dialog.get_vbox()->pack_start(entry);
dialog.add_button(Gtk::StockID("gtk-ok"),Gtk::RESPONSE_OK);
dialog.add_button(Gtk::StockID("gtk-cancel"),Gtk::RESPONSE_CANCEL);
dialog.set_default_response(Gtk::RESPONSE_OK);
+
entry.signal_activate().connect(sigc::bind(sigc::mem_fun(dialog,&Gtk::Dialog::response),Gtk::RESPONSE_OK));
dialog.show();
return true;
}
+bool
+App::dialog_paragraph(const std::string &title, const std::string &message,std::string &text)
+{
+ Gtk::Dialog dialog(
+ title, // Title
+ true, // Modal
+ true); // use_separator
+
+ Gtk::Label label(message);
+ label.show();
+ dialog.get_vbox()->pack_start(label);
+ Glib::RefPtr<Gtk::TextBuffer> text_buffer(Gtk::TextBuffer::create());
+ text_buffer->set_text(text);
+ Gtk::TextView text_view(text_buffer);
+ text_view.show();
+ dialog.get_vbox()->pack_start(text_view);
+
+ dialog.add_button(Gtk::StockID("gtk-ok"),Gtk::RESPONSE_OK);
+ dialog.add_button(Gtk::StockID("gtk-cancel"),Gtk::RESPONSE_CANCEL);
+ dialog.set_default_response(Gtk::RESPONSE_OK);
+
+ //text_entry.signal_activate().connect(sigc::bind(sigc::mem_fun(dialog,&Gtk::Dialog::response),Gtk::RESPONSE_OK));
+ dialog.show();
+
+ if(dialog.run()!=Gtk::RESPONSE_OK)
+ return false;
+
+ text=text_buffer->get_text();
+
+ return true;
+}
bool
App::open(std::string filename)
static void dialog_warning_blocking(const std::string &title, const std::string &message);
static bool dialog_entry(const std::string &title, const std::string &message,std::string &text);
+ static bool dialog_paragraph(const std::string &title, const std::string &message,std::string &text);
static bool dialog_yes_no(const std::string &title, const std::string &message);