summaryrefslogtreecommitdiffstats
path: root/src/display/sodipodi-ctrlrect.h
blob: cdc4a3de61dc1ca9df34e86bb93e091f609cc661 (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
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef SEEN_INKSCAPE_CTRLRECT_H
#define SEEN_INKSCAPE_CTRLRECT_H

/**
 * @file
 * Simple non-transformed rectangle, usable for rubberband.
 * Modified to work with rotated canvas.
 */
/*
 * Authors:
 *   Lauris Kaplinski <lauris@ximian.com>
 *   Carl Hetherington <inkscape@carlh.net>
 *   Tavmjong Bah <tavjong@free.fr>
 *
 * Copyright (C) 1999-2001 Lauris Kaplinski
 * Copyright (C) 2000-2001 Ximian, Inc.
 * Copyright (C) 2017 Tavmjong Bah
 *
 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
 *
 */

#include <glib.h>
#include "sp-canvas-item.h"
#include <2geom/rect.h>
#include <2geom/int-rect.h>
#include <2geom/transforms.h>

struct SPCanvasBuf;

#define SP_TYPE_CTRLRECT (sp_ctrlrect_get_type ())
#define SP_CTRLRECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_CTRLRECT, CtrlRect))
#define SP_CTRLRECT_CLASS(c) (G_TYPE_CHECK_CLASS_CAST((c), SP_TYPE_CTRLRECT, CtrlRectClass))
#define SP_IS_CTRLRECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_CTRLRECT))
#define SP_IS_CTRLRECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_CTRLRECT))

class CtrlRect : public SPCanvasItem
{
public:

    void init();
    void setColor(guint32 b, bool h, guint f);
    void setShadow(int s, guint c);
    void setInvert(bool invert);
    void setRectangle(Geom::Rect const &r);
    void setDashed(bool d);
    void setCheckerboard(bool d);

    void render(SPCanvasBuf *buf);
    void update(Geom::Affine const &affine, unsigned int flags);
    
private:
    void _requestUpdate();
    
    Geom::Rect _rect;
    Geom::Affine _affine;

    bool _has_fill;
    bool _dashed;
    bool _inverted;
    bool _checkerboard;

    Geom::OptIntRect _area;
    gint _shadow_width;
    guint32 _border_color;
    guint32 _fill_color;
    guint32 _shadow_color;    
};

struct CtrlRectClass : public SPCanvasItemClass {};

GType sp_ctrlrect_get_type();

#endif // SEEN_CTRLRECT_H

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