-
Notifications
You must be signed in to change notification settings - Fork 51
/
bitmap_sink.h
72 lines (60 loc) · 1.9 KB
/
bitmap_sink.h
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
#ifndef K3DSDK_BITMAP_SINK_H
#define K3DSDK_BITMAP_SINK_H
// K-3D
// Copyright (c) 1995-2008, Timothy M. Shead
//
// Contact: [email protected]
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <k3dsdk/bitmap.h>
#include <k3dsdk/data.h>
#include <k3dsdk/ibitmap_sink.h>
#include <k3d-i18n-config.h>
namespace k3d
{
template<typename derived_t>
class bitmap_sink :
public ibitmap_sink
{
public:
iproperty& bitmap_sink_input()
{
return m_input_bitmap;
}
sigc::slot<void, ihint*> make_input_changed_slot()
{
return sigc::mem_fun(*this, &bitmap_sink<derived_t>::input_changed);
}
protected:
bitmap_sink() :
m_input_bitmap(
init_owner(*static_cast<derived_t*>(this))
init_name("input_bitmap")
init_label(_("Input Bitmap"))
init_description(_("Input bitmap"))
init_value<bitmap*>(0))
{
m_input_bitmap.changed_signal().connect(make_input_changed_slot());
}
k3d_data(bitmap*, data::immutable_name, data::change_signal, data::no_undo, data::local_storage, data::no_constraint, data::read_only_property, data::no_serialization) m_input_bitmap;
private:
void input_changed(k3d::ihint* Hint)
{
on_input_changed(Hint);
}
virtual void on_input_changed(k3d::ihint*) = 0;
};
} // namespace k3d
#endif // !K3DSDK_BITMAP_SINK_H