Add a tab control to the navigation pane.

This commit is contained in:
James Hawkins 2005-08-03 11:46:52 +00:00 committed by Alexandre Julliard
parent 07f8690718
commit 90bb481c0c
4 changed files with 65 additions and 1 deletions

View File

@ -21,6 +21,14 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
STRINGTABLE
BEGIN
IDS_CONTENTS "&Contents"
IDS_INDEX "I&ndex"
IDS_SEARCH "&Search"
IDS_FAVORITES "Favor&ites"
END
STRINGTABLE
BEGIN
IDTB_EXPAND "Show"

View File

@ -30,6 +30,8 @@
#include "ole2.h"
#include "wine/unicode.h"
#include "resource.h"
/* Window type defaults */
#define WINTYPE_DEFAULT_X 280
@ -44,6 +46,7 @@ typedef struct tagHHInfo
HINSTANCE hInstance;
LPCWSTR szCmdLine;
DWORD dwNumTBButtons;
HWND hwndTabCtrl;
HFONT hFont;
} HHInfo;
@ -251,12 +254,25 @@ static void NP_GetNavigationRect(HHInfo *pHHInfo, RECT *rc)
rc->right = WINTYPE_DEFAULT_NAVWIDTH;
}
static void NP_CreateTab(HINSTANCE hInstance, HWND hwndTabCtrl, DWORD dwStrID, DWORD dwIndex)
{
TCITEMW tie;
LPWSTR tabText = HH_LoadString(dwStrID);
tie.mask = TCIF_TEXT;
tie.pszText = tabText;
TabCtrl_InsertItemW(hwndTabCtrl, dwIndex, &tie);
HeapFree(GetProcessHeap(), 0, tabText);
}
static BOOL HH_AddNavigationPane(HHInfo *pHHInfo)
{
HWND hWnd;
HWND hWnd, hwndTabCtrl;
HWND hwndParent = pHHInfo->pHHWinType->hwndHelp;
DWORD dwStyles = WS_CHILDWINDOW | WS_VISIBLE;
DWORD dwExStyles = WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR;
DWORD dwIndex = 0;
RECT rc;
NP_GetNavigationRect(pHHInfo, &rc);
@ -267,6 +283,21 @@ static BOOL HH_AddNavigationPane(HHInfo *pHHInfo)
if (!hWnd)
return FALSE;
hwndTabCtrl = CreateWindowExW(dwExStyles, WC_TABCONTROLW, szEmpty, dwStyles,
0, 0, rc.right, rc.bottom, hWnd,
NULL, pHHInfo->hInstance, NULL);
if (!hwndTabCtrl)
return FALSE;
/* FIXME: Check which tabs to include when we read the CHM file */
NP_CreateTab(pHHInfo->hInstance, hwndTabCtrl, IDS_CONTENTS, dwIndex++);
NP_CreateTab(pHHInfo->hInstance, hwndTabCtrl, IDS_INDEX, dwIndex++);
NP_CreateTab(pHHInfo->hInstance, hwndTabCtrl, IDS_SEARCH, dwIndex++);
NP_CreateTab(pHHInfo->hInstance, hwndTabCtrl, IDS_FAVORITES, dwIndex++);
SendMessageW(hwndTabCtrl, WM_SETFONT, (WPARAM)pHHInfo->hFont, TRUE);
pHHInfo->hwndTabCtrl = hwndTabCtrl;
pHHInfo->pHHWinType->hwndNavigation = hWnd;
return TRUE;
}

View File

@ -23,6 +23,7 @@
#include "wingdi.h"
#include "winnls.h"
#include "htmlhelp.h"
#include "resource.h"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL

View File

@ -0,0 +1,24 @@
/*
* HTML Help resource definitions
*
* Copyright 2005 James Hawkins
*
* 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define IDS_CONTENTS 1
#define IDS_INDEX 2
#define IDS_SEARCH 3
#define IDS_FAVORITES 4