summaryrefslogtreecommitdiff
path: root/plugins/ExternalAPI/delphi/m_notify.inc
blob: 2798ebbf3155afe4a3e9b9fcc693d219fbbe0554 (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{$IFNDEF M_NOTIFY}
{$DEFINE M_NOTIFY}

{** Miranda Notify Dispatcher ************************************************
Notify Dispatcher provides common interface to different notification plugins
like osd, popup, ticker etc.
******************************************************************************}

const
{ Options UI event and service. The same as for miranda options }
  ME_NOTIFY_OPT_INITIALISE:PAnsiChar = 'Notify/Opt/Initialise';
  MS_NOTIFY_OPT_ADDPAGE:PAnsiChar    = 'Notify/Opt/AddPage';

type
  PMNOTIFYACTIONINFO = ^TMNOTIFYACTIONINFO;
  TMNOTIFYACTIONINFO = record
    icon   :HICON;
    name   :array [0..MAXMODULELABELLENGTH-1] of AnsiChar;
    service:array [0..MAXMODULELABELLENGTH-1] of AnsiChar;
    cookie :dword;
  end;

// Just like miranda pluginLink... This should work faster then services,
// we need some reactivity in notifications.
type
  PMNOTIFYLINK = ^TMNOTIFYLINK;
  TMNOTIFYLINK = record
    // Create a new notification type
    Register:function(name:PAnsiChar;icon:HICON):THANDLE;cdecl;

    // Create a new notification object
    Create:function(atype:THANDLE):THANDLE;cdecl;

    // Check is handle is a valid notification object
    IsValid:function(notify:THANDLE):integer;cdecl;

    // Set/get information about object, or type defaults
    _Set:function(notifyORtype:THANDLE;name:PAnsiChar;val:TDBVARIANT):integer;cdecl;
    _Get:function(notifyORtype:THANDLE;name:PAnsiChar;val:PDBVARIANT):integer;cdecl;

    // Set/get actions
    AddAction :function(notifyORtype:THANDLE;icon:HICON;name:PAnsiChar;service:PAnsiChar;cookie:dword):integer;cdecl;
    GetActions:function(notifyORtype:THANDLE;actions:PMNOTIFYACTIONINFO):integer;cdecl;

    // Increment/decrement refer count of notification object. Unreferred objects are destroyed
    AddRef :function(notify:THANDLE):integer;cdecl;
    Release:function(notify:THANDLE):integer;cdecl;

    // Notify user
    Show  :procedure(notify:THANDLE);cdecl;
    Update:procedure(notify:THANDLE);cdecl;
    Remove:procedure(notify:THANDLE);cdecl;
  end;

const
// Get the MNOTIFYLINK struct
// result = (LRESULT)(MNOTIFYLINK* )notifyLink
  MS_NOTIFY_GETLINK:PAnsiChar = 'Notify/GetLink';

// Hook this to process corresponding actions
  ME_NOTIFY_SHOW  :PAnsiChar = 'Notify/Show';
  ME_NOTIFY_UPDATE:PAnsiChar = 'Notify/Update';
  ME_NOTIFY_REMOVE:PAnsiChar = 'Notify/Remove';

var
  notifyLink:PMNOTIFYLINK;

const
// Common options for Get/Set actions
  NFOPT_TYPENAME  = 'General/TypeName';
  NFOPT_ICON      = 'General/Icon';
  NFOPT_CONTACT   = 'General/Contact';
  NFOPT_EVENT     = 'General/Event';
  NFOPT_TEXT      = 'General/Text';
  NFOPT_TEXTW     = 'General/TextW';
  NFOPT_TITLE     = 'General/Title';
  NFOPT_TITLEW    = 'General/TitleW';
  NFOPT_BACKCOLOR = 'General/BackColor';
  NFOPT_TEXTCOLOR = 'General/TextColor';
  NFOPT_TIMEOUT   = 'General/Timeout';

{$ENDIF}