Code

d165e5bf93b3f3dd4531bfc845902f6a2ecfb176
[inkscape.git] / src / ui / previewholder.h
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"
21 namespace Inkscape {
22 namespace UI {
24 class PreviewHolder : public Gtk::VBox, public PreviewFillable
25 {
26 public:
27     PreviewHolder();
28     virtual ~PreviewHolder();
30     virtual void clear();
31     virtual void addPreview( Previewable* preview );
32     virtual void setStyle(Gtk::BuiltinIconSize size, ViewType view);
33     virtual void setOrientation( Gtk::AnchorType how );
34     virtual int getColumnPref() const { return _prefCols; }
35     virtual void setColumnPref( int cols );
36     virtual Gtk::BuiltinIconSize getPreviewSize() const { return _baseSize; }
37     virtual ViewType getPreviewType() const { return _view; }
39 protected:
40     virtual void on_size_allocate( Gtk::Allocation& allocation );
41     virtual void on_size_request( Gtk::Requisition* requisition );
44 private:
45     void rebuildUI();
46     void calcGridSize( const Gtk::Widget* thing, int itemCount, int& width, int& height );
48     std::vector<Previewable*> items;
49     Gtk::Bin *_scroller;
50     Gtk::Table *_insides;
51     int _prefCols;
52     Gtk::AnchorType _anchor;
53     Gtk::BuiltinIconSize _baseSize;
54     ViewType _view;
55 };
57 } //namespace UI
58 } //namespace Inkscape
60 #endif // SEEN_PREVIEW_HOLDER_H
62 /*
63   Local Variables:
64   mode:c++
65   c-file-style:"stroustrup"
66   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
67   indent-tabs-mode:nil
68   fill-column:99
69   End:
70 */
71 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :