~valavanisalex/ubuntu/precise/inkscape/fix-943984

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/src/helper/action.h

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __SP_ACTION_H__
 
2
#define __SP_ACTION_H__
 
3
 
 
4
/** \file
 
5
 * Inkscape UI action implementation
 
6
 */
 
7
 
 
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
 */
 
16
 
 
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))
 
23
 
 
24
#include "helper/helper-forward.h"
 
25
#include "libnr/nr-object.h"
 
26
#include "forward.h"
 
27
 
 
28
#include <glibmm/ustring.h>
 
29
//class Inkscape::UI::View::View; 
 
30
 
 
31
namespace Inkscape {
 
32
class Verb;
 
33
}
 
34
 
 
35
 
 
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
};
 
47
 
 
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
};
 
61
 
 
62
/** The action class is the same as its parent. */
 
63
struct SPActionClass {
 
64
    NRActiveObjectClass parent_class; /**< Parent Class */
 
65
};
 
66
 
 
67
NRType sp_action_get_type();
 
68
 
 
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);
 
75
 
 
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);
 
81
 
 
82
#endif
 
83
 
 
84
 
 
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:encoding=utf-8:textwidth=99 :