| 4394 |
ripley |
1 |
/*
|
|
|
2 |
* R : A Computer Language for Statistical Data Analysis
|
|
|
3 |
* Copyright (C) 1999 Guido Masarotto
|
|
|
4 |
*
|
|
|
5 |
* This program is free software; you can redistribute it and/or modify
|
|
|
6 |
* it under the terms of the GNU General Public License as published by
|
|
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
|
8 |
* (at your option) any later version.
|
|
|
9 |
*
|
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
13 |
* GNU General Public License for more details.
|
|
|
14 |
*
|
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
|
16 |
* along with this program; if not, write to the Free Software
|
| 5458 |
ripley |
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
| 4394 |
ripley |
18 |
*/
|
|
|
19 |
|
|
|
20 |
/*
|
|
|
21 |
* Support for tooltip
|
|
|
22 |
* int addtooltip(obj,char *) (on error return 0)
|
|
|
23 |
*/
|
|
|
24 |
|
|
|
25 |
/*
|
|
|
26 |
This file is an add-on to GraphApp, a cross-platform C graphics library.
|
|
|
27 |
*/
|
|
|
28 |
|
|
|
29 |
#include "internal.h"
|
|
|
30 |
static HWND hwndToolTip = 0;
|
| 5429 |
ripley |
31 |
#ifndef TOOLTIPS_CLASS
|
|
|
32 |
#include "commctrl.h"
|
|
|
33 |
#endif
|
| 4394 |
ripley |
34 |
|
|
|
35 |
int addtooltip(control c,char *tp) {
|
|
|
36 |
TOOLINFO ti;
|
|
|
37 |
char *cc = (char*) &ti;
|
|
|
38 |
int i, lim = sizeof (ti);
|
|
|
39 |
for (i = 0; i++ < lim; *cc++ = 0);
|
|
|
40 |
if (hwndToolTip == 0) {
|
|
|
41 |
InitCommonControls();
|
|
|
42 |
hwndToolTip = CreateWindowEx(
|
|
|
43 |
0,TOOLTIPS_CLASS,NULL,WS_POPUP|TTS_ALWAYSTIP,
|
|
|
44 |
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
|
|
|
45 |
hwndFrame,NULL,this_instance,NULL);
|
|
|
46 |
if(!hwndToolTip) return 0;
|
|
|
47 |
}
|
|
|
48 |
ti.cbSize = sizeof(ti);
|
|
|
49 |
ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
|
|
|
50 |
ti.hwnd = (HWND) c->parent->handle;
|
|
|
51 |
ti.uId = (UINT) c->handle;
|
|
|
52 |
ti.lpszText = (LPSTR) tp;
|
|
|
53 |
return
|
|
|
54 |
(SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti)==TRUE)?
|
|
|
55 |
1:0;
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
|
|
|
59 |
|