1 /** @file
2 * @brief A simple dialog for previewing icon representation.
3 */
4 /* Authors:
5 * Jon A. Cruz
6 * Bob Jamison
7 * Other dudes from The Inkscape Organization
8 *
9 * Copyright (C) 2004,2005 The Inkscape Organization
10 * Copyright (C) 2010 Jon A. Cruz
11 *
12 * Released under GNU GPL, read the file 'COPYING' for more information
13 */
15 #ifndef SEEN_ICON_PREVIEW_H
16 #define SEEN_ICON_PREVIEW_H
18 #include <gtkmm/box.h>
19 #include <gtkmm/button.h>
20 #include <gtkmm/label.h>
21 #include <gtkmm/paned.h>
22 #include <gtkmm/image.h>
23 #include <gtkmm/togglebutton.h>
24 #include <gtkmm/toggletoolbutton.h>
26 #include "ui/widget/panel.h"
27 #include "desktop-tracker.h"
29 struct SPObject;
30 namespace Glib {
31 class Timer;
32 }
34 namespace Inkscape {
35 namespace UI {
36 namespace Dialog {
39 /**
40 * A panel that displays an icon preview
41 */
42 class IconPreviewPanel : public UI::Widget::Panel
43 {
44 public:
45 IconPreviewPanel();
46 //IconPreviewPanel(Glib::ustring const &label);
47 ~IconPreviewPanel();
49 static IconPreviewPanel& getInstance();
51 void setDesktop( SPDesktop* desktop );
52 void refreshPreview();
53 void modeToggled();
55 private:
56 IconPreviewPanel(IconPreviewPanel const &); // no copy
57 IconPreviewPanel &operator=(IconPreviewPanel const &); // no assign
60 DesktopTracker deskTrack;
61 SPDesktop *desktop;
62 SPDocument *document;
63 Glib::Timer *timer;
64 Glib::Timer *renderTimer;
65 bool pending;
66 gdouble minDelay;
68 Gtk::Tooltips tips;
70 Gtk::VBox iconBox;
71 Gtk::HPaned splitter;
73 Glib::ustring targetId;
74 int hot;
75 int numEntries;
76 int* sizes;
78 Gtk::Image magnified;
79 Gtk::Label magLabel;
81 Gtk::ToggleButton *selectionButton;
83 guchar** pixMem;
84 Gtk::Image** images;
85 Glib::ustring** labels;
86 Gtk::ToggleToolButton** buttons;
87 sigc::connection desktopChangeConn;
88 sigc::connection docReplacedConn;
89 sigc::connection docModConn;
90 sigc::connection selChangedConn;
93 void setDocument( SPDocument *document );
94 void on_button_clicked(int which);
95 void renderPreview( SPObject* obj );
96 void updateMagnify();
97 void queueRefresh();
98 bool refreshCB();
99 };
101 } //namespace Dialogs
102 } //namespace UI
103 } //namespace Inkscape
107 #endif // SEEN_ICON_PREVIEW_H
109 /*
110 Local Variables:
111 mode:c++
112 c-file-style:"stroustrup"
113 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
114 indent-tabs-mode:nil
115 fill-column:99
116 End:
117 */
118 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :