blob: 0b1bfc200cc8798e1bd94f0799b79fd5588d4e49 (
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
|
// SPDX-License-Identifier: GPL-2.0-or-later
/** @file
* Generic button widget
*//*
* Authors:
* see git history
* Lauris Kaplinski <lauris@kaplinski.com>
*
* Copyright (C) 2018 Authors
* Released under GNU GPL v2+, read the file 'COPYING' for more information.
*/
#ifndef SEEN_SP_BUTTON_H
#define SEEN_SP_BUTTON_H
#include <gtkmm/togglebutton.h>
#include <sigc++/connection.h>
struct SPAction;
namespace Inkscape {
namespace UI {
namespace View {
class View;
}
namespace Widget {
enum ButtonType {
BUTTON_TYPE_NORMAL,
BUTTON_TYPE_TOGGLE
};
class Button : public Gtk::ToggleButton{
private:
ButtonType _type;
GtkIconSize _lsize;
unsigned int _psize;
SPAction *_action;
SPAction *_doubleclick_action;
sigc::connection _c_set_active;
sigc::connection _c_set_sensitive;
void set_action(SPAction *action);
void set_doubleclick_action(SPAction *action);
void set_composed_tooltip(SPAction *action);
void action_set_active(bool active);
void perform_action();
bool process_event(GdkEvent *event);
sigc::connection _on_clicked;
protected:
void get_preferred_width_vfunc(int &minimum_width, int &natural_width) const override;
void get_preferred_height_vfunc(int &minimum_height, int &natural_height) const override;
void on_clicked() override;
public:
Button(GtkIconSize size,
ButtonType type,
SPAction *action,
SPAction *doubleclick_action);
Button(GtkIconSize size,
ButtonType type,
Inkscape::UI::View::View *view,
const gchar *name,
const gchar *tip);
~Button() override;
void toggle_set_down(bool down);
};
} // namespace Widget
} // namespace UI
} // namespace Inkscape
#endif // !SEEN_SP_BUTTON_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 :
|