#ifndef XFILESEL_H
#define XFILESEL_H
//$Id: XFileSel.h,v 1.18 2004/09/06 05:04:43 markus Rel $
// This program 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.
// This program 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 this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <string>
#include <gtkmm/treestore.h>
#include <YGP/SmartPtr.h>
#include <XGP/XDialog.h>
// Forward declarations
namespace Gtk {
class VBox;
class Label;
class Entry;
class Table;
class Button;
class TreeView;
class ScrolledWindow;
}
typedef YGP::SmartPtr<Gtk::VBox> PVBox;
typedef YGP::SmartPtr<Gtk::Label> PLabel;
typedef YGP::SmartPtr<Gtk::Entry> PEntry;
typedef YGP::SmartPtr<Gtk::Table> PTable;
typedef YGP::SmartPtr<Gtk::Button> PButton;
typedef YGP::SmartPtr<Gtk::TreeView> PTreeView;
typedef YGP::SmartPtr<Gtk::ScrolledWindow> PScrolledWindow;
// Class to select files to in- or exclude; files must be entered; there's
// no file-selection dialog because mainly files with wildcards are handled
class XFileSelection : public XGP::XDialog {
public:
XFileSelection (std::string& files, const Glib::ustring& title);
~XFileSelection ();
static XFileSelection* create (std::string& files, const std::string& title) {
XFileSelection* dlg (new XFileSelection (files, title));
dlg->signal_response ().connect (mem_fun (*dlg, &XFileSelection::free));
return dlg;
}
private:
// Prohibited manager-functions
XFileSelection (const XFileSelection&);
const XFileSelection& operator= (const XFileSelection&);
// Event-handling
typedef enum { INCLUDE, EXCLUDE, UP, DOWN, DELETE } commands;
virtual void okEvent ();
void command (commands id);
void entryChanged ();
bool canSelect (const Glib::RefPtr<Gtk::TreeModel>& model,
const Gtk::TreeModel::Path& path, bool) const;
void rowSelected ();
void moveSelectedRowUp ();
void moveSelectedRowDown ();
Gtk::TreeIter makeParentEntry
(char type, const Gtk::TreeIter pos);
Gtk::TreeIter getPrevious (const Gtk::TreeNodeChildren& list,
const Gtk::TreeIter act) const;
PVBox actions;
PVBox listActions;
PLabel lblFiles;
PEntry file;
PTable tblFile;
PButton include;
PButton exclude;
PButton delEntry;
PButton upEntry;
PButton downEntry;
std::string& target;
// Class for the columns in the in/exclude list
class ListColumns : public Gtk::TreeModel::ColumnRecord {
public:
Gtk::TreeModelColumn <std::string> files;
Gtk::TreeModelColumn <char> type;
ListColumns () { add (files); add (type); }
};
ListColumns cols;
Glib::RefPtr<Gtk::TreeStore> vFiles;
PTreeView treeFiles;
PScrolledWindow scroll;
};
#endif
syntax highlighted by Code2HTML, v. 0.9.1