Code

emf import : recalculate text alignment for rotated text (Bug 341847)
[inkscape.git] / src / helper / action.h
1 #ifndef __SP_ACTION_H__
2 #define __SP_ACTION_H__
4 /** \file
5  * Inkscape UI action implementation
6  */
8 /*
9  * Author:
10  *   Lauris Kaplinski <lauris@kaplinski.com>
11  *
12  * Copyright (C) 2003 Lauris Kaplinski
13  *
14  * This code is in public domain
15  */
17 /** A macro to get the GType for actions */
18 #define SP_TYPE_ACTION (sp_action_get_type())
19 /** A macro to cast and check the cast of changing an object to an action */
20 #define SP_ACTION(o) (NR_CHECK_INSTANCE_CAST((o), SP_TYPE_ACTION, SPAction))
21 /** A macro to check whether or not something is an action */
22 #define SP_IS_ACTION(o) (NR_CHECK_INSTANCE_TYPE((o), SP_TYPE_ACTION))
24 #include "helper/helper-forward.h"
25 #include "libnr/nr-object.h"
26 #include "forward.h"
28 #include <glibmm/ustring.h>
29 //class Inkscape::UI::View::View;
31 namespace Inkscape {
32 class Verb;
33 }
36 /** This is a structure that is used to hold all the possible
37     actions that can be taken with an action.  These are the
38     function pointers available. */
39 struct SPActionEventVector {
40     NRObjectEventVector object_vector;                                        /**< Parent class */
41     void (* perform)(SPAction *action, void *ldata, void *pdata);             /**< Actually do the action of the event.  Called by sp_perform_action */
42     void (* set_active)(SPAction *action, unsigned active, void *data);       /**< Callback for activation change */
43     void (* set_sensitive)(SPAction *action, unsigned sensitive, void *data); /**< Callback for a change in sensitivity */
44     void (* set_shortcut)(SPAction *action, unsigned shortcut, void *data);   /**< Callback for setting the shortcut for this function */
45     void (* set_name)(SPAction *action, Glib::ustring, void *data);           /**< Callback for setting the name for this function */
46 };
48 /** All the data that is required to be an action.  This
49     structure identifies the action and has the data to
50         create menus and toolbars for the action */
51 struct SPAction : public NRActiveObject {
52     unsigned sensitive : 1;  /**< Value to track whether the action is sensitive */
53     unsigned active : 1;     /**< Value to track whether the action is active */
54     Inkscape::UI::View::View *view;            /**< The View to which this action is attached */
55     gchar *id;               /**< The identifier for the action */
56     gchar *name;             /**< Full text name of the action */
57     gchar *tip;              /**< A tooltip to describe the action */
58     gchar *image;            /**< An image to visually identify the action */
59     Inkscape::Verb *verb;    /**< The verb that produced this action */
60 };
62 /** The action class is the same as its parent. */
63 struct SPActionClass {
64     NRActiveObjectClass parent_class; /**< Parent Class */
65 };
67 NRType sp_action_get_type();
69 SPAction *sp_action_new(Inkscape::UI::View::View *view,
70                         gchar const *id,
71                         gchar const *name,
72                         gchar const *tip,
73                         gchar const *image,
74                         Inkscape::Verb *verb);
76 void sp_action_perform(SPAction *action, void *data);
77 void sp_action_set_active(SPAction *action, unsigned active);
78 void sp_action_set_sensitive(SPAction *action, unsigned sensitive);
79 void sp_action_set_name (SPAction *action, Glib::ustring);
80 Inkscape::UI::View::View *sp_action_get_view(SPAction *action);
82 #endif
85 /*
86   Local Variables:
87   mode:c++
88   c-file-style:"stroustrup"
89   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
90   indent-tabs-mode:nil
91   fill-column:99
92   End:
93 */
94 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :