~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/xpfe/bootstrap/appleevents/nsAEWindowClass.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 
2
/* ***** BEGIN LICENSE BLOCK *****
 
3
 * Version: NPL 1.1/GPL 2.0/LGPL 2.1
 
4
 *
 
5
 * The contents of this file are subject to the Netscape Public License
 
6
 * Version 1.1 (the "License"); you may not use this file except in
 
7
 * compliance with the License. You may obtain a copy of the License at
 
8
 * http://www.mozilla.org/NPL/
 
9
 *
 
10
 * Software distributed under the License is distributed on an "AS IS" basis,
 
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 
12
 * for the specific language governing rights and limitations under the
 
13
 * License.
 
14
 *
 
15
 * The Original Code is Mozilla Communicator client code.
 
16
 *
 
17
 * The Initial Developer of the Original Code is 
 
18
 * Netscape Communications Corporation.
 
19
 * Portions created by the Initial Developer are Copyright (C) 1998
 
20
 * the Initial Developer. All Rights Reserved.
 
21
 *
 
22
 * Contributor(s):
 
23
 *  Simon Fraser <sfraser@netscape.com>
 
24
 *
 
25
 * Alternatively, the contents of this file may be used under the terms of
 
26
 * either the GNU General Public License Version 2 or later (the "GPL"), or 
 
27
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 
28
 * in which case the provisions of the GPL or the LGPL are applicable instead
 
29
 * of those above. If you wish to allow use of your version of this file only
 
30
 * under the terms of either the GPL or the LGPL, and not to allow others to
 
31
 * use your version of this file under the terms of the NPL, indicate your
 
32
 * decision by deleting the provisions above and replace them with the notice
 
33
 * and other provisions required by the GPL or the LGPL. If you do not delete
 
34
 * the provisions above, a recipient may use your version of this file under
 
35
 * the terms of any one of the NPL, the GPL or the LGPL.
 
36
 *
 
37
 * ***** END LICENSE BLOCK ***** */
 
38
 
 
39
 
 
40
#ifndef __AEWINDOWCLASS__
 
41
#define __AEWINDOWCLASS__
 
42
 
 
43
 
 
44
 
 
45
#include "nsAEGenericClass.h"
 
46
 
 
47
 
 
48
class AEWindowIterator : public AEClassIterator
 
49
{
 
50
public:
 
51
 
 
52
                                                AEWindowIterator(DescType classType, TWindowKind windowKind)
 
53
                                                : AEClassIterator(classType)
 
54
                                                ,       mWindowKind(windowKind)
 
55
                                                {}
 
56
                                                
 
57
        virtual UInt32                  GetNumItems(const AEDesc* containerToken);
 
58
        virtual ItemRef                 GetNamedItemReference(const AEDesc* containerToken, const char *itemName);
 
59
        virtual ItemRef                 GetIndexedItemReference(const AEDesc* containerToken, TAEListIndex itemIndex);
 
60
        
 
61
        virtual TAEListIndex            GetIndexFromItemID(const AEDesc* containerToken, ItemID itemID);
 
62
 
 
63
        virtual ItemID                  GetNamedItemID(const AEDesc* containerToken, const char *itemName);
 
64
        virtual ItemID                  GetIndexedItemID(const AEDesc* containerToken, TAEListIndex itemIndex);
 
65
 
 
66
        // index to name
 
67
        virtual void                    GetIndexedItemName(const AEDesc* containerToken, TAEListIndex itemIndex, char *outName, long maxLen);
 
68
 
 
69
        // conversion routines.
 
70
        virtual ItemID                  GetIDFromReference(const AEDesc* containerToken, ItemRef itemRef);
 
71
        virtual ItemRef                 GetReferenceFromID(const AEDesc* containerToken, ItemID itemID);
 
72
 
 
73
        virtual ItemID                  GetItemIDFromToken(const AEDesc* token);
 
74
        virtual void                    SetItemIDInCoreToken(const AEDesc* containerToken, CoreTokenRecord* tokenRecord, ItemID itemID);
 
75
        
 
76
        TWindowKind                     GetThisWindowKind() { return mWindowKind; }
 
77
 
 
78
protected:
 
79
        
 
80
        TWindowKind                     mWindowKind;
 
81
};
 
82
 
 
83
 
 
84
 
 
85
class AEWindowClass : public AEGenericClass
 
86
{
 
87
        friend class AECoreClass;
 
88
 
 
89
private:
 
90
        typedef AEGenericClass  Inherited;
 
91
        
 
92
protected:
 
93
        // only the AECoreClass can instantiate us
 
94
                                                AEWindowClass(DescType classType, TWindowKind windowKind);
 
95
                                                ~AEWindowClass();
 
96
 
 
97
 
 
98
        void                                    GetDocumentFromWindow(  DescType                        desiredClass,           // cWindow
 
99
                                                                                        const AEDesc*           containerToken, // null container
 
100
                                                                                        DescType                        containerClass,          // cApplication
 
101
                                                                                        DescType                        keyForm,
 
102
                                                                                        const AEDesc*           keyData,
 
103
                                                                                        AEDesc*                 resultToken);           // specified Window is returned in result
 
104
 
 
105
        virtual void                    GetItemFromContainer(   DescType                        desiredClass,
 
106
                                                                                        const AEDesc*           containerToken,
 
107
                                                                                        DescType                        containerClass, 
 
108
                                                                                        DescType                        keyForm,
 
109
                                                                                        const AEDesc*           keyData,
 
110
                                                                                        AEDesc*                 resultToken);
 
111
 
 
112
        virtual void                    CompareObjects(         DescType                        comparisonOperator,
 
113
                                                                                        const AEDesc *          object,
 
114
                                                                                        const AEDesc *          descriptorOrObject,
 
115
                                                                                        Boolean *                       result);
 
116
 
 
117
        virtual void                    CountObjects(                   DescType                        desiredType,
 
118
                                                                                        DescType                        containerClass,
 
119
                                                                                        const AEDesc *          container,
 
120
                                                                                        long *                  result);
 
121
 
 
122
public:
 
123
        // AE Handlers
 
124
        
 
125
        static pascal OSErr             DocumentAccessor(               DescType                        desiredClass,           // cDocument
 
126
                                                                                        const AEDesc*           containerToken, // null container
 
127
                                                                                        DescType                        containerClass,          // cApplication
 
128
                                                                                        DescType                        keyForm,
 
129
                                                                                        const AEDesc*           keyData,
 
130
                                                                                        AEDesc*                 resultToken,            // specified Document is returned in result
 
131
                                                                                        long                            refCon);
 
132
 
 
133
protected:
 
134
 
 
135
        // ----------------------------------------------------------------------------
 
136
        //      Core Suite Object Event handlers
 
137
        // ----------------------------------------------------------------------------
 
138
        virtual void                    HandleClose(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
 
139
        virtual void                    HandleDataSize(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
 
140
        virtual void                    HandleDelete(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
 
141
        virtual void                    HandleDuplicate(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
 
142
        virtual void                    HandleExists(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
 
143
        virtual void                    HandleMake(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
 
144
        virtual void                    HandleMove(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
 
145
        virtual void                    HandleOpen(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
 
146
        virtual void                    HandlePrint(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
 
147
        virtual void                    HandleQuit(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
 
148
        virtual void                    HandleSave(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
 
149
        
 
150
        // ----------------------------------------------------------------------------
 
151
        //      Methods for creating self and container specifiers
 
152
        // ----------------------------------------------------------------------------
 
153
 
 
154
        virtual void                    CreateSelfSpecifier(const AEDesc *token, AEDesc *outSpecifier);
 
155
 
 
156
        // ----------------------------------------------------------------------------
 
157
        //      Get and Set methods for objects and list
 
158
        // ----------------------------------------------------------------------------
 
159
 
 
160
        virtual void                    GetDataFromObject(const AEDesc *token, AEDesc *desiredTypes, AEDesc *data);
 
161
        virtual void                    SetDataForObject(const AEDesc *token, AEDesc *data);
 
162
 
 
163
        virtual Boolean                 CanSetProperty(DescType propertyCode);
 
164
        virtual Boolean                 CanGetProperty(DescType propertyCode);
 
165
 
 
166
        void                                    SetWindowProperties(WindowPtr wind, const AEDesc *propertyRecord);
 
167
        void                                    MakeWindowObjectSpecifier(WindowPtr wind, AEDesc *outSpecifier);
 
168
        
 
169
        WindowPtr                       GetWindowByIndex(TWindowKind windowKind, long index);
 
170
        WindowPtr                       GetWindowByTitle(TWindowKind windowKind, ConstStr63Param title);
 
171
        
 
172
        long                                    GetWindowIndex(TWindowKind windowKind, WindowPtr window);
 
173
        WindowPtr                       GetPreviousWindow(TWindowKind windowKind, WindowPtr wind);
 
174
 
 
175
        TWindowKind                     GetThisWindowKind()             { return mWindowKind; }
 
176
        
 
177
public:
 
178
 
 
179
        static long                             CountWindows(TWindowKind windowKind);
 
180
 
 
181
protected:
 
182
 
 
183
        TWindowKind                     mWindowKind;
 
184
 
 
185
protected:
 
186
 
 
187
        OSLAccessorUPP          mDocumentAccessor;
 
188
        
 
189
};
 
190
 
 
191
 
 
192
#endif /* __AEWINDOWCLASS__ */
 
193
 
 
194