ieframe: Store toolbar handle in InternetEplorer.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2015-11-09 17:52:46 +01:00 committed by Alexandre Julliard
parent b241276f50
commit 10b6d06f15
2 changed files with 25 additions and 26 deletions

View File

@ -230,6 +230,7 @@ struct InternetExplorer {
HWND frame_hwnd;
HWND status_hwnd;
HWND toolbar_hwnd;
HMENU menu;
BOOL nohome;

View File

@ -402,7 +402,7 @@ static void ie_dialog_about(HWND hwnd)
DestroyIcon(icon);
}
static void add_tb_separator(HWND hwnd)
static void add_tb_separator(InternetExplorer *ie)
{
TBBUTTON btn;
@ -410,10 +410,10 @@ static void add_tb_separator(HWND hwnd)
btn.iBitmap = 3;
btn.fsStyle = BTNS_SEP;
SendMessageW(hwnd, TB_ADDBUTTONSW, 1, (LPARAM)&btn);
SendMessageW(ie->toolbar_hwnd, TB_ADDBUTTONSW, 1, (LPARAM)&btn);
}
static void add_tb_button(HWND hwnd, int bmp, int cmd, int strId)
static void add_tb_button(InternetExplorer *ie, int bmp, int cmd, int strId)
{
TBBUTTON btn;
WCHAR buf[30];
@ -427,14 +427,13 @@ static void add_tb_button(HWND hwnd, int bmp, int cmd, int strId)
btn.dwData = 0;
btn.iString = (INT_PTR)buf;
SendMessageW(hwnd, TB_ADDBUTTONSW, 1, (LPARAM)&btn);
SendMessageW(ie->toolbar_hwnd, TB_ADDBUTTONSW, 1, (LPARAM)&btn);
}
static void create_rebar(HWND hwnd)
static void create_rebar(InternetExplorer *ie)
{
HWND hwndRebar;
HWND hwndAddress;
HWND hwndToolbar;
REBARINFO rebarinf;
REBARBANDINFOW bandinf;
WCHAR addr[40];
@ -445,7 +444,7 @@ static void create_rebar(HWND hwnd)
hwndRebar = CreateWindowExW(WS_EX_TOOLWINDOW, REBARCLASSNAMEW, NULL,
WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|RBS_VARHEIGHT|CCS_TOP|CCS_NODIVIDER, 0, 0, 0, 0,
hwnd, (HMENU)IDC_BROWSE_REBAR, ieframe_instance, NULL);
ie->frame_hwnd, (HMENU)IDC_BROWSE_REBAR, ieframe_instance, NULL);
rebarinf.cbSize = sizeof(rebarinf);
rebarinf.fMask = 0;
@ -453,29 +452,29 @@ static void create_rebar(HWND hwnd)
SendMessageW(hwndRebar, RB_SETBARINFO, 0, (LPARAM)&rebarinf);
hwndToolbar = CreateWindowExW(TBSTYLE_EX_MIXEDBUTTONS, TOOLBARCLASSNAMEW, NULL, TBSTYLE_FLAT | WS_CHILD | WS_VISIBLE | CCS_NORESIZE,
ie->toolbar_hwnd = CreateWindowExW(TBSTYLE_EX_MIXEDBUTTONS, TOOLBARCLASSNAMEW, NULL, TBSTYLE_FLAT | WS_CHILD | WS_VISIBLE | CCS_NORESIZE,
0, 0, 0, 0, hwndRebar, (HMENU)IDC_BROWSE_TOOLBAR, ieframe_instance, NULL);
imagelist = ImageList_LoadImageW(ieframe_instance, MAKEINTRESOURCEW(IDB_IETOOLBAR), 32, 0, CLR_NONE, IMAGE_BITMAP, LR_CREATEDIBSECTION);
SendMessageW(hwndToolbar, TB_SETIMAGELIST, 0, (LPARAM)imagelist);
SendMessageW(hwndToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
add_tb_button(hwndToolbar, 0, ID_BROWSE_BACK, IDS_TB_BACK);
add_tb_button(hwndToolbar, 1, ID_BROWSE_FORWARD, IDS_TB_FORWARD);
add_tb_button(hwndToolbar, 2, ID_BROWSE_STOP, IDS_TB_STOP);
add_tb_button(hwndToolbar, 3, ID_BROWSE_REFRESH, IDS_TB_REFRESH);
add_tb_button(hwndToolbar, 4, ID_BROWSE_HOME, IDS_TB_HOME);
add_tb_separator(hwndToolbar);
add_tb_button(hwndToolbar, 5, ID_BROWSE_PRINT, IDS_TB_PRINT);
SendMessageW(hwndToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(55,50));
SendMessageW(hwndToolbar, TB_GETMAXSIZE, 0, (LPARAM)&toolbar_size);
SendMessageW(ie->toolbar_hwnd, TB_SETIMAGELIST, 0, (LPARAM)imagelist);
SendMessageW(ie->toolbar_hwnd, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
add_tb_button(ie, 0, ID_BROWSE_BACK, IDS_TB_BACK);
add_tb_button(ie, 1, ID_BROWSE_FORWARD, IDS_TB_FORWARD);
add_tb_button(ie, 2, ID_BROWSE_STOP, IDS_TB_STOP);
add_tb_button(ie, 3, ID_BROWSE_REFRESH, IDS_TB_REFRESH);
add_tb_button(ie, 4, ID_BROWSE_HOME, IDS_TB_HOME);
add_tb_separator(ie);
add_tb_button(ie, 5, ID_BROWSE_PRINT, IDS_TB_PRINT);
SendMessageW(ie->toolbar_hwnd, TB_SETBUTTONSIZE, 0, MAKELPARAM(55,50));
SendMessageW(ie->toolbar_hwnd, TB_GETMAXSIZE, 0, (LPARAM)&toolbar_size);
bandinf.cbSize = sizeof(bandinf);
bandinf.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE;
bandinf.fStyle = RBBS_CHILDEDGE;
bandinf.cxMinChild = toolbar_size.cx;
bandinf.cyMinChild = toolbar_size.cy+2;
bandinf.hwndChild = hwndToolbar;
bandinf.hwndChild = ie->toolbar_hwnd;
SendMessageW(hwndRebar, RB_INSERTBANDW, -1, (LPARAM)&bandinf);
@ -497,13 +496,15 @@ static LRESULT iewnd_OnCreate(HWND hwnd, LPCREATESTRUCTW lpcs)
InternetExplorer* This = (InternetExplorer*)lpcs->lpCreateParams;
SetWindowLongPtrW(hwnd, 0, (LONG_PTR) lpcs->lpCreateParams);
This->doc_host.frame_hwnd = This->frame_hwnd = hwnd;
This->menu = create_ie_menu();
This->status_hwnd = CreateStatusWindowW(WS_VISIBLE|WS_CHILD|SBT_NOBORDERS|CCS_NODIVIDER,
NULL, hwnd, IDC_BROWSE_STATUSBAR);
SendMessageW(This->status_hwnd, SB_SIMPLE, TRUE, 0);
create_rebar(hwnd);
create_rebar(This);
return 0;
}
@ -567,9 +568,7 @@ static LRESULT iewnd_OnNotify(InternetExplorer *This, WPARAM wparam, LPARAM lpar
static LRESULT iewnd_OnDestroy(InternetExplorer *This)
{
HWND hwndRebar = GetDlgItem(This->frame_hwnd, IDC_BROWSE_REBAR);
HWND hwndToolbar = GetDlgItem(hwndRebar, IDC_BROWSE_TOOLBAR);
HIMAGELIST list = (HIMAGELIST)SendMessageW(hwndToolbar, TB_GETIMAGELIST, 0, 0);
HIMAGELIST list = (HIMAGELIST)SendMessageW(This->toolbar_hwnd, TB_GETIMAGELIST, 0, 0);
TRACE("%p\n", This);
@ -722,7 +721,7 @@ void unregister_iewindow_class(void)
static void create_frame_hwnd(InternetExplorer *This)
{
This->frame_hwnd = CreateWindowExW(
CreateWindowExW(
WS_EX_WINDOWEDGE,
szIEWinFrame, wszWineInternetExplorer,
WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
@ -730,7 +729,6 @@ static void create_frame_hwnd(InternetExplorer *This)
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL /* FIXME */, ieframe_instance, This);
This->doc_host.frame_hwnd = This->frame_hwnd;
create_doc_view_hwnd(&This->doc_host);
}