summaryrefslogtreecommitdiff
path: root/plugins/HistoryPlusPlus/hpp_olesmileys.pas
blob: 4a07d8259f48e2460126bc907c60a6640f067a51 (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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
(*
    History++ plugin for Miranda IM: the free IM client for Microsoft* Windows*

    Copyright (C) 2006-2009 theMIROn, 2003-2006 Art Fedorov.
    History+ parts (C) 2001 Christian Kastner

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*)

{-----------------------------------------------------------------------------
 hpp_olesmileys (historypp project)

 Version:   1.5
 Created:   04.02.2007
 Author:    theMIROn

 [ Description ]

 [ History ]

 1.5 (04.02.2007)
   First version

 [ Modifications ]
 none

 [ Known Issues ]
 none

 Contributors: theMIROn
-----------------------------------------------------------------------------}

unit hpp_olesmileys;

interface

uses Windows,CommCtrl,ActiveX;

const
  IID_ITooltipData:     TGUID = '{58B32D03-1BD2-4840-992E-9AE799FD4ADE}';
  IID_IGifSmileyCtrl:   TGUID = '{CB64102B-8CE4-4A55-B050-131C435A3A3F}';
  IID_ISmileyAddSmiley: TGUID = '{105C56DF-6455-4705-A501-51F1CCFCF688}';
  IID_IEmoticonsImage:  TGUID = '{2FD9449B-7EBB-476a-A9DD-AE61382CCE08}';

type
  ITooltipData = interface(IUnknown)
   ['{58B32D03-1BD2-4840-992E-9AE799FD4ADE}']
   function SetTooltip(const bstrHint: WideString): HRESULT; stdcall;
   function GetTooltip(out bstrHint: WideString): HRESULT; stdcall;
  end;

  IGifSmileyCtrl = interface(IUnknown)
    ['{CB64102B-8CE4-4A55-B050-131C435A3A3F}']
  end;

  ISmileyAddSmiley = interface(IUnknown)
    ['{105C56DF-6455-4705-A501-51F1CCFCF688}']
  end;

  IEmoticonsImage = interface(IUnknown)
    ['{2FD9449B-7EBB-476a-A9DD-AE61382CCE08}']
  end;

(*
	NM_FIREVIEWCHANGE is WM_NOTIFY Message for notify parent of host window about smiley are going to be repaint

	The proposed action is next: Owner of RichEdit windows received NM_FIREVIEWCHANGE through WM_NOTIFY
	twice first time before painting|invalidating (FVCN_PREFIRE) and second time - after (FVCN_POSTFIRE).
	The Owner window may change any values of received FVCNDATA_NMHDR structure in order to raise needed action.
	For example it may substitute FVCA_INVALIDATE to FVCA_CUSTOMDRAW event to force painting on self offscreen context.
	
	It can be:
	FVCA_CUSTOMDRAW - in this case you need to provide valid HDC to draw on and valid RECT of smiley
	FVCA_INVALIDATE - to invalidate specified rect of window 
	FVCA_NONE		- skip any action. But be aware - animation will be stopped till next repainting of smiley.
	FVCA_SENDVIEWCHANGE - to notify richedit ole about object changed. Be aware Richedit will fully reconstruct itself

	Another point is moment of received smiley rect - it is only valid if FVCA_DRAW is initially set, 
	and it is PROBABLY valid if FVCA_INVALIDATE is set. And it most probably invalid in case of FVCA_SENDVIEWCHANGE.
	The smiley position is relative last full paint HDC. Usually it is relative to top-left corner of host 
	richedit (NOT it client area) in windows coordinates. 

*)

const
    // Type of Event one of
    FVCN_PREFIRE  = 1;
    FVCN_POSTFIRE = 2;
    FVCN_GETINFO  = 255;

    // Action of event are going to be done
    FVCA_NONE           = 0;
    FVCA_DRAW           = 1;   // do not modify hdc in case of _DRAW, Use _CUSTOMDRAW
    FVCA_CUSTOMDRAW     = 2;
    FVCA_INVALIDATE     = 3;
    FVCA_SENDVIEWCHANGE = 4;
    FVCA_SKIPDRAW       = 5;
    FVCA_INFO           = 255;

type
    // Extended NMHDR structure for WM_NOTIFY
    PFVCNDATA_NMHDR= ^TFVCNDATA_NMHDR;
    TFVCNDATA_NMHDR = record
        nmhdr: TNMHdr;
        cbSize: Integer;
        bEvent: Byte;
        bAction: Byte;
        hDC: HDC;
        rcRect: TRect;
        clrBackground: COLORREF;
        fTransparent: BOOL;
        lParam: LPARAM;
    end;

const
    // Code of WM_NOTIFY message (code)
    NM_FIREVIEWCHANGE = NM_FIRST+1;

implementation

end.