Inkscape
Vector Graphics Editor
dash-selector.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: GPL-2.0-or-later
6
/* Authors:
7
* Tavmjong Bah (Rewrite to use Gio::ListStore and Gtk::GridView).
8
*
9
* Original authors:
10
* Lauris Kaplinski <lauris@kaplinski.com>
11
* bulia byak <buliabyak@users.sf.net>
12
* Maximilian Albert <maximilian.albert@gmail.com> (gtkmm-ification)
13
*
14
* Copyright (C) 2002 Lauris Kaplinski
15
* Copyright (C) 2023 Tavmjong Bah
16
*
17
* Released under GNU GPL v2+, read the file 'COPYING' for more information.
18
*/
19
20
#ifndef SEEN_DASH_SELECTOR_H
21
#define SEEN_DASH_SELECTOR_H
22
23
#include <glibmm/refptr.h>
24
#include <gtkmm/box.h>
25
26
namespace
Gtk
{
27
class
DrawingArea;
28
class
GridView;
29
class
ListItem;
30
class
Popover;
31
class
SingleSelection;
32
}
// namespace Gtk
33
34
namespace
Inkscape::UI::Widget
{
35
36
class
DashSelector
final :
public
Gtk::Box {
37
38
public
:
39
DashSelector
();
40
~DashSelector
() final;
41
42
void
set_dash_pattern
(const
std
::vector<
double
>& dash,
double
offset
);
43
const
std
::vector<
double
>&
get_dash_pattern
() {
return
dash_pattern
; }
44
double
get_offset
() {
return
offset
; }
45
46
sigc::signal<void ()>
changed_signal
;
47
48
private
:
49
// Functions
50
void
update
(
int
position);
51
52
void
activate
(Gtk::GridView* grid,
unsigned
int
position);
53
54
void
setup_listitem_cb
(
const
Glib::RefPtr<Gtk::ListItem>& list_item);
55
void
bind_listitem_cb
(
const
Glib::RefPtr<Gtk::ListItem>& list_item);
56
57
void
draw_pattern
(
const
Cairo::RefPtr<Cairo::Context>& cr,
int
width
,
int
height
,
58
const
std::vector<double>& pattern);
59
void
draw_text
(
const
Cairo::RefPtr<Cairo::Context>& cr,
int
width
,
int
height
);
60
61
// Variables
62
std::vector<double>
dash_pattern
;
// The current pattern.
63
double
offset
= 0;
// The current offset.
64
65
// Gtk
66
Glib::RefPtr<Gtk::SingleSelection>
selection
;
67
Gtk::DrawingArea*
drawing_area
=
nullptr
;
// MenuButton
68
Gtk::Popover*
popover
=
nullptr
;
69
Glib::RefPtr<Gtk::Adjustment>
adjustment
;
// Dash offset
70
};
71
72
}
// namespace Inkscape::UI::Widget
73
74
#endif
// SEEN_DASH_SELECTOR_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 :
Inkscape::UI::Widget::DashSelector
Definition:
dash-selector.h:36
Inkscape::UI::Widget::DashSelector::setup_listitem_cb
void setup_listitem_cb(const Glib::RefPtr< Gtk::ListItem > &list_item)
Definition:
dash-selector.cpp:220
Inkscape::UI::Widget::DashSelector::update
void update(int position)
Definition:
dash-selector.cpp:192
Inkscape::UI::Widget::DashSelector::drawing_area
Gtk::DrawingArea * drawing_area
Definition:
dash-selector.h:67
Inkscape::UI::Widget::DashSelector::dash_pattern
std::vector< double > dash_pattern
Definition:
dash-selector.h:62
Inkscape::UI::Widget::DashSelector::set_dash_pattern
void set_dash_pattern(const std::vector< double > &dash, double offset)
Definition:
dash-selector.cpp:154
Inkscape::UI::Widget::DashSelector::offset
double offset
Definition:
dash-selector.h:63
Inkscape::UI::Widget::DashSelector::activate
void activate(Gtk::GridView *grid, unsigned int position)
Definition:
dash-selector.cpp:207
Inkscape::UI::Widget::DashSelector::get_dash_pattern
const std::vector< double > & get_dash_pattern()
Definition:
dash-selector.h:43
Inkscape::UI::Widget::DashSelector::~DashSelector
~DashSelector() final
Inkscape::UI::Widget::DashSelector::changed_signal
sigc::signal< void()> changed_signal
Definition:
dash-selector.h:46
Inkscape::UI::Widget::DashSelector::draw_text
void draw_text(const Cairo::RefPtr< Cairo::Context > &cr, int width, int height)
Definition:
dash-selector.cpp:254
Inkscape::UI::Widget::DashSelector::selection
Glib::RefPtr< Gtk::SingleSelection > selection
Definition:
dash-selector.h:66
Inkscape::UI::Widget::DashSelector::draw_pattern
void draw_pattern(const Cairo::RefPtr< Cairo::Context > &cr, int width, int height, const std::vector< double > &pattern)
Definition:
dash-selector.cpp:241
Inkscape::UI::Widget::DashSelector::adjustment
Glib::RefPtr< Gtk::Adjustment > adjustment
Definition:
dash-selector.h:69
Inkscape::UI::Widget::DashSelector::popover
Gtk::Popover * popover
Definition:
dash-selector.h:68
Inkscape::UI::Widget::DashSelector::bind_listitem_cb
void bind_listitem_cb(const Glib::RefPtr< Gtk::ListItem > &list_item)
Definition:
dash-selector.cpp:228
Inkscape::UI::Widget::DashSelector::get_offset
double get_offset()
Definition:
dash-selector.h:44
Inkscape::UI::Widget::DashSelector::DashSelector
DashSelector()
Definition:
dash-selector.cpp:90
Gtk
Definition:
desktop.h:51
Inkscape::UI::Widget
Custom widgets.
Definition:
desktop.h:127
Inkscape::UI::Widget::height
static constexpr int height
Definition:
color-palette-preview.cpp:23
std
STL namespace.
width
double width
Definition:
convex_hull.cpp:106
src
ui
widget
dash-selector.h
Generated on Sun Apr 7 2024 04:01:33 for Inkscape by
1.9.4