summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/cssdialog.h
blob: 3bbab5031b4ae8869a8575ee27797dafc007cf34 (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
/** @file
 * @brief A dialog for CSS selectors
 */
/* Authors:
 *   Kamalpreet Kaur Grewal
 *
 * Copyright (C) Kamalpreet Kaur Grewal 2016 <grewalkamal005@gmail.com>
 *
 * Released under GNU GPL, read the file 'COPYING' for more information
 */

#ifndef CSSDIALOG_H
#define CSSDIALOG_H

#include <gtkmm/treeview.h>
#include <gtkmm/liststore.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/dialog.h>
#include <ui/widget/panel.h>

#include "desktop.h"

namespace Inkscape {
namespace UI {
namespace Dialog {

/**
 * @brief The CssDialog class
 * This dialog allows to add, delete and modify CSS properties for selectors
 * created in Style Dialog. Double clicking any selector in Style dialog, a list
 * of CSS properties will show up in this dialog (if any exist), else new properties
 * can be added and each new property forms a new row in this pane.
 */
class CssDialog : public UI::Widget::Panel
{
public:
    CssDialog();
    ~CssDialog();

    static CssDialog &getInstance() { return *new CssDialog(); }
    void setDesktop(SPDesktop* desktop);

    class CssColumns : public Gtk::TreeModel::ColumnRecord
    {
    public:
        CssColumns()
        { add(_colUnsetProp); add(_propertyLabel); }
        Gtk::TreeModelColumn<bool> _colUnsetProp;
        Gtk::TreeModelColumn<Glib::ustring> _propertyLabel;
    };

    SPDesktop* _desktop;
    SPDesktop* _targetDesktop;
    CssColumns _cssColumns;
    Gtk::VBox _mainBox;
    Gtk::HBox _buttonBox;
    Gtk::TreeView _treeView;
    Glib::RefPtr<Gtk::ListStore> _store;
    Gtk::ScrolledWindow _scrolledWindow;
    Gtk::TreeModel::Row _propRow;
    Gtk::CellRendererText *_textRenderer;
    Gtk::TreeViewColumn *_propCol;
    Glib::ustring _editedProp;
    bool _newProperty;

    void _styleButton(Gtk::Button& btn, char const* iconName, char const* tooltip);
    void _addProperty();
};


} // namespace Dialog
} // namespace UI
} // namespace Inkscape

#endif // CSSDIALOG_H