-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
4DPlugin.cpp
54 lines (46 loc) · 1.44 KB
/
4DPlugin.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//4DPlugin.cpp
/* --------------------------------------------------------------------------------
#
# 4DPlugin.cpp
# source generated by 4D Plugin Wizard
# Project : StatusItem
# author : Eric Marchand
# 28/07/2021
#
# --------------------------------------------------------------------------------*/
#include "4DPluginAPI.h"
#include "4DPlugin.h"
#include "StatusItemController.h"
#include "C_TEXT.h"
void PluginMain( PA_long32 selector, PA_PluginParameters params )
{
switch( selector )
{
// --- status
case 1 :
StatusItem( params );
break;
}
}
// ------------------------------------ status ------------------------------------
void StatusItem( PA_PluginParameters params )
{
StatusItemController* statusItemController = [StatusItemController shared];
// Set method name
PackagePtr pParams = (PackagePtr)params->fParameters;
C_TEXT Param1;
Param1.fromParamAtIndex(pParams, 1);
statusItemController.methodName = Param1.copyUTF16String();
// Set image
PA_Picture image = PA_GetPictureParameter(params, 2);
CGImageRef cgImage = (CGImageRef)PA_CreateNativePictureForScreen(image);
if(cgImage) {
statusItemController.image = [[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize];
[statusItemController.image setTemplate: YES];
CFRelease(cgImage);
}
// install menu
dispatch_async(dispatch_get_main_queue(), ^{
[[StatusItemController shared] setup];
});
}