Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
xml-treeview.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * A widget showing the XML tree.
4 *
5 * Authors:
6 * Tavmjong Bah
7 * MenTaLguY <mental@rydia.net> (Original C version)
8 *
9 * Copyright (C)
10 * Tavmjong Bah 2024
11 * MenTaLguY 2002
12 *
13 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
14 */
15
16#ifndef SEEN_XML_TREEVIEW_H
17#define SEEN_XML_TREEVIEW_H
18
19#include <gtkmm/treeview.h>
20
21#include "ui/syntax.h" // XMLFormatter
22
23namespace Gtk {
24class TreeStore;
25class DragSource;
26class DropTarget;
27} // namespace Gtk
28
29namespace Inkscape::XML {
30class Node;
31} // namespace Inkscape::XML
32
33namespace Inkscape::UI::Syntax {
34class XMLFormatter;
35} // namespace Inkscape::UI::Syntax
36
37class SPDocument;
38
39namespace Inkscape::UI::Widget {
40
41class ModelColumns;
42class NodeWatcher;
43
44class XmlTreeView : public Gtk::TreeView
45{
46public:
48
49 void build_tree(SPDocument* document); // set_root_watcher()
50 Inkscape::XML::Node* get_repr(Gtk::TreeModel::ConstRow const &row) const;
51 void select_node(Inkscape::XML::Node *node, bool edit = false);
52 void set_style(Inkscape::UI::Syntax::XMLStyles const &new_style);
53 Gtk::CellRendererText *get_renderer() { return text_renderer; }
54
55private:
56
57 friend class NodeWatcher;
58
59 SPDocument* document = nullptr;
60 Glib::RefPtr<Gtk::TreeStore> store;
61 std::unique_ptr<ModelColumns> model_columns;
62 std::unique_ptr<NodeWatcher> root_watcher;
63 std::unique_ptr<Inkscape::UI::Syntax::XMLFormatter> formatter;
64 Gtk::CellRendererText *text_renderer = nullptr;
65
66 // ==== Controllers ====
67 Glib::RefPtr<Gdk::ContentProvider> on_prepare(Gtk::DragSource &controller, double x, double y);
68 Gdk::DragAction on_drag_motion(double x, double y);
69 bool on_drag_drop(Glib::ValueBase const &/*value*/, double x, double y);
70};
71
72} // namespace Inkscape::UI::Widget
73
74#endif // SEEN_XML_TREEVIEW_H
75
76/*
77 Local Variables:
78 mode:c++
79 c-file-style:"stroustrup"
80 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
81 indent-tabs-mode:nil
82 fill-column:99
83 End:
84*/
85// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
Gtk::CellRendererText * text_renderer
Gdk::DragAction on_drag_motion(double x, double y)
bool on_drag_drop(Glib::ValueBase const &, double x, double y)
void build_tree(SPDocument *document)
Glib::RefPtr< Gdk::ContentProvider > on_prepare(Gtk::DragSource &controller, double x, double y)
void set_style(Inkscape::UI::Syntax::XMLStyles const &new_style)
Gtk::CellRendererText * get_renderer()
std::unique_ptr< ModelColumns > model_columns
void select_node(Inkscape::XML::Node *node, bool edit=false)
Select node in tree, if edit, move cursor.
Glib::RefPtr< Gtk::TreeStore > store
std::unique_ptr< Inkscape::UI::Syntax::XMLFormatter > formatter
Inkscape::XML::Node * get_repr(Gtk::TreeModel::ConstRow const &row) const
std::unique_ptr< NodeWatcher > root_watcher
Interface for refcounted XML nodes.
Definition node.h:80
Typed SVG document implementation.
Definition document.h:101
Inkscape::XML::Node * node
Definition desktop.h:50
Custom widgets.
Definition desktop.h:126
@Inkscape XML tree.
The styles used for simple XML syntax highlighting.
Definition syntax.h:46