winhelp.h 4.54 KB
Newer Older
Alexandre Julliard's avatar
Alexandre Julliard committed
1 2 3
/*
 * Help Viewer
 *
4 5 6 7
 * Copyright    1996 Ulrich Schmid
 * Copyright    2002 Sylvain Petreolle <spetreolle@yahoo.fr>
 *              2002 Eric Pouech
 *
8 9 10 11 12 13 14 15 16 17 18 19
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
20
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Alexandre Julliard's avatar
Alexandre Julliard committed
21 22
 */

23 24
#define MAX_LANGUAGE_NUMBER     255
#define MAX_STRING_LEN          255
Alexandre Julliard's avatar
Alexandre Julliard committed
25

26 27 28 29 30 31
#define INTERNAL_BORDER_WIDTH   5
#define POPUP_YDISTANCE         20
#define SHADOW_DX               10
#define SHADOW_DY               10
#define BUTTON_CX               6
#define BUTTON_CY               6
Alexandre Julliard's avatar
Alexandre Julliard committed
32 33 34

#ifndef RC_INVOKED

35 36
#include <stdarg.h>

Alexandre Julliard's avatar
Alexandre Julliard committed
37
#include "hlpfile.h"
38 39
#include "windef.h"
#include "winbase.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
40
#include "macro.h"
41
#include "winhelp_res.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
42 43 44

typedef struct tagHelpButton
{
45
    HWND                hWnd;
Alexandre Julliard's avatar
Alexandre Julliard committed
46

47 48 49
    LPCSTR              lpszID;
    LPCSTR              lpszName;
    LPCSTR              lpszMacro;
Alexandre Julliard's avatar
Alexandre Julliard committed
50

51
    WPARAM              wParam;
Alexandre Julliard's avatar
Alexandre Julliard committed
52

53
    RECT                rect;
Alexandre Julliard's avatar
Alexandre Julliard committed
54

55
    struct tagHelpButton*next;
Alexandre Julliard's avatar
Alexandre Julliard committed
56 57
} WINHELP_BUTTON;

58 59 60 61
typedef struct
{
    HLPFILE_PAGE*       page;
    HLPFILE_WINDOWINFO* wininfo;
62
    ULONG               relative;
63 64 65 66 67 68 69 70 71
} WINHELP_WNDPAGE;

typedef struct tagPageSet
{
    /* FIXME: for now it's a fixed size */
    WINHELP_WNDPAGE     set[40];
    unsigned            index;
} WINHELP_PAGESET;

Alexandre Julliard's avatar
Alexandre Julliard committed
72 73
typedef struct tagWinHelp
{
74
    unsigned            ref_count;
75 76
    WINHELP_BUTTON*     first_button;
    HLPFILE_PAGE*       page;
Alexandre Julliard's avatar
Alexandre Julliard committed
77

78 79
    HWND                hMainWnd;
    HWND                hShadowWnd;
80
    HWND                hHistoryWnd;
Alexandre Julliard's avatar
Alexandre Julliard committed
81

82 83
    WNDPROC             origRicheditWndProc;

84 85
    HFONT*              fonts;
    UINT                fonts_len;
Alexandre Julliard's avatar
Alexandre Julliard committed
86

87
    HCURSOR             hHandCur;
88

89 90
    HBRUSH              hBrush;

91 92
    HLPFILE_WINDOWINFO* info;

93
    WINHELP_PAGESET     back;
94
    unsigned            font_scale; /* 0 = small, 1 = normal, 2 = large */
95

96
    struct tagWinHelp*  next;
Alexandre Julliard's avatar
Alexandre Julliard committed
97 98
} WINHELP_WINDOW;

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
#define DC_NOMSG     0x00000000
#define DC_MINMAX    0x00000001
#define DC_INITTERM  0x00000002
#define DC_JUMP      0x00000004
#define DC_ACTIVATE  0x00000008
#define DC_CALLBACKS 0x00000010

#define DW_NOTUSED    0
#define DW_WHATMSG    1
#define DW_MINMAX     2
#define DW_SIZE       3
#define DW_INIT       4
#define DW_TERM       5
#define DW_STARTJUMP  6
#define DW_ENDJUMP    7
#define DW_CHGFILE    8
#define DW_ACTIVATE   9
#define	DW_CALLBACKS 10

typedef long (CALLBACK *WINHELP_LDLLHandler)(WORD, LONG, LONG);

typedef struct tagDll
{
    HANDLE              hLib;
    const char*         name;
    WINHELP_LDLLHandler handler;
    DWORD               class;
    struct tagDll*      next;
} WINHELP_DLL;

Alexandre Julliard's avatar
Alexandre Julliard committed
129 130
typedef struct
{
131 132
    UINT                wVersion;
    HANDLE              hInstance;
133
    BOOL                isBook;
134
    WINHELP_WINDOW*     active_win;
135
    WINHELP_WINDOW*     active_popup;
136
    WINHELP_WINDOW*     win_list;
137
    WNDPROC             button_proc;
138
    WINHELP_DLL*        dlls;
139
    WINHELP_PAGESET     history;
140
    HFONT               hButtonFont;
Alexandre Julliard's avatar
Alexandre Julliard committed
141 142 143
} WINHELP_GLOBALS;

extern WINHELP_GLOBALS Globals;
144
extern FARPROC         Callbacks[];
Alexandre Julliard's avatar
Alexandre Julliard committed
145

146
BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE*, int, BOOL);
147 148
BOOL WINHELP_OpenHelpWindow(HLPFILE_PAGE* (*)(HLPFILE*, LONG, ULONG*),
                            HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int);
149
BOOL WINHELP_GetOpenFileName(LPSTR, int);
150
BOOL WINHELP_CreateIndexWindow(BOOL);
151
void WINHELP_DeleteBackSet(WINHELP_WINDOW*);
152 153
HLPFILE* WINHELP_LookupHelpFile(LPCSTR lpszFile);
HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name);
154
void WINHELP_LayoutMainWindow(WINHELP_WINDOW* win);
155 156
WINHELP_WINDOW* WINHELP_GrabWindow(WINHELP_WINDOW*);
BOOL WINHELP_ReleaseWindow(WINHELP_WINDOW*);
Alexandre Julliard's avatar
Alexandre Julliard committed
157

158 159 160 161 162 163 164 165
extern const char MAIN_WIN_CLASS_NAME[];
extern const char BUTTON_BOX_WIN_CLASS_NAME[];
extern const char TEXT_WIN_CLASS_NAME[];
extern const char SHADOW_WIN_CLASS_NAME[];
extern const char HISTORY_WIN_CLASS_NAME[];
extern const char STRING_BUTTON[];
extern const char STRING_MENU_Xx[];
extern const char STRING_DIALOG_TEST[];
Alexandre Julliard's avatar
Alexandre Julliard committed
166 167 168 169
#endif

/* Buttons */
#define WH_FIRST_BUTTON     500