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 "../icon-size.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( Inkscape::IconSize size, ViewType view );
36 virtual void setOrientation( Gtk::AnchorType how );
37 virtual int getColumnPref() const { return _prefCols; }
38 virtual void setColumnPref( int cols );
39 virtual Inkscape::IconSize getPreviewSize() const { return _baseSize; }
40 virtual ViewType getPreviewType() const { return _view; }
42 protected:
43 virtual void on_size_allocate( Gtk::Allocation& allocation );
44 virtual void on_size_request( Gtk::Requisition* requisition );
47 private:
48 void rebuildUI();
49 void calcGridSize( const Gtk::Widget* thing, int itemCount, int& width, int& height );
51 std::vector<Previewable*> items;
52 Gtk::Bin *_scroller;
53 Gtk::Table *_insides;
54 int _prefCols;
55 bool _updatesFrozen;
56 Gtk::AnchorType _anchor;
57 Inkscape::IconSize _baseSize;
58 ViewType _view;
59 };
61 } //namespace UI
62 } //namespace Inkscape
64 #endif // SEEN_PREVIEW_HOLDER_H
66 /*
67 Local Variables:
68 mode:c++
69 c-file-style:"stroustrup"
70 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
71 indent-tabs-mode:nil
72 fill-column:99
73 End:
74 */
75 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :