#ifndef DCFILELIST_H
#define DCFILELIST_H
//$Id: DCFileList.h,v 1.14 2006/06/05 16:45:39 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 <map>
#include <string>
#include <gtkmm/treestore.h>
#include <XGP/XFileList.h>
namespace Gtk {
class Menu;
}
class DCFileList : public XGP::XFileList {
public:
DCFileList ();
virtual ~DCFileList ();
class FileCols : public XGP::FileColumns {
public:
Gtk::TreeModelColumn <Glib::ustring> timeOrig;
Gtk::TreeModelColumn <Glib::ustring> timeComp;
Gtk::TreeModelColumn <Glib::ustring> status;
Gtk::TreeModelColumn <YGP::File*> fileOrig;
Gtk::TreeModelColumn <YGP::File*> fileComp;
FileCols () : XGP::FileColumns () {
add (timeOrig); add (timeComp); add (status); add (fileOrig);
add (fileComp); }
};
//@Section access to model
const FileCols& getColumns () const { return cols; }
unsigned int rows () const {
return const_cast<DCFileList*> (this)->files->children ().size (); }
void appendDirectory (const std::string& dir);
void appendFile (const std::string& prefix, const YGP::File* orig,
const YGP::File* comp, const std::string& stat);
Gtk::TreeRow row (unsigned int row) const { return (files->children ())[row]; }
void clear ();
void finish () { directories.clear (); }
void deleteRow (const Gtk::TreeIter& row);
protected:
virtual std::string getFilename (const Gtk::TreeIter& line) const;
virtual void setFilename (Gtk::TreeIter& line, const std::string& file);
virtual void addMenus (Gtk::Menu& menu, const Gtk::TreeIter& line);
private:
DCFileList (const DCFileList& other);
const DCFileList& operator= (const DCFileList& other);
void startDiff (const Gtk::TreeIter& line);
void execute (const char* file, const Gtk::TreeIter& line);
void execute2 (const char* file, const Gtk::TreeIter& line);
const FileCols cols;
Glib::RefPtr<Gtk::TreeStore> files;
std::map<std::string, Gtk::TreeIter> directories;
};
#endif
syntax highlighted by Code2HTML, v. 0.9.1