summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/livepatheffect-add.h
blob: 00f58b0389761a02d9a3f07ce36ce1ed08be5041 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/**
 * @file
 * Dialog for adding a live path effect.
 *
 * Author:
 *
 * Copyright (C) 2012 Authors
 * Released under GNU GPL.  Read the file 'COPYING' for more information
 */

#ifndef INKSCAPE_DIALOG_LIVEPATHEFFECT_ADD_H
#define INKSCAPE_DIALOG_LIVEPATHEFFECT_ADD_H

#include <gtkmm/dialog.h>
#include <gtkmm/liststore.h>
#include <gtkmm/treeview.h>
#include <gtkmm/scrolledwindow.h>
#include "live_effects/effect-enum.h"

class SPDesktop;

namespace Inkscape {
namespace UI {
namespace Dialog {
      
/**
 * A dialog widget to list the live path effects that can be added
 *
 */
class LivePathEffectAdd : public Gtk::Dialog {
public:
    LivePathEffectAdd();
    virtual ~LivePathEffectAdd() {}

    /**
     * Show the dialog
     */
    static void show(SPDesktop *desktop);

    /**
     * Returns true is the "Add" button was pressed
     */
    static bool isApplied() {
        return instance().applied;
    }

    /**
     * Return the data associated with the currently selected item
     */
    static const Util::EnumData<LivePathEffect::EffectType>* getActiveData();

protected:

    /**
     * Close button was clicked
     */
    void onClose();

    /**
     * Add button was clicked
     */
    void onAdd();

    /**
     * Tree was clicked
     */
    void onButtonEvent(GdkEventButton* evt);

private:

    Gtk::TreeView     effectlist_treeview;
    Gtk::ScrolledWindow scrolled_window;
    Gtk::Button       add_button;
    Gtk::Button       close_button;

    class ModelColumns : public Gtk::TreeModel::ColumnRecord
    {
      public:
        ModelColumns()
        {
            add(name);
            //add(desc);
            add(data);
        }
        virtual ~ModelColumns() {}

        Gtk::TreeModelColumn<Glib::ustring> name;
        /**
         * TODO - Get detailed descriptions of each Effect to show in the dialog
         */
        //Gtk::TreeModelColumn<Glib::ustring> desc;
        Gtk::TreeModelColumn<const Util::EnumData<LivePathEffect::EffectType>*> data;
    };

    ModelColumns _columns;
    Glib::RefPtr<Gtk::ListStore> effectlist_store;
    const Util::EnumDataConverter<LivePathEffect::EffectType>& converter;

    bool applied;

    static LivePathEffectAdd &instance() {
        static LivePathEffectAdd instance_;
        return instance_;
    }
    LivePathEffectAdd(LivePathEffectAdd const &); // no copy
    LivePathEffectAdd &operator=(LivePathEffectAdd const &); // no assign
};
 
} // namespace Dialog
} // namespace UI
} // namespace Inkscape

#endif // INKSCAPE_DIALOG_LIVEPATHEFFECT_ADD_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 :