blob: 6b96575992304a71e698b9236fb601be416897d7 (
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
|
/** @file
* @brief A dialog for CSS selectors
*/
/* Authors:
* Kamalpreet Kaur Grewal
* Tavmjong Bah
*
* Copyright (C) Kamalpreet Kaur Grewal 2016 <grewalkamal005@gmail.com>
* Copyright (C) Tavmjong Bah 2017 <tavmjong@free.fr>
*
* 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() override;
static CssDialog &getInstance() { return *new CssDialog(); }
// Data structure
class CssColumns : public Gtk::TreeModel::ColumnRecord {
public:
CssColumns() {
add(_colUnsetProp);
add(_propertyLabel);
add(_styleSheetVal);
add(_styleAttrVal);
}
Gtk::TreeModelColumn<bool> _colUnsetProp;
Gtk::TreeModelColumn<Glib::ustring> _propertyLabel;
Gtk::TreeModelColumn<Glib::ustring> _styleSheetVal;
Gtk::TreeModelColumn<Glib::ustring> _styleAttrVal;
};
CssColumns _cssColumns;
// TreeView
Gtk::TreeView _treeView;
Glib::RefPtr<Gtk::ListStore> _store;
Gtk::TreeModel::Row _propRow;
Gtk::CellRendererText *_propRenderer;
Gtk::CellRendererText *_sheetRenderer;
Gtk::CellRendererText *_attrRenderer;
Gtk::TreeViewColumn *_propCol;
Gtk::TreeViewColumn *_sheetCol;
Gtk::TreeViewColumn *_attrCol;
// Widgets
Gtk::VBox _mainBox;
Gtk::ScrolledWindow _scrolledWindow;
Gtk::HBox _buttonBox;
Gtk::Button _buttonAddProperty;
// Variables - Inkscape
SPDesktop* _desktop;
// Helper functions
void setDesktop(SPDesktop* desktop) override;
// Signal handlers
void _addProperty();
};
} // namespace Dialog
} // namespace UI
} // namespace Inkscape
#endif // CSSDIALOG_H
|