using System;
using System.Runtime.InteropServices;
namespace Vanara.PInvoke
{
public static partial class Shell32
{
///
/// Exposes methods that notify the docking window object of changes, including showing, hiding, and impending removal. This
/// interface is implemented by window objects that can be docked within the border space of a Windows Explorer window.
///
///
///
/// IDockingWindow is derived from IOleWindow. See the following topics for details on these methods also available to
/// IDockingWindow through that inheritance.
///
///
///
/// Additional IDockingWindow Methods
///
/// -
/// IDockingWindow::GetWindow
///
/// -
/// IDockingWindow::ContextSensitiveHelp
///
///
/// When to Implement
///
/// Implement IDockingWindow when you want to display a window inside a browser frame. This is typically used for user
/// interface windows, such as toolbars.
///
/// When to Use
///
/// You do not usually use the IDockingWindow interface directly. The Shell browser uses this interface to support docked
/// windows inside the browser frame.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-idockingwindow
[ComImport, Guid("012dd920-7b26-11d0-8ca9-00a0c92dbfe8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IDockingWindow : Ole32.IOleWindow
{
///
/// Retrieves a handle to one of the windows participating in in-place activation (frame, document, parent, or in-place object window).
///
/// A pointer to a variable that receives the window handle.
///
/// This method returns S_OK on success. Other possible return values include the following.
///
///
/// Return code
/// Description
///
/// -
/// E_FAIL
/// The object is windowless.
///
/// -
/// E_OUTOFMEMORY
/// There is insufficient memory available for this operation.
///
/// -
/// E_UNEXPECTED
/// An unexpected error has occurred.
///
///
///
///
///
/// Five types of windows comprise the windows hierarchy. When a object is active in place, it has access to some or all of
/// these windows.
///
///
///
/// Window
/// Description
///
/// -
/// Frame
/// The outermost main window where the container application's main menu resides.
///
/// -
/// Document
/// The window that displays the compound document containing the embedded object to the user.
///
/// -
/// Pane
///
/// The subwindow of the document window that contains the object's view. Applicable only for applications with split-pane windows.
///
///
/// -
/// Parent
///
/// The container window that contains that object's view. The object application installs its window as a child of this window.
///
///
/// -
/// In-place
///
/// The window containing the active in-place object. The object application creates this window and installs it as a child of
/// its hatch window, which is a child of the container's parent window.
///
///
///
///
/// Each type of window has a different role in the in-place activation architecture. However, it is not necessary to employ a
/// separate physical window for each type. Many container applications use the same window for their frame, document, pane, and
/// parent windows.
///
///
[PreserveSig]
new HRESULT GetWindow(out HWND phwnd);
/// Determines whether context-sensitive help mode should be entered during an in-place activation session.
///
/// if help mode should be entered; if it should be exited.
///
///
///
/// This method returns S_OK if the help mode was entered or exited successfully, depending on the value passed in . Other possible return values include the following.
///
///
///
/// Return code
/// Description
///
/// -
/// E_INVALIDARG
/// The specified value is not valid.
///
/// -
/// E_OUTOFMEMORY
/// There is insufficient memory available for this operation.
///
/// -
/// E_UNEXPECTED
/// An unexpected error has occurred.
///
///
///
///
/// Applications can invoke context-sensitive help when the user:
///
/// - presses SHIFT+F1, then clicks a topic
/// - presses F1 when a menu item is selected
///
///
/// When SHIFT+F1 is pressed, either the frame or active object can receive the keystrokes. If the container's frame receives
/// the keystrokes, it calls its containing document's IOleWindow::ContextSensitiveHelp method with set to . This propagates the help state to all of its in-place objects so they can
/// correctly handle the mouse click or WM_COMMAND.
///
///
/// If an active object receives the SHIFT+F1 keystrokes, it calls the container's IOleWindow::ContextSensitiveHelp method with
/// set to , which then recursively calls each of its in-place sites until
/// there are no more to be notified. The container then calls its document's or frame's IOleWindow::ContextSensitiveHelp method
/// with set to .
///
/// When in context-sensitive help mode, an object that receives the mouse click can either:
///
/// - Ignore the click if it does not support context-sensitive help.
/// -
/// Tell all the other objects to exit context-sensitive help mode with ContextSensitiveHelp set to FALSE and then provide help
/// for that context.
///
///
///
/// An object in context-sensitive help mode that receives a WM_COMMAND should tell all the other in-place objects to exit
/// context-sensitive help mode and then provide help for the command.
///
///
/// If a container application is to support context-sensitive help on menu items, it must either provide its own message filter
/// so that it can intercept the F1 key or ask the OLE library to add a message filter by calling OleSetMenuDescriptor, passing
/// valid, non-NULL values for the lpFrame and lpActiveObj parameters.
///
///
[PreserveSig]
new HRESULT ContextSensitiveHelp([MarshalAs(UnmanagedType.Bool)] bool fEnterMode);
/// Instructs the docking window object to show or hide itself.
///
/// Type: BOOL
///
/// TRUE if the docking window object should show its window. FALSE if the docking window object should hide its
/// window and return its border space by calling SetBorderSpaceDW with zero values.
///
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-idockingwindow-showdw HRESULT ShowDW( BOOL
// fShow );
[PreserveSig]
HRESULT ShowDW([MarshalAs(UnmanagedType.Bool)] bool fShow);
///
/// Notifies the docking window object that it is about to be removed from the frame. The docking window object should save any
/// persistent information at this time.
///
///
/// Type: DWORD
/// Reserved. This parameter should always be zero.
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-idockingwindow-closedw HRESULT CloseDW(
// DWORD dwReserved );
[PreserveSig]
HRESULT CloseDW(uint dwReserved);
///
/// Notifies the docking window object that the frame's border space has changed. In response to this method, the IDockingWindow
/// implementation must call SetBorderSpaceDW, even if no border space is required or a change is not necessary.
///
///
/// Type: LPCRECT
/// Pointer to a RECT structure that contains the frame's available border space.
///
///
/// Type: IUnknown*
///
/// Pointer to the site's IUnknown interface. The docking window object should call the QueryInterface method for this
/// interface, requesting IID_IDockingWindowSite. The docking window object then uses that interface to negotiate its border
/// space. It is the docking window object's responsibility to release this interface when it is no longer needed.
///
///
///
/// Type: BOOL
/// Reserved. This parameter should always be zero.
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
///
///
/// The prcBorder parameter contains the frame's entire available border space. The docking window object should negotiate its
/// border space and then use this information to position itself.
///
///
/// For example, if the docking window object requires 25 pixels at the top of the border space, it should negotiate for this
/// through the following steps:
///
///
/// -
/// Allocate a BORDERWIDTHS structure and set its top member to 25.
///
/// -
/// Call RequestBorderSpaceDW to request the space.
///
/// -
/// If the request is approved by RequestBorderSpaceDW, call SetBorderSpaceDW to allocate the space.
///
///
///
/// The docking window object can then position its window at prcBorder->left and prcBorder->top. The width of the docking
/// window object's window is determined by subtracting prcBorder->left from prcBorder->right. Its height is contained in
/// the top member of the BORDERWIDTHS structure.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-idockingwindow-resizeborderdw HRESULT
// ResizeBorderDW( LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved );
[PreserveSig]
HRESULT ResizeBorderDW([In, Optional] PRECT prcBorder, [In, Optional, MarshalAs(UnmanagedType.IUnknown)] object punkToolbarSite, [MarshalAs(UnmanagedType.Bool)] bool fReserved);
}
}
}