Code

Snap to intersections of line segments
[inkscape.git] / src / api / inkscape.idl
1 #ifndef __INKSCAPE_IDL__
2 #define __INKSCAPE_IDL__
3 /**
4  * Inkscape API Description
5  *
6  * This is a place where people can discuss and modify their ideas
7  * of what an Inkscape exported API should look like. 
8  * 
9  * This IDL file should be considered to be somewhat of a Wish List,
10  * and people should feel free to add their ideas to it.   
11  *
12  * Authors:
13  *   Inkscape members
14  *
15  * Copyright (C) 2007 Inkscape.org
16  *
17  *  This library is free software; you can redistribute it and/or
18  *  modify it under the terms of the GNU Lesser General Public
19  *  License as published by the Free Software Foundation; either
20  *  version 2.1 of the License, or (at your option) any later version.
21  *
22  *  This library is distributed in the hope that it will be useful,
23  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
24  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25  *  Lesser General Public License for more details.
26  *
27  *  You should have received a copy of the GNU Lesser General Public
28  *  License along with this library; if not, write to the Free Software
29  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
30  */
34 module inkscape
35 {
36 module api
37 {
39     /**
40      * This will actually be defined as a Glib::ustring
41      * but people should use the word 'String'
42      */
43     valuetype String sequence<unsigned short>;
45     /**
46      * Forward declarations
47      */     
48     interface Env;
49     interface Application;
50     interface Document;
51     interface Desktop;
52     interface DialogManager;
56     exception Exception {
57         unsigned short   code;
58     };
60     /**
61      *   ExceptionCodes
62      *   These muse be constants, since languages handle enums
63      *   differently.   
64      */   
65     const unsigned short      INKER                       = 1;
66     const unsigned short      INKERR_NOT_FOUND            = 2;
67     const unsigned short      INKERR_NOT_SUPPORTED        = 3;
71     /**
72      * This is the top-level root of all Inkscape interfaces.
73      * It is the single point of contact from which all other
74      * interfaces can be accessed.  Anything top-level or
75      * global should be parented here.
76      * 
77      * This allows an entire set of interfaces to be exported
78      * to a shared object with only a single symbol.  This symbol
79      * can be accessed something like:
80      *
81      *  typedef (Env *)(EnvCreateFunc)();     
82      *  EnvCreateFunc createEnvironment =
83      *              (EnvCreateFunc) dlsym("createEnvironment");
84      *  Env *ink = createEnvironment();
85      *       
86      *  
87      *  This allows shared object linking to be much easier, and
88      *  allows binding to other languages to be performed however
89      *  is best for each.                    
90      *
91      */
92     interface Env {
94         /**
95          *  This is the main application, which
96          */         
97         Application *getApplication();
99     };
100     
101     /**
102      *
103      * Top-level Inkscape application
104      *
105      */
106     interface Application {
108         /**
109          *  Return the currently-focused desktop
110          */         
111         Desktop *getActiveDesktop();
113         /**
114          *  Return the document in the currently-focused desktop
115          */         
116         Document *getActiveDocument();
118     };
119     
120     /**
121      *    
122      * This is a main editing window, with all of its chrome.
123      *
124      */
125     interface Desktop {
127         /**
128          *  Return the dialog manager for this desktop
129          */         
130         DialogManager *getDialogManager();
132     };
133     
134     /**
135      * An Inkscape Document, which is SPObject + XML
136      *
137      */
138     interface Document {
141         /**
142          *  Copy the document's XML into a DOM tree and
143          *  return a pointer to it.         
144          */         
145         org::w3c::dom::Document *getDOM();
147         /**
148          *  Set the Document's repr tree to the specified 
149          *  DOM document
150          */         
151         bool setDOM(org::w3c::dom::Document *doc);
153     };
154     
155     /**
156      * The interface that controls Inkscape's dialogs
157      *
158      */
159     interface DialogManager {
161         /**
162          *
163          */         
164         //some method
166     };
167     
172 }; // module api
174 }; // module inkscape
177 #endif // __INKSCAPE_IDL__