control-point.h revision 0dc33d4ce43e0bb49c63aa53b826ec4a1ff68e28
/** @file
* Desktop-bound visual control object
*/
/* Authors:
* Krzysztof KosiĆski <tweenk.pl@gmail.com>
*
* Copyright (C) 2009 Authors
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifndef SEEN_UI_TOOL_CONTROL_POINT_H
#define SEEN_UI_TOOL_CONTROL_POINT_H
#include <boost/utility.hpp>
#include <gdkmm.h>
#include <gtkmm.h>
#include "forward.h"
#include "util/accumulators.h"
#include "display/sodipodi-ctrl.h"
// most of the documentation is in the .cpp file
// these have to be public, because GCC doesn't allow protected types in constructors,
// even if the constructors are protected themselves.
struct ColorEntry {
};
struct ColorSet {
};
enum State {
};
virtual ~ControlPoint();
/// @name Adjust the position of the control point
/// @{
/** Current position of the control point. */
/// @}
/// @name Toggle the point's visibility
/// @{
bool visible() const;
virtual void setVisible(bool v);
/// @}
/// @name Transfer grab from another event handler
/// @{
/// @}
/// @name Receive notifications about control point events
/// @{
/*sigc::signal<void, Geom::Point const &, Geom::Point &, GdkEventMotion*> signal_dragged;
sigc::signal<bool, GdkEventButton*>::accumulated<RInt> signal_clicked;
sigc::signal<bool, GdkEventButton*>::accumulated<RInt> signal_doubleclicked;
sigc::signal<bool, GdkEventMotion*>::accumulated<Int> signal_grabbed;
sigc::signal<void, GdkEventButton*> signal_ungrabbed;*/
/// @}
/// @name Inspect the state of the control point
/// @{
/// @}
static ControlPoint *mouseovered_point;
// temporarily public, until snap delay is refactored a little
/// @name Handle control point events in subclasses
/// @{
/**
* Called when the user moves the point beyond the drag tolerance with the first button held
* down. Return true if you called transferGrab() during this method.
* @param event Motion event when drag tolerance was exceeded */
/**
* Called while dragging, but before moving the knot to new position.
* @param pos Old position, always equal to position()
* @param new_pos New position (after drag). This is passed as a non-const reference,
* so you can change it from the handler - that's how constrained dragging is implemented.
* @param event Motion event */
/**
* @var ControlPoint::signal_ungrabbed
* Emitted when the control point finishes a drag.
* @param event Button release event
*/
/**
* Called when the control point is clicked, at mouse button release. Your override should
* return true if the click had some effect. If it did nothing, return false. Improperly
* implementing this method can cause the default context menu not to appear when a control
* point is right-clicked.
* @param event Button release event */
/**
* Called when the control point is doubleclicked, at mouse button release.
* @param event Button release event */
/// @}
/// @name Manipulate the control point's appearance in subclasses
/// @{
void _setColors(ColorEntry c);
unsigned int _size() const;
SPCtrlShapeType _shape() const;
GtkAnchorType _anchor() const;
/// @}
virtual bool _hasDragTips() { return false; }
static int const _grab_event_mask;
static void _clearMouseover();
bool _updateTip(unsigned state);
void _setDefaultColors();
void _commonInit();
static bool _event_grab;
static bool _drag_initiated;
};
} // namespace UI
} // namespace Inkscape
#endif
/*
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:textwidth=99 :