2 * This file is part of RawTherapee.
4 * Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
6 * RawTherapee is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * RawTherapee is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
25 #include <windirmonitor.h>
27 #include <dirselectionlistener.h>
28 #include <dirbrowserremoteinterface.h>
30 class DirBrowser
: public Gtk::VBox
, public DirBrowserRemoteInterface
32 , public WinDirChangeListener
38 Glib::RefPtr
<Gtk::TreeStore
> dirTreeModel
;
40 struct DirTreeColumns
: public Gtk::TreeModelColumnRecord
{
42 Gtk::TreeModelColumn
<Glib::ustring
> filename
;
43 Gtk::TreeModelColumn
<Glib::RefPtr
<Gdk::Pixbuf
> > icon1
;
44 Gtk::TreeModelColumn
<Glib::RefPtr
<Gdk::Pixbuf
> > icon2
;
45 Gtk::TreeModelColumn
<Glib::ustring
> dirname
;
47 Gtk::TreeModelColumn
<Glib::RefPtr
<WinDirMonitor
> > monitor
;
49 Gtk::TreeModelColumn
<Glib::RefPtr
<Gio::FileMonitor
> > monitor
;
52 DirTreeColumns() { add(icon1
); add(icon2
); add(filename
); add(dirname
); add(monitor
); }
55 Gtk::TreeViewColumn tvc
;
56 Gtk::CellRendererText crt
;
57 Gtk::CellRendererPixbuf crb
;
58 DirTreeColumns dtColumns
;
60 Gtk::TreeView
*dirtree
;
61 Gtk::ScrolledWindow
*scrolledwindow4
;
62 std::vector
<DirSelectionListener
*> dllisteners
;
66 Glib::RefPtr
<Gdk::Pixbuf
> openfolder
;
67 Glib::RefPtr
<Gdk::Pixbuf
> closedfolder
;
68 Glib::RefPtr
<Gdk::Pixbuf
> icdrom
;
69 Glib::RefPtr
<Gdk::Pixbuf
> ifloppy
;
70 Glib::RefPtr
<Gdk::Pixbuf
> ihdd
;
71 Glib::RefPtr
<Gdk::Pixbuf
> inetwork
;
72 Glib::RefPtr
<Gdk::Pixbuf
> iremovable
;
79 void updateVolumes ();
80 void updateDirTree (const Gtk::TreeModel::iterator
& iter
);
81 void updateDirTreeRoot ();
82 void winDirChanged ();
84 void addRoot (char letter
);
86 void addDir (const Gtk::TreeModel::iterator
& iter
, const Glib::ustring
& dirname
);
87 Gtk::TreePath
expandToDir (const Glib::ustring
& dirName
);
88 void updateDir (const Gtk::TreeModel::iterator
& iter
);
89 void notifyListeners ();
95 void row_expanded (const Gtk::TreeModel::iterator
& iter
, const Gtk::TreeModel::Path
& path
);
96 void row_activated (const Gtk::TreeModel::Path
& path
, Gtk::TreeViewColumn
* column
);
97 void file_changed (const Glib::RefPtr
<Gio::File
>& file
, const Glib::RefPtr
<Gio::File
>& other_file
, Gio::FileMonitorEvent event_type
, const Gtk::TreeModel::iterator
& iter
, const Glib::ustring
& dirName
);
98 void open (const Glib::ustring
& dirName
, const Glib::ustring
& fileName
=""); // goes to dir "dirName" and selects file "fileName"
99 void addDirSelectionListener (DirSelectionListener
* l
) { dllisteners
.push_back (l
); }
100 void selectDir (Glib::ustring dir
);