Proper check for rawzor libraries.
[rawtherapee-fixes.git] / rtgui / dirbrowser.h
blob3c9ba970b9573991d9a60eaa14e63bed52139033
1 /*
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/>.
19 #ifndef _DIRBROWSER_
20 #define _DIRBROWSER_
22 #include <gtkmm.h>
23 #include <giomm.h>
24 #ifdef _WIN32
25 #include <windirmonitor.h>
26 #endif
27 #include <dirselectionlistener.h>
28 #include <dirbrowserremoteinterface.h>
30 class DirBrowser : public Gtk::VBox, public DirBrowserRemoteInterface
31 #ifdef _WIN32
32 , public WinDirChangeListener
33 #endif
36 private:
38 Glib::RefPtr<Gtk::TreeStore> dirTreeModel;
40 struct DirTreeColumns : public Gtk::TreeModelColumnRecord {
41 public:
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;
46 #ifdef _WIN32
47 Gtk::TreeModelColumn<Glib::RefPtr<WinDirMonitor> > monitor;
48 #else
49 Gtk::TreeModelColumn<Glib::RefPtr<Gio::FileMonitor> > monitor;
50 #endif
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;
64 void fillRoot ();
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;
74 bool expandSuccess;
76 #ifdef WIN32
77 int volumes;
78 public:
79 void updateVolumes ();
80 void updateDirTree (const Gtk::TreeModel::iterator& iter);
81 void updateDirTreeRoot ();
82 void winDirChanged ();
83 private:
84 void addRoot (char letter);
85 #endif
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 ();
91 public:
92 DirBrowser ();
94 void fillDirTree ();
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);
103 #endif