1 /* === S Y N F I G ========================================================= */
2 /*! \file widget_filename.cpp
3 ** \brief Template File
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 ** Copyright (c) 2008 Chris Moore
11 ** This package is free software; you can redistribute it and/or
12 ** modify it under the terms of the GNU General Public License as
13 ** published by the Free Software Foundation; either version 2 of
14 ** the License, or (at your option) any later version.
16 ** This package is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ** General Public License for more details.
22 /* ========================================================================= */
24 /* === H E A D E R S ======================================================= */
33 #include <gtkmm/entry.h>
34 #include <gtkmm/button.h>
35 #include "widget_filename.h"
42 /* === U S I N G =========================================================== */
45 //using namespace etl;
46 //using namespace synfig;
47 using namespace studio;
49 /* === M A C R O S ========================================================= */
51 /* === G L O B A L S ======================================================= */
53 /* === P R O C E D U R E S ================================================= */
55 /* === M E T H O D S ======================================================= */
57 Widget_Filename::Widget_Filename()
59 entry_filename=manage(new Gtk::Entry());
60 button_choose=manage(new Gtk::Button(_("Find")));
62 pack_start(*entry_filename);
63 pack_start(*button_choose);
64 entry_filename->show();
65 button_choose->show();
67 button_choose->signal_clicked().connect(sigc::mem_fun(*this, &studio::Widget_Filename::on_button_choose_pressed));
68 //entry_filename->signal_value_changed().connect(sigc::mem_fun(*this, &studio::Widget_Filename::on_value_changed));
69 entry_filename->signal_activate().connect(sigc::mem_fun(*this, &studio::Widget_Filename::on_value_changed));
72 Widget_Filename::~Widget_Filename()
77 Widget_Filename::set_has_frame(bool x)
79 entry_filename->set_has_frame(x);
84 Widget_Filename::set_value(const std::string &data)
86 entry_filename->set_text(data);
90 Widget_Filename::get_value() const
94 return entry_filename->get_text();
98 throw string("Caught unknown exception");
103 Widget_Filename::on_value_changed()
105 signal_value_changed()();
109 Widget_Filename::on_button_choose_pressed()
111 string filename=entry_filename->get_text();
114 if(App::dialog_open_file(_("Choose File"), filename, MISC_DIR_PREFERENCE))
115 entry_filename->set_text(filename);