blob: 6e1ffbb2c71fb9a07c86f160659cb5666813a2a4 (
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
|
/** @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 STYLEDIALOG_H
#define STYLEDIALOG_H
#include <ui/widget/panel.h>
#include <gtkmm/treeview.h>
#include <gtkmm/treestore.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/dialog.h>
#include <gtkmm/treeselection.h>
#include "desktop.h"
#include "document.h"
namespace Inkscape {
namespace UI {
namespace Dialog {
/**
* @brief The StyleDialog class
* A list of CSS selectors will show up in this dialog.
*/
class StyleDialog : public UI::Widget::Panel
{
public:
StyleDialog();
~StyleDialog();
static StyleDialog &getInstance() { return *new StyleDialog(); }
void setDesktop( SPDesktop* desktop);
private:
void _styleButton( Gtk::Button& btn, char const* iconName, char const* tooltip);
std::string _setClassAttribute(std::vector<SPObject*>);
std::vector<std::pair<std::pair<std::string, SPObject *>, std::string> >_selectorVec;
std::vector<std::pair<std::pair<std::string, SPObject *>, std::string> > _getSelectorVec();
std::string _populateTree(std::vector<std::pair<std::pair<std::string, SPObject *>,
std::string> >);
bool _handleButtonEvent(GdkEventButton *event);
void _selectedRowCallback(const Gtk::TreeModel::Path& path,
Gtk::TreeViewColumn* /* column */);
void _checkAllChildren(Gtk::TreeModel::Children& children);
Inkscape::XML::Node *_styleElementNode();
void _updateStyleContent();
void _selectRow(Selection *);
class ModelColumns : public Gtk::TreeModel::ColumnRecord
{
public:
ModelColumns()
{ add(_selectorLabel); add(_colAddRemove); add(_colObj); }
Gtk::TreeModelColumn<Glib::ustring> _selectorLabel;
Gtk::TreeModelColumn<bool> _colAddRemove;
Gtk::TreeModelColumn<SPObject *> _colObj;
};
SPDesktop* _desktop;
SPDesktop* _targetDesktop;
ModelColumns _mColumns;
Gtk::VBox _mainBox;
Gtk::HBox _buttonBox;
Gtk::TreeView _treeView;
Glib::RefPtr<Gtk::TreeStore> _store;
Gtk::ScrolledWindow _scrolledWindow;
Gtk::Button* del;
Gtk::Button* create;
SPDocument* _document;
bool _styleExists;
Inkscape::XML::Node *_styleChild;
unsigned _num;
std::string _selectorName;
std::string _selectorValue;
Gtk::TreeModel::Row _row;
bool _newDrawing;
// Signal handlers
void _addSelector();
void _delSelector();
};
} // namespace Dialog
} // namespace UI
} // namespace Inkscape
#endif // STYLEDIALOG_H
|