Proper check for rawzor libraries.
[rawtherapee-fixes.git] / rtgui / thumbnailbrowser.h
blob9f0731cf43242bc3d4d6d8351b4096da5d148e05
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 _THUMBNAILBROWSER_
20 #define _THUMBNAILBROWSER_
22 #include <gtkmm.h>
23 #include <thumbnail.h>
24 #include <filecatalog.h>
26 class ThumbBrowserEntry {
28 public:
29 // set by arrangeFiles():
30 int width; // minimal width
31 int height; // minimal height
32 int exp_width; // ararnged width
33 int startx; // x coord. in the widget
34 int starty; // y coord. in the widget
35 // thumbnail preview properties:
36 int prew; // width of the thumbnail
37 int preh; // height of the thumbnail
38 guint8* preview;
39 // file and directory attributes:
40 Glib::ustring filename;
41 Glib::ustring shortname;
42 Glib::ustring dirname;
43 // the associated thumbnail instance:
44 Thumbnail* thumbnail;
46 ThumbBrowserEntry (Thumbnail* thm, Glib::ustring fname, Glib::ustring sname, Glib::ustring dname, int h)
47 : thumbnail(thm), filename(fname), shortname(sname), dirname(dname), preh(h) {
48 preview = thumbnail ? (guint8*) thumbnail->getThumbnailImage (prew, preh) : NULL;
51 bool operator< (FileDescr& other) {
52 return shortname>other.shortname;
56 class ThumbBrowser : public Gtk::DrawingArea {
58 protected:
59 int dx, dy, w, h;
61 Glib::RefPtr<Gdk::GC> gc_;
62 Gdk::Color black;
63 Gdk::Color white;
64 Gdk::Color blue;
65 Gdk::Color bluew;
67 std::vector<ThumbBrowserEntry*> fd;
68 std::vector<ThumbBrowserEntry*> selected;
70 int rowHeight;
71 int numOfRows;
73 ThumbBrowserListener* tbl;
75 void arrangeFiles (int rows);
77 public:
79 ThumbBrowser ();
81 void addEntry (ThumbBrowserEntry* entry);
82 void setThumbBrowserListener (ThumbBrowserListener* l) { tbl = l; }
84 virtual void on_realize();
85 virtual bool on_expose_event(GdkEventExpose* event);
86 virtual bool on_button_press_event (GdkEventButton* event);
87 virtual bool on_button_release_event (GdkEventButton* event);
88 virtual void previewReady (FileDescr* fdn);
90 void resized (Gtk::Allocation& req);
91 void redraw ();
92 void styleChanged (const Glib::RefPtr<Gtk::Style>& style);
95 #endif