/usr/include/vdk2/vdk/sigc_eventsignals.h is in libvdk2-dev 2.4.0-5.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | /* -*- c++ -*- */
#ifndef _sigc_eventsignals_h_
#define _sigc_eventsignals_h_
#ifdef USE_SIGCPLUSPLUS
#include <sigc++/signal_system.h>
#include <vdk/sigc_events.h>
using namespace SigC;
/*!
\class VDKRawEventSignal
\brief raw event ala gdk
This signal we deliver every GdkEvent the object receives directly
to you. Normaly you should use the specialised eventsignals delivering
you a more comfortable VDKEvent (what uses much less resources and
is typesafe).
*/
class VDKRawEventSignal : public VDKSignal1<void, const GdkEvent *>,
private VDKNotCopyAble
{
public:
VDKRawEventSignal(VDKObject*);
~VDKRawEventSignal();
Connection connect(const Slot1<void, const GdkEvent*>&);
Connection connect(const Slot2<void, VDKObject*, const GdkEvent *>&);
void disconnect(Connection&);
private:
VDKObject* _obj;
guint _handler_id;
static gint event_handler(GtkObject* wid, GdkEvent* eve, gpointer obj);
};
/* here generic eventsignals begin */
/* not used in user-land */
typedef enum{
BUTTON_PRESS,
BUTTON_RELEASE,
FOCUS_KEY_IN,
FOCUS_KEY_OUT,
FOCUS_POINTER_IN,
FOCUS_POINTER_OUT,
GEOMETRY,
KEY_PRESS,
KEY_RELEASE,
MAPEVENT,
PAINT,
POINTER_MOVE,
POINTER_PRESSED
} W2_TraitEnum;
/** Specify on what of the following event-subtypes you are interested:
* FULLY_VISIBILE: The object got completely unmaped
* PRATIAL_VISIBLE: The object got partialy maped
* NOT_VISBLE: The object got completely maped
*/
// typedef enum{
// ME_FULLY_VISIBLE,
// ME_PARTIAL_VISIBLE,
// ME_NOT_VISIBLE
// } VDKMapEventFilter;
typedef VDKMapState VDKMapEventFilter;
/*!
* \enum VDKButtonEventFilter
* Specify on what of the following event-subtypes you are interested:
* \arg BE_RELEASE Mousebutton was released
* \arg BE_PRESS Mousebutton was pressed
* \arg BE_CLICK2 Double click
* \arg BE_CLICK3 Triple click
* \sa VDKButtonEvent
*/
typedef enum{
BE_RELEASE,
BE_PRESS,
BE_CLICK2,
BE_CLICK3
} VDKButtonEventFilter;
/*!
* \enum VDKKeyEventFilter
* Specify on what of the following event-subtypes you are interested:
* \arg KE_RELEASE: key was released
* \arg KE_PRESS: key was pressed
*/
typedef enum{
KE_RELEASE,
KE_PRESS
} VDKKeyEventFilter;
/** Specify on what of the following event-subtypes you are interested:
* FOCUS_IN: Object got this kind of focus
* FOCUS_OUT: Object lost this kind of focus
* @see VDKKeyFocus
* @see VDKMouseFocus
*/
typedef enum{
FE_IN,
FE_OUT
} VDKFocusEventFilter;
/** Specify on what of the following event-subtypes you are interested:
* ALL: Every pointer move, regardless of any modifier's state
* PRESSED: Register pointer moves only while any modifier was pressed
* @see VDKPointerSignal
*/
typedef enum{
PE_ALL,
PE_PRESSED
} VDKPointerEventFilter;
/* *******************************************************************
* ******* Different Trait classes for template instantiation *******
* ******************************************************************/
template<W2_TraitEnum id, int scount=0>
class W2_Trait
{
public:
typedef GdkEvent ge_type; // Subclass of GdkEvent to dispatch
typedef int T_vcmp; // Filter-parameter-type
typedef GdkEventType T_gcmp; // Event-filter-type (must be
// convertible to int!)
static const char* signame; // Name to connect
static T_gcmp Field(GdkEvent* eve)
{return eve->type;}
};
template<W2_TraitEnum id>
class W2_Trait<id, 1>
{
public:
typedef GdkEvent ge_type;
typedef int T_vcmp;
typedef GdkEventType T_gcmp;
static const int s_count;
static const char* signame;
static T_gcmp Field(GdkEvent* eve);
static const T_vcmp EN1;
static const T_gcmp GN1;
};
template<W2_TraitEnum id>
class W2_Trait<id,2>
{
public:
typedef GdkEvent ge_type;
typedef int T_vcmp;
typedef GdkEventType T_gcmp;
static const int s_count;
static const char* signame;
static T_gcmp Field(GdkEvent* eve);
static const T_vcmp EN1;
static const T_gcmp GN1;
static const T_vcmp EN2;
static const T_gcmp GN2;
};
template<W2_TraitEnum id>
class W2_Trait<id,3>
{
public:
typedef GdkEvent ge_type; // Subclass of GdkEvent to dispatch
typedef int T_vcmp; // Filter-parameter-type
typedef GdkEventType T_gcmp; // Event-filter-type (must be
// convertible to int!)
static const int s_count; // Anzahl der Signal-Objekte
static const char* signame; // Name to connect
static T_gcmp Field(GdkEvent* eve)
{return eve->type;}
static const T_vcmp EN1;
static const T_gcmp GN1;
static const T_vcmp EN2;
static const T_gcmp GN2;
static const T_vcmp EN3;
static const T_gcmp GN3;
};
#include <vdk/sigc_eventtraits.h>
/* *******************************************************************
* * DirectEventSignal *
* *Simple Eventsignal, has one connection and no filtering parameter*
* ******************************************************************/
// Second parameter to reduce number of traits
template<W2_TraitEnum id, class T_vevent>
class DirectEventSignal : public VDKSignal1<void, const T_vevent &>
{
int _handler_id;
static void event_handler(GtkObject*, GdkEvent*, gpointer obj);
VDKObject* _sender;
typedef W2_Trait<id> T_trait;
public:
DirectEventSignal(VDKObject* sender) : _handler_id(0),_sender(sender) {}
~DirectEventSignal();
Connection connect(const Slot2<void,VDKObject*,const T_vevent &>&);
Connection connect(const Slot1<void, const T_vevent &>&);
void disconnect(Connection& con);
};
/* *******************************************************************
* * SignalWrapperStage2Base template *
* * Provides basefunctionality for SignalWrapperStage2-class *
* ******************************************************************/
template<W2_TraitEnum id, class T_vevent, int s_count, class trait>
class SignalWrapperStage2Base
{
typedef W2_Trait<id> Trait;
typedef W2_Trait<id>::T_vcmp T_vcmp;
typedef W2_Trait<id>::T_gcmp T_gcmp;
int _handler_id; // holds gdksigc-connection id
VDKObject* _sender;
VDKSignal1<void,const T_vevent& > sig_vec[s_count];
static void event_handler(GtkObject*, GdkEvent*, gpointer obj);
public:
SignalWrapperStage2Base(VDKObject* obj)
: _handler_id(0), _sender(obj) {}
~SignalWrapperStage2Base();
// Überprüft alle internen Verbindungen und hebt ggf. die
// gtksigc-Verbindung auf.
void cleanup();
void disconnect(Connection&);
Connection connect(const Slot2<void,VDKObject*,const T_vevent &>&,
T_vcmp spec);
Connection connect(const Slot1<void,const T_vevent &>&, T_vcmp spec);
bool empty()const;
bool responsible(T_vcmp spec) const;
};
template<W2_TraitEnum id, class T_vevent, int s>
class SignalWrapperStage2
{
typedef W2_Trait<id> Trait;
typedef Trait::T_vcmp T_vcmp;
typedef Trait::T_gcmp T_gcmp;
public:
SignalWrapperStage2(VDKObject* obj);
};
/* Acts as factroy at the same time */
template<W2_TraitEnum id, class T_vevent>
class SignalWrapperStage2<id,T_vevent,1>
: public SignalWrapperStage2Base<id,T_vevent,1, SignalWrapperStage2<id,T_vevent,1> >
{
typedef W2_Trait<id> Trait;
typedef W2_Trait<id>::T_vcmp T_vcmp;
typedef W2_Trait<id>::T_gcmp T_gcmp;
friend class SignalWrapperStage2Base<id, T_vevent,1, SignalWrapperStage2<id,T_vevent,1> >;
static int vdk2vec(T_vcmp);
static int eve2vec(GdkEvent* eve);
public: /* ??? */
SignalWrapperStage2(VDKObject* obj)
: SignalWrapperStage2Base<id, T_vevent,1, SignalWrapperStage2<id,T_vevent,1> >(obj)
{}
};
template<W2_TraitEnum id, class T_vevent>
class SignalWrapperStage2<id,T_vevent,2>
: public SignalWrapperStage2Base<id,T_vevent,2, SignalWrapperStage2<id,T_vevent,2> >
{
typedef W2_Trait<id> myTrait;
typedef myTrait::T_vcmp T_vcmp;
typedef myTrait::T_gcmp T_gcmp;
friend class SignalWrapperStage2Base<id,T_vevent,2,SignalWrapperStage2<id,T_vevent,2> >;
static int vdk2vec(T_vcmp);
static int eve2vec(GdkEvent* eve);
public: /* ??? */
SignalWrapperStage2(VDKObject* obj)
: SignalWrapperStage2Base<id,T_vevent,2, SignalWrapperStage2<id,T_vevent,2> >(obj)
{}
};
template<W2_TraitEnum id, class T_vevent>
class SignalWrapperStage2<id,T_vevent,3>
: public SignalWrapperStage2Base<id,T_vevent,3, SignalWrapperStage2<id,T_vevent,3> >
{
typedef W2_Trait<id> myTrait;
typedef myTrait::T_vcmp T_vcmp;
typedef myTrait::T_gcmp T_gcmp;
friend class SignalWrapperStage2Base<id,T_vevent, 3, SignalWrapperStage2<id,T_vevent,3> >;
static int vdk2vec(T_vcmp);
static int eve2vec(GdkEvent* eve);
public: /* ??? */
SignalWrapperStage2(VDKObject* obj)
: SignalWrapperStage2Base<id,T_vevent,3, SignalWrapperStage2<id,T_vevent,3> >(obj)
{}
};
/* **************************************************************************
* *** SignalWrapperStage1M2 ***
* *************************************************************************/
template<W2_TraitEnum id1, int s_count1, W2_TraitEnum id2, int s_count2, class T_vevent>
class SignalWrapperStage1M2
{
private:
typedef W2_Trait<id1> Trait1;
typedef W2_Trait<id2> Trait2;
typedef Trait1::T_vcmp T_vcmp;
SignalWrapperStage2<id1, T_vevent, s_count1> swrap1;
SignalWrapperStage2<id2, T_vevent, s_count2> swrap2;
public:
SignalWrapperStage1M2(VDKObject* obj)
: swrap1(obj), swrap2(obj){}
bool empty() const;
Connection connect(const Slot2<void, VDKObject*, const T_vevent&>& sl,
T_vcmp spec);
Connection connect(const Slot1<void, const T_vevent&>& sl, T_vcmp spec);
void disconnect(Connection& con);
};
/* ************************************************************************
* *** Definition of different signals ***
* ***********************************************************************/
typedef SignalWrapperStage1M2<BUTTON_PRESS,3, BUTTON_RELEASE, 1, VDKMouseEvent>
VDKButtonSignal;
typedef SignalWrapperStage1M2<FOCUS_KEY_IN,1, FOCUS_KEY_OUT,1, VDKKeyFocusEvent>
VDKKeyFocusSignal;
typedef SignalWrapperStage1M2<FOCUS_POINTER_IN,1, FOCUS_POINTER_OUT,1, VDKMouseFocusEvent>
VDKPointerFocusSignal;
typedef SignalWrapperStage1M2<KEY_PRESS,1, KEY_RELEASE,1, VDKKeyEvent>
VDKKeySignal;
typedef SignalWrapperStage1M2<POINTER_PRESSED,1, POINTER_MOVE,1, VDKMouseEvent>
VDKPointerSignal;
typedef SignalWrapperStage2<MAPEVENT, VDKMapEvent, 3>
VDKMapSignal;
typedef DirectEventSignal<GEOMETRY,VDKGeometryEvent>
VDKGeometrySignal;
typedef DirectEventSignal<PAINT,VDKPaintEvent>
VDKPaintSignal;
#endif /* USE_SIGCPLUSPLUS */
#endif /* !_sigc_eventsignals_h_ */
|