ieframe: Disable forward and backward navigation toolbar buttons when they are not usable.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
10b6d06f15
commit
abe564ad3b
@ -93,20 +93,22 @@ void on_commandstate_change(DocHost *doc_host, LONG command, VARIANT_BOOL enable
|
|||||||
dispparams.rgvarg = params;
|
dispparams.rgvarg = params;
|
||||||
|
|
||||||
V_VT(params) = VT_BOOL;
|
V_VT(params) = VT_BOOL;
|
||||||
V_BOOL(params) = enable;
|
V_BOOL(params) = enable ? VARIANT_TRUE : VARIANT_FALSE;
|
||||||
|
|
||||||
V_VT(params+1) = VT_I4;
|
V_VT(params+1) = VT_I4;
|
||||||
V_I4(params+1) = command;
|
V_I4(params+1) = command;
|
||||||
|
|
||||||
call_sink(doc_host->cps.wbe2, DISPID_COMMANDSTATECHANGE, &dispparams);
|
call_sink(doc_host->cps.wbe2, DISPID_COMMANDSTATECHANGE, &dispparams);
|
||||||
|
|
||||||
|
doc_host->container_vtbl->on_command_state_change(doc_host, command, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_navigation_commands(DocHost *dochost)
|
void update_navigation_commands(DocHost *dochost)
|
||||||
{
|
{
|
||||||
unsigned pos = dochost->travellog.loading_pos == -1 ? dochost->travellog.position : dochost->travellog.loading_pos;
|
unsigned pos = dochost->travellog.loading_pos == -1 ? dochost->travellog.position : dochost->travellog.loading_pos;
|
||||||
|
|
||||||
on_commandstate_change(dochost, CSC_NAVIGATEBACK, pos > 0 ? VARIANT_TRUE : VARIANT_FALSE);
|
on_commandstate_change(dochost, CSC_NAVIGATEBACK, pos > 0);
|
||||||
on_commandstate_change(dochost, CSC_NAVIGATEFORWARD, pos < dochost->travellog.length ? VARIANT_TRUE : VARIANT_FALSE);
|
on_commandstate_change(dochost, CSC_NAVIGATEFORWARD, pos < dochost->travellog.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void notif_complete(DocHost *This, DISPID dispid)
|
static void notif_complete(DocHost *This, DISPID dispid)
|
||||||
|
@ -105,6 +105,7 @@ typedef struct _IDocHostContainerVtbl
|
|||||||
ULONG (*release)(DocHost*);
|
ULONG (*release)(DocHost*);
|
||||||
void (WINAPI* GetDocObjRect)(DocHost*,RECT*);
|
void (WINAPI* GetDocObjRect)(DocHost*,RECT*);
|
||||||
HRESULT (WINAPI* SetStatusText)(DocHost*,LPCWSTR);
|
HRESULT (WINAPI* SetStatusText)(DocHost*,LPCWSTR);
|
||||||
|
void (*on_command_state_change)(DocHost*,LONG,BOOL);
|
||||||
void (WINAPI* SetURL)(DocHost*,LPCWSTR);
|
void (WINAPI* SetURL)(DocHost*,LPCWSTR);
|
||||||
} IDocHostContainerVtbl;
|
} IDocHostContainerVtbl;
|
||||||
|
|
||||||
|
@ -430,6 +430,11 @@ static void add_tb_button(InternetExplorer *ie, int bmp, int cmd, int strId)
|
|||||||
SendMessageW(ie->toolbar_hwnd, TB_ADDBUTTONSW, 1, (LPARAM)&btn);
|
SendMessageW(ie->toolbar_hwnd, TB_ADDBUTTONSW, 1, (LPARAM)&btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void enable_toolbar_button(InternetExplorer *ie, int command, BOOL enable)
|
||||||
|
{
|
||||||
|
SendMessageW(ie->toolbar_hwnd, TB_ENABLEBUTTON, command, enable);
|
||||||
|
}
|
||||||
|
|
||||||
static void create_rebar(InternetExplorer *ie)
|
static void create_rebar(InternetExplorer *ie)
|
||||||
{
|
{
|
||||||
HWND hwndRebar;
|
HWND hwndRebar;
|
||||||
@ -761,6 +766,20 @@ static HRESULT WINAPI DocHostContainer_SetStatusText(DocHost *iface, LPCWSTR tex
|
|||||||
return update_ie_statustext(This, text);
|
return update_ie_statustext(This, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void DocHostContainer_on_command_state_change(DocHost *iface, LONG command, BOOL enable)
|
||||||
|
{
|
||||||
|
InternetExplorer *This = impl_from_DocHost(iface);
|
||||||
|
|
||||||
|
switch(command) {
|
||||||
|
case CSC_NAVIGATEBACK:
|
||||||
|
enable_toolbar_button(This, ID_BROWSE_BACK, enable);
|
||||||
|
break;
|
||||||
|
case CSC_NAVIGATEFORWARD:
|
||||||
|
enable_toolbar_button(This, ID_BROWSE_FORWARD, enable);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void WINAPI DocHostContainer_SetURL(DocHost* iface, LPCWSTR url)
|
static void WINAPI DocHostContainer_SetURL(DocHost* iface, LPCWSTR url)
|
||||||
{
|
{
|
||||||
InternetExplorer *This = impl_from_DocHost(iface);
|
InternetExplorer *This = impl_from_DocHost(iface);
|
||||||
@ -774,6 +793,7 @@ static const IDocHostContainerVtbl DocHostContainerVtbl = {
|
|||||||
IEDocHost_release,
|
IEDocHost_release,
|
||||||
DocHostContainer_GetDocObjRect,
|
DocHostContainer_GetDocObjRect,
|
||||||
DocHostContainer_SetStatusText,
|
DocHostContainer_SetStatusText,
|
||||||
|
DocHostContainer_on_command_state_change,
|
||||||
DocHostContainer_SetURL
|
DocHostContainer_SetURL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1204,6 +1204,10 @@ static HRESULT WINAPI DocHostContainer_SetStatusText(DocHost* This, LPCWSTR text
|
|||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void DocHostContainer_on_command_state_change(DocHost *This, LONG command, BOOL enable)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static void WINAPI DocHostContainer_SetURL(DocHost* This, LPCWSTR url)
|
static void WINAPI DocHostContainer_SetURL(DocHost* This, LPCWSTR url)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -1213,6 +1217,7 @@ static const IDocHostContainerVtbl DocHostContainerVtbl = {
|
|||||||
WebBrowser_release,
|
WebBrowser_release,
|
||||||
DocHostContainer_GetDocObjRect,
|
DocHostContainer_GetDocObjRect,
|
||||||
DocHostContainer_SetStatusText,
|
DocHostContainer_SetStatusText,
|
||||||
|
DocHostContainer_on_command_state_change,
|
||||||
DocHostContainer_SetURL
|
DocHostContainer_SetURL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user