Improve dialog

This commit is contained in:
daleclack 2022-10-17 23:17:11 +08:00
parent 1e3406285e
commit 450937a257
2 changed files with 9 additions and 0 deletions

View File

@ -7,6 +7,7 @@ InputBox::InputBox(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &re
{
// Get Widgets
ref_builder->get_widget("entry_name", entry_name);
entry_name->signal_activate().connect(sigc::mem_fun(*this, &InputBox::entry_activated));
}
void InputBox::on_response(int response_id){
@ -57,6 +58,11 @@ void InputBox::set_game_time(int time){
game_time = time;
}
void InputBox::entry_activated(){
// Default response
response(Gtk::RESPONSE_OK);
}
InputBox *InputBox::create(Gtk::Window &parent)
{
// Create a inputbox object

View File

@ -28,4 +28,7 @@ class InputBox : public Gtk::Dialog{
// Child widget
Gtk::Entry *entry_name;
// Signal Handlers
void entry_activated();
};