2 #ifndef SEEN_PREVIEW_HOLDER_H
3 #define SEEN_PREVIEW_HOLDER_H
4 /*
5 * A simple interface for previewing representations.
6 *
7 * Authors:
8 * Jon A. Cruz
9 *
10 * Copyright (C) 2005 Jon A. Cruz
11 *
12 * Released under GNU GPL, read the file 'COPYING' for more information
13 */
16 #include <gtkmm/box.h>
17 #include <gtkmm/bin.h>
18 #include <gtkmm/table.h>
19 #include "previewfillable.h"
20 #include "../dialogs/eek-preview.h"
22 namespace Inkscape {
23 namespace UI {
25 class PreviewHolder : public Gtk::VBox, public PreviewFillable
26 {
27 public:
28 PreviewHolder();
29 virtual ~PreviewHolder();
31 virtual void clear();
32 virtual void addPreview( Previewable* preview );
33 virtual void freezeUpdates();
34 virtual void thawUpdates();
35 virtual void setStyle( ::PreviewSize size, ViewType view, guint ratio );
36 virtual void setOrientation( Gtk::AnchorType how );
37 virtual int getColumnPref() const { return _prefCols; }
38 virtual void setColumnPref( int cols );
39 virtual ::PreviewSize getPreviewSize() const { return _baseSize; }
40 virtual ViewType getPreviewType() const { return _view; }
41 virtual guint getPreviewRatio() const { return _ratio; }
42 virtual void setWrap( bool b );
43 virtual bool getWrap() const { return _wrap; }
45 protected:
46 virtual void on_size_allocate( Gtk::Allocation& allocation );
47 virtual void on_size_request( Gtk::Requisition* requisition );
50 private:
51 void rebuildUI();
52 void calcGridSize( const Gtk::Widget* thing, int itemCount, int& width, int& height );
54 std::vector<Previewable*> items;
55 Gtk::Bin *_scroller;
56 Gtk::Table *_insides;
57 int _prefCols;
58 bool _updatesFrozen;
59 Gtk::AnchorType _anchor;
60 ::PreviewSize _baseSize;
61 guint _ratio;
62 ViewType _view;
63 bool _wrap;
64 };
66 } //namespace UI
67 } //namespace Inkscape
69 #endif // SEEN_PREVIEW_HOLDER_H
71 /*
72 Local Variables:
73 mode:c++
74 c-file-style:"stroustrup"
75 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
76 indent-tabs-mode:nil
77 fill-column:99
78 End:
79 */
80 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :