// src/add_request_dialog.hh - Copyright 2005, 2006, University // of Padova, dept. of Pure and Applied // Mathematics // // This file is part of SGPEMv2. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // SGPEMv2 is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with SGPEMv2; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #ifndef ADD_REQUEST_DIALOG_HH #define ADD_REQUEST_DIALOG_HH 1 namespace sgpem { class Request; class Thread; class AddRequestDialog; } #include #include #include #include #include #include namespace sgpem { /** \brief A dialog derived from add-request-dialog.glade * * Manages the list of subrequests, ensures only "nonempty" requests * are created, and supports also editing. */ class AddRequestDialog : public Gtk::Dialog { public: /** \brief Constructor required by libglademm */ AddRequestDialog(BaseObjectType* cobject, const Glib::RefPtr& glade); /** \brief Attemts to show the dialog, and constructs a new request * if response is OK * \param owner The thread which will own the request * \return A pointer to the created request, or NULL if the request * wasn't created */ Request* run_add(Thread& owner); /** \brief Attemts to show the dialog to modify an existing request * \param request The request to modify */ void run_edit(Request& request); private: /** \brief Fills the combo model with data from the latest * Environment */ void update_combo(); /** \brief Called when the "add subrequest" button is pressed */ void _on_add(); /** \brief Called when the "remove subrequest" button is pressed */ void _on_remove(); /** \brief Called when list selection changes * * Ensures the "remove subrequest" button is sensitive only * if a subrequest is selected */ void _on_list_selection_changed(); /** \brief Called when a row is added to the subrequest list * * Ensures the OK button is sensitive since we are sure there is at * least a subrequest */ void _on_row_added(const Gtk::TreePath& path, const Gtk::TreeIter& it); /** \brief Called when a row is removed from the subrequest list * * Ensures the OK button is no more sensitive if the last item was removed */ void _on_row_removed(const Gtk::TreePath& path); /** \brief Called when the combo selection changes * * Ensures the "add subrequest" button is sensitive only * if a resource is selected */ void _on_combo_selection_changed(); Glib::RefPtr _glade; Gtk::TreeView* _list; Glib::RefPtr _list_model; Gtk::TreeModelColumnRecord _list_columns; Gtk::TreeModelColumn _list_key_column; Gtk::TreeModelColumn _list_resource_column; Gtk::TreeModelColumn _list_duration_column; Gtk::Button* _add_button; Gtk::Button* _remove_button; Gtk::Button* _ok_button; Gtk::SpinButton* _instant_spin; Gtk::SpinButton* _duration_spin; Gtk::ComboBox* _resource_combo; Glib::RefPtr _combo_model; Gtk::TreeModelColumnRecord _combo_columns; Gtk::TreeModelColumn _combo_key_column; Gtk::TreeModelColumn _combo_resource_column; }; } //~ namespace sgpem #endif //~ ADD_REQUEST_DIALOG_HH