/****************************************************************************************

		IMFWindow.h

		Copyright: (c) 2001 Eovia Corp. All rights reserved.

		Author:	Greg
		Date:	9/18/98

		Revision History

		when		who			what & why
		==========	==========	======================================================
		12/8/99		Greg		SetResizeLimits in API
		12/7/99		Ian			Get & SetContentBounds(): Added them to the external API.
		11/28/99	Pierre		added SetIsDocumentCloser
		10/27/99	Pierre		Added SetWantsToBeInWindowsMenu
		6/8/99		Yann		Added GetTitle/SetTile of IMFWindow
		6/6/99      Benjamin	Added IMFTitleBarIconAdornment
		4/5/99		Greg		Added TryToClose
		3/18/99		Joshua		Added GetSideBarAdornment()
		11/24/98	Greg		Added SelectWindow()
		
*****************************************************************************************/

#ifndef __IMFWINDOW__
#define __IMFWINDOW__

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "MCCompObj.h"

struct IMFPart;
struct IMFResponder;
class  TMCString;
class  TMCRect;
class  TMCPixelBucket;

//*********************** Globally Unique Ids ********************************


MCDEFINE_GUID_H(IID_IMFWindow);
MCDEFINE_GUID_H(IID_IMFTitleBarIconAdornment);
MCDEFINE_GUID_H(IID_IMFTitleBarAdornment);


//****************************************************************************



/******************************************************************************\
*                                                                              *
*           IMFWindow                                                          *
*                                                                              *
\******************************************************************************/


/// \addtogroup MCF
/// \{
#ifndef qDemoVersion //regular interface

/// <P>IMFWindow is the interface for Window objects.  Window objects are those UI elements that 
/// act as windows, including system windows, dialog boxes and application Windoid Parts</P>
struct IMFWindow : public IMCUnknown
{
	// ****************************************************************************
	//								Show
	// 
	/// Toggles whether or not a window is shown and/or active.  The definition of active may vary depending on
	/// what type of window we're talking to.
	/// 
	/// \param beVisible   If true, set the window to visible
	/// \param doActivate  If true, set the window to active
	/// 
	virtual void	 MCCOMAPI	Show					(boolean beVisible, boolean doActivate) = 0;
	
	// ****************************************************************************
	//								SelectWindow
	// 
	/// Selects this Window.  In the case of Windoid parts, brings the Part to the front.  
	/// 
	virtual void	 MCCOMAPI	SelectWindow			() = 0;
	
	// ****************************************************************************
	//								Center
	// 
	/// Centers a window on the screen either horizontally, vertically, or both.
	/// 
	/// \param horizontally  If true, centers the window horizontally
	/// \param vertically    If true, centers the window vertically
	/// 
	virtual void	 MCCOMAPI	Center					(boolean horizontally, boolean vertically) = 0;
	
	// ****************************************************************************
	//								GetSideBarAdornment
	// 
	/// Gets the sidebar adornment for this Window.  Unlikely to be used.
	/// 
	/// \param outSideBarAdornment  Returns the SideBarAdornment Part
	/// 
	virtual MCCOMErr MCCOMAPI	GetSideBarAdornment		(IMFPart** outSideBarAdornment ) = 0;	
	
	// ****************************************************************************
	//								GetTitleBarAdornment
	// 
	/// Gets the title bar adornment for the window.  For Windoid Parts, this is the area above the 
	/// window contents, containing the icons and title.
	/// 
	/// \param outTitleBarAdornment  Returns the title bar adornment part
	/// 
	virtual MCCOMErr MCCOMAPI	GetTitleBarAdornment	(IMFPart** outTitleBarAdornment) = 0;
	
	// ****************************************************************************
	//								AddAdornmentPart
	// 
	/// Adds an adornment part to this Window.  Adjusts bounds to accommodate the adornment.
	/// 
	/// \param inNewPart  Part to be added to the Window
	/// 
	virtual MCCOMErr MCCOMAPI	AddAdornmentPart		(IMFPart& inNewPart			   ) = 0;

	// ****************************************************************************
	//								TryToClose
	// 
	/// Attempts to close the Window.  Some windows may decide not to close.  For example,
	/// closing a document window prompts the user to save their changes, and presents the 
	/// opportunity to cancel the close.  
	/// 
	virtual void	 MCCOMAPI	TryToClose				() = 0;

	// ****************************************************************************
	//								GetConstTitle
	// 
	/// The Constant Title is the original title of the Window as set in the 'Wind' resource.
	/// This is useful when you are doing string substitution (using ^0 like keywords), and
	/// need to revert to the original title to perform another substitution.
	/// 
	/// \param outTitle  Returns the Constant Title
	/// 
	virtual void	 MCCOMAPI	GetConstTitle			(TMCString& outTitle) const = 0;

	// ****************************************************************************
	//								GetTitle
	// 
	/// Returns the current title of the Window
	/// 
	/// \param outTitle  Returns the title
	/// 
	virtual void	 MCCOMAPI	GetTitle				(TMCString& outTitle) const = 0;

	// ****************************************************************************
	//								SetTitle
	// 
	/// Sets the current title of the Window.  <B>Note: Title must be fewer than 255 characters long</B>
	/// 
	/// \param inNewTitle  The title to set
	/// 
	virtual void	 MCCOMAPI	SetTitle				(const TMCString& inNewTitle) = 0;

	// 
	// ****************************************************************************
	//								SetWindowFirstResponder
	// 
	/// Set inResponder as the first Responder of this Window.
	/// \see IMFResponder
	/// 
	/// \param inResponder The Responder to make first Responder 
	/// 
	virtual void	 MCCOMAPI	SetWindowFirstResponder	(IMFResponder* inResponder) = 0;

	// ****************************************************************************
	//								WantsToBeInWindowsMenu
	// 
	/// \return True if this Window wants to be listed automatically in the Windows menu of the application.
	/// 
	virtual boolean MCCOMAPI		WantsToBeInWindowsMenu() const	= 0;
	
	// ****************************************************************************
	//								SetWantsToBeInWindowsMenu
	// 
	/// Sets whether or not this Window wants to be listed automatically in the Windows menu of the application.
	/// 
	/// \param beIn  If true, this Window should be automatically added to the Windows menu
	/// 
	virtual void	MCCOMAPI		SetWantsToBeInWindowsMenu(boolean beIn) = 0;

	// ****************************************************************************
	//								SetIsDocumentCloser
	// 
	/// Sets whether or not closing this Window should also close the associated document.
	/// 
	/// \param inIsCloser  If True, closing this Window closes the associated document
	/// 
	virtual void		MCCOMAPI	SetIsDocumentCloser 	(boolean inIsCloser) = 0;

	// ****************************************************************************
	//								GetContentBounds
	// 
	/// Gets the bounds of the contents of this Window, in screen coordinates.
	/// 
	/// \param outBounds  Returns the bounds as a TMCRect
	/// 
	virtual void		MCCOMAPI	GetContentBounds	(TMCRect& outBounds) const = 0;
	
	// ****************************************************************************
	//								SetContentBounds
	// 
	/// Sets the content bounds of the Window, resizing it.  These bounds may be limited
	/// by the resize limits specified by a call to SetResizeLimits()
	/// 
	/// \param inBounds      The new bounds for the contents
	/// \param inInvalidate  If true, invalidates the Window
	/// \param inNotify      If true, notifies the Window's parent that the bounds have changed
	/// 
	virtual void		MCCOMAPI	SetContentBounds	(const TMCRect& inBounds, boolean inInvalidate, boolean inNotify) = 0;
	
	// ****************************************************************************
	//								SetResizeLimits
	// 
	/// Sets the upper and lower limits on the size of the Window contents.  resizeLimits.left specifies minimum width,
	/// resizeLimits.right specifies maximum width, resizeLimits.top specifies the minimum height, and resizeLimits.bottom specifies maximum height.
	/// 
	/// \param resizeLimits  A rectangle specifying the size limits.
	/// 
	virtual void		MCCOMAPI	SetResizeLimits(const TMCRect& resizeLimits) = 0;

	// ****************************************************************************
	//								GetThisPart
	// 
	/// Windows are Parts, so this function gets the IMFPart interface to the object.
	/// 
	/// \return A pointer to the IMFPart interface
	virtual IMFPart*	MCCOMAPI	GetThisPart() = 0;

	// ****************************************************************************
	//								PrepareWindowForFirstShow
	// 
	/// This is called once, before the first time a Window is shown.  Generally should not be called manually, it is 
	/// called by Show().
	/// 
	virtual void		MCCOMAPI	PrepareWindowForFirstShow(void) = 0;

	// ****************************************************************************
	//								GetContentPart
	// 
	///	\return Tis Window's content part.
	/// 
	/// 
	virtual IMFPart*	MCCOMAPI	GetContentPart() = 0;

	// ****************************************************************************
	//								InvalidateShadowAdornment
	// 
	/// Invalidates this Window's shadow adornment, if any. 
	/// 
	virtual void		MCCOMAPI	InvalidateShadowAdornment() = 0;
};
/// \}
#else 	//(qDemoVersion) begin scrambled interface

struct IMFWindow : public IMCUnknown
{
	virtual void	 MCCOMAPI	InvalidateShadowAdornment() = 0;
	virtual IMFPart* MCCOMAPI	GetThisPart() = 0;
	virtual void	 MCCOMAPI	Show					(boolean beVisible, boolean doActivate) = 0;
	virtual void	 MCCOMAPI	SelectWindow			() = 0;
	virtual void	 MCCOMAPI	Center					(boolean horizontally, boolean vertically) = 0;	
	virtual void	 MCCOMAPI	SetWindowFirstResponder	(IMFResponder* inResponder) = 0;
	virtual MCCOMErr MCCOMAPI	GetTitleBarAdornment	(IMFPart** outTitleBarAdornment) = 0;
	virtual MCCOMErr MCCOMAPI	AddAdornmentPart		(IMFPart& inNewPart			   ) = 0;
	virtual void	 MCCOMAPI	TryToClose				() = 0;
	virtual void	 MCCOMAPI	GetConstTitle			(TMCString& outTitle) const = 0;
	virtual void	 MCCOMAPI	SetTitle				(const TMCString& inNewTitle) = 0;	
	virtual IMFPart* MCCOMAPI	GetContentPart			() = 0;
	virtual void	 MCCOMAPI	GetTitle				(TMCString& outTitle) const = 0;	
	virtual MCCOMErr MCCOMAPI	GetSideBarAdornment		(IMFPart** outSideBarAdornment ) = 0;	
	virtual boolean MCCOMAPI		WantsToBeInWindowsMenu() const	= 0;
	virtual void	MCCOMAPI		SetWantsToBeInWindowsMenu(boolean beIn) = 0;
	virtual void		MCCOMAPI	PrepareWindowForFirstShow(void) = 0;
	virtual void		MCCOMAPI	SetIsDocumentCloser 	(boolean inIsCloser) = 0;	
	virtual void		MCCOMAPI	SetContentBounds	(const TMCRect& inBounds, boolean inInvalidate, boolean inNotify) = 0;
	virtual void		MCCOMAPI	GetContentBounds	(TMCRect& outBounds) const = 0;
	virtual void		MCCOMAPI	SetResizeLimits(const TMCRect& resizeLimits) = 0;
};

#endif	//(qDemoVersion) end scrambled

/******************************************************************************\
*                                                                              *
*           IMFTitleBarIconAdornment                                           *
*                                                                              *
\******************************************************************************/
/// \addtogroup MCF
/// \{
/// The interface for the Title Bar Icon Adornment.  Used only to set the icon of the title bar adornment.
struct IMFTitleBarIconAdornment : public IMCUnknown
{

	// ****************************************************************************
	//								SetIcon
	// 
	/// Sets the title bar icon adornment.
	/// 
	/// \param icon  Pointer to a pixel bucket containing the icon to use.
	/// 
	virtual void	 MCCOMAPI	SetIcon					(TMCPixelBucket* icon) = 0;
};
/// \}


/******************************************************************************\
*                                                                              *
*           IMFTitleBarAdornment                                               *
*                                                                              *
\******************************************************************************/
/// \addtogroup MCF
/// \{
/// The interface for the Title Bar Adornment. 
struct IMFTitleBarAdornment : public IMCUnknown
{
	/// Sets the extra part that sits next to the title inside the adornment.
	/// generally a toolbar, but it could be anything else.
	/// The bounds will be dynamically maximized.
	virtual void	 MCCOMAPI	SetToolbarHolder			(IMFPart* inPart) = 0;
};
/// \}


#endif

