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
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/
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
15
* The Original Code is Mozilla Communicator client code.
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.
23
* Simon Fraser <sfraser@netscape.com>
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.
37
* ***** END LICENSE BLOCK ***** */
40
#ifndef __AEWINDOWCLASS__
41
#define __AEWINDOWCLASS__
45
#include "nsAEGenericClass.h"
48
class AEWindowIterator : public AEClassIterator
52
AEWindowIterator(DescType classType, TWindowKind windowKind)
53
: AEClassIterator(classType)
54
, mWindowKind(windowKind)
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);
61
virtual TAEListIndex GetIndexFromItemID(const AEDesc* containerToken, ItemID itemID);
63
virtual ItemID GetNamedItemID(const AEDesc* containerToken, const char *itemName);
64
virtual ItemID GetIndexedItemID(const AEDesc* containerToken, TAEListIndex itemIndex);
67
virtual void GetIndexedItemName(const AEDesc* containerToken, TAEListIndex itemIndex, char *outName, long maxLen);
69
// conversion routines.
70
virtual ItemID GetIDFromReference(const AEDesc* containerToken, ItemRef itemRef);
71
virtual ItemRef GetReferenceFromID(const AEDesc* containerToken, ItemID itemID);
73
virtual ItemID GetItemIDFromToken(const AEDesc* token);
74
virtual void SetItemIDInCoreToken(const AEDesc* containerToken, CoreTokenRecord* tokenRecord, ItemID itemID);
76
TWindowKind GetThisWindowKind() { return mWindowKind; }
80
TWindowKind mWindowKind;
85
class AEWindowClass : public AEGenericClass
87
friend class AECoreClass;
90
typedef AEGenericClass Inherited;
93
// only the AECoreClass can instantiate us
94
AEWindowClass(DescType classType, TWindowKind windowKind);
98
void GetDocumentFromWindow( DescType desiredClass, // cWindow
99
const AEDesc* containerToken, // null container
100
DescType containerClass, // cApplication
102
const AEDesc* keyData,
103
AEDesc* resultToken); // specified Window is returned in result
105
virtual void GetItemFromContainer( DescType desiredClass,
106
const AEDesc* containerToken,
107
DescType containerClass,
109
const AEDesc* keyData,
110
AEDesc* resultToken);
112
virtual void CompareObjects( DescType comparisonOperator,
113
const AEDesc * object,
114
const AEDesc * descriptorOrObject,
117
virtual void CountObjects( DescType desiredType,
118
DescType containerClass,
119
const AEDesc * container,
125
static pascal OSErr DocumentAccessor( DescType desiredClass, // cDocument
126
const AEDesc* containerToken, // null container
127
DescType containerClass, // cApplication
129
const AEDesc* keyData,
130
AEDesc* resultToken, // specified Document is returned in result
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);
150
// ----------------------------------------------------------------------------
151
// Methods for creating self and container specifiers
152
// ----------------------------------------------------------------------------
154
virtual void CreateSelfSpecifier(const AEDesc *token, AEDesc *outSpecifier);
156
// ----------------------------------------------------------------------------
157
// Get and Set methods for objects and list
158
// ----------------------------------------------------------------------------
160
virtual void GetDataFromObject(const AEDesc *token, AEDesc *desiredTypes, AEDesc *data);
161
virtual void SetDataForObject(const AEDesc *token, AEDesc *data);
163
virtual Boolean CanSetProperty(DescType propertyCode);
164
virtual Boolean CanGetProperty(DescType propertyCode);
166
void SetWindowProperties(WindowPtr wind, const AEDesc *propertyRecord);
167
void MakeWindowObjectSpecifier(WindowPtr wind, AEDesc *outSpecifier);
169
WindowPtr GetWindowByIndex(TWindowKind windowKind, long index);
170
WindowPtr GetWindowByTitle(TWindowKind windowKind, ConstStr63Param title);
172
long GetWindowIndex(TWindowKind windowKind, WindowPtr window);
173
WindowPtr GetPreviousWindow(TWindowKind windowKind, WindowPtr wind);
175
TWindowKind GetThisWindowKind() { return mWindowKind; }
179
static long CountWindows(TWindowKind windowKind);
183
TWindowKind mWindowKind;
187
OSLAccessorUPP mDocumentAccessor;
192
#endif /* __AEWINDOWCLASS__ */