summaryrefslogtreecommitdiffstats
path: root/src/ui/previewholder.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
commitcca66b9ec4e494c1d919bff0f71a820d8afab1fa (patch)
tree146f39ded1c938019e1ed42d30923c2ac9e86789 /src/ui/previewholder.h
parentInitial commit. (diff)
downloadinkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.tar.xz
inkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.zip
Adding upstream version 1.2.2.upstream/1.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/ui/previewholder.h')
-rw-r--r--src/ui/previewholder.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/src/ui/previewholder.h b/src/ui/previewholder.h
new file mode 100644
index 0000000..1dd35bf
--- /dev/null
+++ b/src/ui/previewholder.h
@@ -0,0 +1,91 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#ifndef SEEN_PREVIEW_HOLDER_H
+#define SEEN_PREVIEW_HOLDER_H
+/*
+ * A simple interface for previewing representations.
+ * Used by Swatches
+ *
+ * Authors:
+ * Jon A. Cruz
+ *
+ * Copyright (C) 2005 Jon A. Cruz
+ *
+ * Released under GNU GPL v2+, read the file 'COPYING' for more information.
+ */
+
+#include <gtkmm/bin.h>
+#include <ui/widget/preview.h>
+
+namespace Gtk {
+class Grid;
+class ScrolledWindow;
+}
+
+#include "enums.h"
+
+namespace Inkscape {
+namespace UI {
+
+class Previewable;
+
+class PreviewHolder : public Gtk::Bin
+{
+public:
+ PreviewHolder();
+ ~PreviewHolder() override;
+
+ virtual void clear();
+ virtual void addPreview( Previewable* preview );
+ virtual void freezeUpdates();
+ virtual void thawUpdates();
+ virtual void setStyle(UI::Widget::PreviewSize size,
+ UI::Widget::ViewType view,
+ guint ratio,
+ UI::Widget::BorderStyle border);
+ virtual void setOrientation(SPAnchorType how);
+ virtual int getColumnPref() const { return _prefCols; }
+ virtual void setColumnPref( int cols );
+ virtual UI::Widget::PreviewSize getPreviewSize() const { return _baseSize; }
+ virtual UI::Widget::ViewType getPreviewType() const { return _view; }
+ virtual guint getPreviewRatio() const { return _ratio; }
+ virtual UI::Widget::BorderStyle getPreviewBorder() const { return _border; }
+ virtual void setWrap( bool wrap );
+ virtual bool getWrap() const { return _wrap; }
+
+protected:
+ bool on_scroll_event(GdkEventScroll*) override;
+
+private:
+ void rebuildUI();
+ void calcGridSize( const Gtk::Widget* item, int itemCount, int& ncols, int& nrows );
+
+ std::vector<Previewable*> items;
+ Gtk::ScrolledWindow *_scroller;
+ Gtk::Grid *_insides;
+
+ int _prefCols;
+ bool _updatesFrozen;
+ SPAnchorType _anchor;
+ UI::Widget::PreviewSize _baseSize;
+ guint _ratio;
+ UI::Widget::ViewType _view;
+ bool _wrap;
+ UI::Widget::BorderStyle _border;
+};
+
+} //namespace UI
+} //namespace Inkscape
+
+#endif // SEEN_PREVIEW_HOLDER_H
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :