sgpemv2/src/add_request_dialog.hh

94 lines
2.8 KiB
C++
Raw Normal View History

// 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;
}
#include "config.h"
#include <gtkmm/treeview.h>
#include <gtkmm/liststore.h>
#include <gtkmm/dialog.h>
#include <gtkmm/combobox.h>
#include <gtkmm/spinbutton.h>
#include <libglademm/xml.h>
namespace sgpem
{
class AddRequestDialog : public Gtk::Dialog
{
public:
AddRequestDialog(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade);
/**
\brief Attemts to show the dialog, and constructs a request
if response is OK
\param owner The thread which will own the request
*/
Request* run_add(Thread& owner);
/**
\brief Attemts to show the dialog, and modify an existing request
if response is OK
\param resource The request to modify
*/
void run_edit(Request& resource);
private:
void update_combo();
void _on_add();
void _on_remove();
void _on_list_selection_changed();
void _on_row_added(const Gtk::TreePath& path, const Gtk::TreeIter& it);
void _on_row_removed(const Gtk::TreePath& path);
void _on_combo_selection_changed();
Glib::RefPtr<Gnome::Glade::Xml> _glade;
Gtk::TreeView* _list;
Glib::RefPtr<Gtk::ListStore> _list_model;
Gtk::TreeModelColumnRecord _list_columns;
Gtk::TreeModelColumn<unsigned int> _list_key_column;
Gtk::TreeModelColumn<Glib::ustring> _list_resource_column;
Gtk::TreeModelColumn<unsigned int> _list_length_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<Gtk::ListStore> _combo_model;
Gtk::TreeModelColumnRecord _combo_columns;
Gtk::TreeModelColumn<unsigned int> _combo_key_column;
Gtk::TreeModelColumn<Glib::ustring> _combo_resource_column;
};
} //~ namespace sgpem
#endif //~ ADD_REQUEST_DIALOG_HH