Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
canvas-page.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
/*
5 * Authors:
6 * Martin Owens 2021
7 *
8 * Copyright (C) 2021 Martin Owens
9 *
10 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
11 */
12#ifndef SEEN_CANVAS_PAGE_H
13#define SEEN_CANVAS_PAGE_H
14
15#include <2geom/rect.h>
16#include <glib.h>
17#include <vector>
18
19#include "canvas-item-ptr.h"
20#include "colors/color.h"
21
22namespace Inkscape {
23namespace UI::Widget { class Canvas; }
24
25using Colors::Color;
26
27class CanvasItemGroup;
28class CanvasItemText;
29
31{
32public:
35
36 void update(Geom::Rect size, Geom::OptRect margin, Geom::OptRect bleed, const char *txt, bool outline, bool is_yaxisdown);
37 void add(Geom::Rect size, CanvasItemGroup *background_group, CanvasItemGroup *foreground_group);
38 void remove(UI::Widget::Canvas *canvas);
39 void show();
40 void hide();
41 void set_guides_visible(bool show);
42
43 bool setOnTop(bool on_top);
44 bool setShadow(int shadow);
45 bool setPageColor(Color const &border, Color const &bg, Color const &canvas, Color const &margin, Color const &bleed);
46 bool setLabelStyle(const std::string &style);
47
48 bool is_selected = false;
49private:
50 void _updateTextItem(CanvasItemText *label, Geom::Rect page, std::string txt, bool is_yaxisdown);
51
52 // This may make this look like a CanvasItemGroup, but it's not one. This
53 // isn't a collection of items, but a set of items in multiple Canvases.
54 // Each item can belong in either a foreground or background group.
55 std::vector<CanvasItemPtr<CanvasItem>> canvas_items;
56
57 int _shadow_size = 0;
58 bool _border_on_top = true;
60 Color _border_color {0x00000040};
61 Color _canvas_color {0xffffffff};
62 Color _margin_color {0x1699d771};
63 Color _bleed_color {0xbe310e62};
64
65 std::string _label_style = "default";
66};
67
68} // namespace Inkscape
69
70#endif // SEEN_CANVAS_PAGE_H
71
72/*
73 Local Variables:
74 mode:c++
75 c-file-style:"stroustrup"
76 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
77 indent-tabs-mode:nil
78 fill-column:99
79 End:
80*/
81// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
uint64_t page
Definition canvas.cpp:171
int margin
Definition canvas.cpp:166
Axis-aligned rectangle that can be empty.
Definition rect.h:203
Axis aligned, non-empty rectangle.
Definition rect.h:92
std::vector< CanvasItemPtr< CanvasItem > > canvas_items
Definition canvas-page.h:55
void update(Geom::Rect size, Geom::OptRect margin, Geom::OptRect bleed, const char *txt, bool outline, bool is_yaxisdown)
Update the visual representation of a page on screen.
std::string _label_style
Definition canvas-page.h:65
void _updateTextItem(CanvasItemText *label, Geom::Rect page, std::string txt, bool is_yaxisdown)
Update the page's textual label.
void add(Geom::Rect size, CanvasItemGroup *background_group, CanvasItemGroup *foreground_group)
Add the page canvas to the given canvas item groups (canvas view is implicit)
void set_guides_visible(bool show)
bool setPageColor(Color const &border, Color const &bg, Color const &canvas, Color const &margin, Color const &bleed)
void remove(UI::Widget::Canvas *canvas)
Hide the page in the given canvas widget.
bool setLabelStyle(const std::string &style)
bool setShadow(int shadow)
bool setOnTop(bool on_top)
A widget for Inkscape's canvas.
Definition canvas.h:62
Glib::ustring label
Helper class to stream background task notifications as a series of messages.
Geom::PathVector outline(Geom::Path const &input, double width, double miter, LineJoinType join, LineCapType butt, double tolerance)
Strokes the path given by input.
Axis-aligned rectangle.
double border