summaryrefslogtreecommitdiffstats
path: root/src/widgets/sp-attribute-widget.h
blob: ca0b170c6c0a91151c4e619a016baa2207d30bd0 (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
/**
 * @file
 * Widget that listens and modifies repr attributes.
 */
/* Authors:
 *  Lauris Kaplinski <lauris@kaplinski.com>
 *  Kris De Gussem <Kris.DeGussem@gmail.com>
 *
 * Copyright (C) 2002,2011 authors
 * Copyright (C) 2001 Ximian, Inc.
 *
 * Licensed under GNU GPL, read the file 'COPYING' for more information
 */

#ifndef SEEN_DIALOGS_SP_ATTRIBUTE_WIDGET_H
#define SEEN_DIALOGS_SP_ATTRIBUTE_WIDGET_H

#include <gtk/gtk.h>
#include <gtkmm.h>
#include <glib.h>
#include <stddef.h>
#include <sigc++/connection.h>


namespace Inkscape {
namespace XML {
class Node;
}
}

class  SPObject;

class SPAttributeTable : public Gtk::Widget {
/**
 * \class SPAttributeTable
 * \brief A base class for dialogs to enter the value of several properties.
 *
 * SPAttributeTable is used if you want to alter several properties of
 * an object. For each property, it creates an entry next to a label and
 * positiones these labels and entries one by one below each other.
 */
public:
    SPAttributeTable ();
    SPAttributeTable (SPObject *object, std::vector<Glib::ustring> &labels, std::vector<Glib::ustring> &attributes, GtkWidget* parent);
    ~SPAttributeTable ();
    
    void set_object(SPObject *object, std::vector<Glib::ustring> &labels, std::vector<Glib::ustring> &attributes, GtkWidget* parent);
    void change_object(SPObject *object);
    // void set_repr(Inkscape::XML::Node *repr, std::vector<Glib::ustring> &labels, std::vector<Glib::ustring> &attributes, GtkWidget* parent);
    void clear(void);
    
	/**
     * \brief Gives access to the attributes list.
     */
    std::vector<Glib::ustring> get_attributes(void) {return _attributes;};
    
	/**
     * \brief Gives access to the Gtk::Entry list.
     */
    std::vector<Gtk::Entry *> get_entries(void) {return _entries;};
    
	/**
     * \brief Stores pointer to the selected object.
     */
    union {
        SPObject *object;
        Inkscape::XML::Node *repr;
    } src;
    
	/**
     * \brief Indicates whether SPAttributeTable is processing callbacks and whether it should accept any updating.
     */
    guint blocked;
    guint hasobj; //currently unused: set_repr is not used to data: decide later on whether to keep it

private:
    Gtk::Table *table;
    std::vector<Glib::ustring> _attributes;
    std::vector<Gtk::Entry *> _entries;
    sigc::connection modified_connection;
    sigc::connection release_connection;
};

#endif

/*
  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 :