1
2
3
4
5
6
7
8
9
|
/*
* Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
|
|
|
1
2
3
4
5
6
7
8
9
|
/*
* Copyright (c) 2008-2023 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
|
︙ | | | ︙ | |
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
@class OFArray OF_GENERIC(ObjectType);
@class OFDictionary OF_GENERIC(KeyType, ObjectType);
@class OFMutableArray OF_GENERIC(ObjectType);
@class OFMutableDictionary OF_GENERIC(KeyType, ObjectType);
@class OFSandbox;
@class OFString;
/**
* @brief A notification that will be sent when the application will terminate.
*/
extern const OFNotificationName OFApplicationWillTerminateNotification;
/**
* @brief Specify the class to be used as the application delegate.
|
>
>
>
>
>
>
|
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
@class OFArray OF_GENERIC(ObjectType);
@class OFDictionary OF_GENERIC(KeyType, ObjectType);
@class OFMutableArray OF_GENERIC(ObjectType);
@class OFMutableDictionary OF_GENERIC(KeyType, ObjectType);
@class OFSandbox;
@class OFString;
/**
* @brief A notification that will be sent when the application did finish
* launching.
*/
extern const OFNotificationName OFApplicationDidFinishLaunchingNotification;
/**
* @brief A notification that will be sent when the application will terminate.
*/
extern const OFNotificationName OFApplicationWillTerminateNotification;
/**
* @brief Specify the class to be used as the application delegate.
|
︙ | | | ︙ | |
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
* @interface MyAppDelegate: OFObject <OFApplicationDelegate>
* @end
*
* // In MyAppDelegate.m:
* OF_APPLICATION_DELEGATE(MyAppDelegate)
*
* @implementation MyAppDelegate
* - (void)applicationDidFinishLaunching
* {
* [OFApplication terminate];
* }
* @end
* @endcode
*/
#define OF_APPLICATION_DELEGATE(class_) \
|
|
|
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
* @interface MyAppDelegate: OFObject <OFApplicationDelegate>
* @end
*
* // In MyAppDelegate.m:
* OF_APPLICATION_DELEGATE(MyAppDelegate)
*
* @implementation MyAppDelegate
* - (void)applicationDidFinishLaunching: (OFNotification *)notification
* {
* [OFApplication terminate];
* }
* @end
* @endcode
*/
#define OF_APPLICATION_DELEGATE(class_) \
|
︙ | | | ︙ | |
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
*
* @note Signals are not available on AmigaOS!
*/
@protocol OFApplicationDelegate <OFObject>
/**
* @brief A method which is called when the application was initialized and is
* running now.
*/
- (void)applicationDidFinishLaunching;
@optional
/**
* @brief A method which is called when the application will terminate.
*/
- (void)applicationWillTerminate;
/**
* @brief A method which is called when the application received a SIGINT.
*
* @warning You are not allowed to send any messages inside this method, as
* message dispatching is not signal-safe! You are only allowed to do
* signal-safe operations like setting a variable or calling a
|
>
>
>
|
>
>
>
|
|
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
*
* @note Signals are not available on AmigaOS!
*/
@protocol OFApplicationDelegate <OFObject>
/**
* @brief A method which is called when the application was initialized and is
* running now.
*
* @param notification A notification with name
* OFApplicationDidFinishLaunchingNotification
*/
- (void)applicationDidFinishLaunching: (OFNotification *)notification;
@optional
/**
* @brief A method which is called when the application will terminate.
*
* @param notification A notification with name
* OFApplicationWillTerminateNotification
*/
- (void)applicationWillTerminate: (OFNotification *)notification;
/**
* @brief A method which is called when the application received a SIGINT.
*
* @warning You are not allowed to send any messages inside this method, as
* message dispatching is not signal-safe! You are only allowed to do
* signal-safe operations like setting a variable or calling a
|
︙ | | | ︙ | |
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
* @brief A class which represents the application as an object.
*
* In order to create a new OFApplication, you should create a class conforming
* to the optional @ref OFApplicationDelegate protocol and put
* `OF_APPLICATION_DELEGATE(NameOfYourClass)` in the .m file of that class.
*
* When the application is about to be terminated,
* @ref OFApplicationDelegate#applicationWillTerminate will be called on the
* delegate and an @ref OFApplicationWillTerminateNotification will be sent.
*/
OF_SUBCLASSING_RESTRICTED
@interface OFApplication: OFObject
{
OFString *_programName;
OFArray OF_GENERIC(OFString *) *_arguments;
|
|
|
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
* @brief A class which represents the application as an object.
*
* In order to create a new OFApplication, you should create a class conforming
* to the optional @ref OFApplicationDelegate protocol and put
* `OF_APPLICATION_DELEGATE(NameOfYourClass)` in the .m file of that class.
*
* When the application is about to be terminated,
* @ref OFApplicationDelegate#applicationWillTerminate: will be called on the
* delegate and an @ref OFApplicationWillTerminateNotification will be sent.
*/
OF_SUBCLASSING_RESTRICTED
@interface OFApplication: OFObject
{
OFString *_programName;
OFArray OF_GENERIC(OFString *) *_arguments;
|
︙ | | | ︙ | |