InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IWindow Class Referenceabstract

#include <IWindow.h>

Inheritance diagram for IWindow:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_IWINDOW }
 
enum  VisibleState {
  kHide = SW_HIDE, kMaximize = SW_MAXIMIZE, kMinimize = SW_MINIMIZE, kRestore = SW_RESTORE,
  kShow = SW_SHOW, kShowNormal = SW_SHOWNORMAL, kShowNoActivate = SW_SHOWNA
}
 
enum  WindowSpec {
  kWindowLayerMask = (0x0000000FUL), kAppRootWindowLayer = 1, kDocumentWindowLayer = 2, kToolbarWindowLayer = 4,
  kPaletteWindowLayer = 5, kAppModalWindowLayer = 7, kUtilityWindowLayer = 11, kMenuWindowLayer = 13,
  kHelpWindowLayer = 14, kWindowFrameMask = (0x000000F0UL), kStandardWindowFrame = 0, kDocWindowFrame = (1UL << 4),
  kPaletteWindowFrame = (2UL << 4), kModelessDialogWindowFrame = (3UL << 4), kMovableModalDialogWindowFrame = (4UL << 4), kModalDialogWindowFrame = (5UL << 4),
  kMovableAlertWindowFrame = (6UL << 4), kAlertWindowFrame = (7UL << 4), kAppRootWindowFrame = (8UL << 4), kBorderOnlyWindowFrame = (9UL << 4),
  kCustomWindowFrame = (14UL << 4), kNoWindowFrame = (15UL << 4), kWindowControlsMask = (0x0000FF00), kStandardWindowControls = 0,
  kCloseWindowControl = (1UL << 8), kZoomWindowControl = (1UL << 9), kCollapseWindowControl = (1UL << 10), kResizeWindowControl = (1UL << 11),
  kToolbarWindowControl = (1UL << 12), kSideTitlebarControl = (1UL << 13), kRemoveTitlebarControl = (1UL << 14), kListAbsentWindowControls = (1UL << 15),
  kNoWindowControls = kWindowControlsMask, kAllWindowControls = kListAbsentWindowControls, kStandardDocWindowControls = (kCloseWindowControl | kZoomWindowControl | kCollapseWindowControl | kResizeWindowControl), kStandardPaletteWindowControls = (kCloseWindowControl | kZoomWindowControl),
  kWindowPolicyMask = (0xFFFF0000UL), kStandardWindowPolicy = 0, kHideInBackgroundWindowPolicy = (1UL << 16), kDontHideInBackgroundWindowPolicy = (1UL << 17),
  kTabCyclesKeyFocusWindowPolicy = (1UL << 18), kTabDoesntCycleKeyFocusWindowPolicy = (1UL << 19), kRememberLastEditboxKeyFocusWindowPolicy = (1UL << 20), kDontRememberLastEditboxKeyFocusWindowPolicy = (1UL << 21),
  kHasDefaultButtonWindowPolicy = (1UL << 22), kDoesntHaveDefaultButtonWindowPolicy = (1UL << 23), kMovableWindowPolicy = (1UL << 24), kNonMovableWindowPolicy = (1UL << 25),
  kListBoxGrabsKeyFocusWindowPolicy = (1UL << 26), kListBoxDoesntGrabsKeyFocusWindowPolicy = (1UL << 27), kDoUnused1WindowPolicy = (1UL << 28), kDontUnused1WindowPolicy = (1UL << 29),
  kDoUnused2WindowPolicy = (1UL << 30), kDontUnused2WindowPolicy = (1UL << 31)
}
 
enum  ZoomState { kZoomedOut, kZoomedIn, kResetZoomedOut }
 
enum  LimitType { kLimitMinimumWidth, kLimitMaximumWidth, kLimitMinimumHeight, kLimitMaximumHeight }
 

Public Member Functions

virtual void InitWindow (uint32 policyBits)=0
 
virtual void OpenWindow ()=0
 
virtual void CloseWindow ()=0
 
virtual void PlatformWindowClosed ()=0
 
virtual void SetTitle (const PMString &newtitle)=0
 
virtual const PMStringGetTitle () const =0
 
virtual const InterfaceFontInfoGetFont () const =0
 
virtual const InterfaceFontInfoGetHiliteFont () const =0
 
virtual void SetFrameBBox (const GSysRect &rt)=0
 
virtual GSysRect GetFrameBBox () const =0
 
virtual GSysRect GetContentBBox () const =0
 
virtual void SetContentBBox (const GSysRect &bbox)=0
 
virtual int32 GetTitlebarHeight () const =0
 
virtual int32 GetBorderWidth () const =0
 
virtual SysRect GetVisRgnBBox () const =0
 
virtual void Resize (SysCoord newWidth, SysCoord newHeight)=0
 
virtual void SetPosition (GSysCoord xPos, GSysCoord yPos, bool16 inFront)=0
 
virtual void CenterOnScreen ()=0
 
virtual SysWindow GetSysWindow () const =0
 
virtual void Zoom (ZoomState zoomState, GSysRect *zoomRect)=0
 
virtual ZoomState GetZoomState () const =0
 
virtual void SetZoomState (ZoomState zoomState)=0
 
virtual void SetVisible (VisibleState state, bool16 apply=kTrue)=0
 
virtual VisibleState GetVisible () const =0
 
virtual bool16 IsVisible () const =0
 
virtual void VisibleStateChanged (VisibleState state)=0
 
virtual void BringToFront ()=0
 
virtual void Activate ()=0
 
virtual void Deactivate ()=0
 
virtual bool16 IsActive () const =0
 
virtual SysCoord GetLimits (const LimitType type) const =0
 
virtual void SetLimits (const LimitType type, const SysCoord newLimit)=0
 
virtual void Paint (IViewPort *viewPort, SysRgn updateRgn)=0
 
virtual void SystemPaint ()=0
 
virtual bool16 IsRolledUp (bool16 &changed) const =0
 
virtual bool16 DoesFloat () const =0
 
virtual SysRgn SystemScroll (const SysPoint &delta, bool16 bDoInval=kTrue, SysRect *bbox=nil)=0
 
virtual void ForceRedraw (SysRgn invalidRgnToAdopt, bool16 forceRedraw)=0
 
virtual bool16 IsOnScreen () const =0
 
virtual void EnsureOnScreen ()=0
 
virtual uint32 GetWindowPolicy () const =0
 
virtual void SetWindowPolicy (uint32 policy)=0
 
virtual void InitThemeForWindow ()=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

InDesign wrapper interface for platform windows.

Member Enumeration Documentation

possible window visibilities

WindowSpec encapsulates 4 sets of window properties into one int32. Someday this combined bitfield will probably be replaced with several different enums or bitfields. The 4 things defined within this WindowSpec are:

  1. Window layer
  2. Window frame
  3. Window controls
  4. Window policies
Enumerator
kAppRootWindowLayer 

kAppRootWindowLayer MDI parent window - Windows only

kDocumentWindowLayer 

kDocumentWindowLayer - documents(and sheets), modeless dialogs

kToolbarWindowLayer 

kToolbarWindowLayer - above documents, below palettes

kPaletteWindowLayer 

kPaletteWindowLayer - palettes, floating modeless dialogs, perhaps popout subtools

kAppModalWindowLayer 

alerts, modal dialogs

kUtilityWindowLayer 

In the future, additional layers could be added here... kUtilityWindowLayer - system-wide floating TSM, AppleGuide

kMenuWindowLayer 

kMenuWindowLayer

kHelpWindowLayer 

kHelpWindowLayer - tips, coachmarks, perhaps popup sliders and popout subtools

kWindowFrameMask 

4 bits for window frame. Defines the window border/titlebar. You can choose 0 or 1 of these. If you do not specify a window frame constant, you'll get the default one for your window layer. kWindowFrameMask is the mask to get the frame bits out of the whole bitfield.

kStandardWindowFrame 

Standard frame based on specified window layer. Internally mapped to one of the other window frame types, based on window layer.

kDocWindowFrame 

Window frame appropriate for a document window. Standard for kDocumentWindowLayer

kPaletteWindowFrame 

Window frame appropriate for a palette window. Standard for kPaletteWindowLayer

kModelessDialogWindowFrame 

Window frame appropriate for a modeless dialog window(like find/change dialog)

kMovableModalDialogWindowFrame 

Window frame appropriate for a movable modal dialog window. Standard for kAppModalWindowLayer

kModalDialogWindowFrame 

Window frame appropriate for a modal dialog window.

kMovableAlertWindowFrame 

Window frame appropriate for a movable alert window.

kAlertWindowFrame 

Window frame appropriate for an alert window.

kAppRootWindowFrame 

Window frame appropriate for an app frame window.

kBorderOnlyWindowFrame 

Window frame which is just a border. Win Only - specifies WS_BORDER and WS_EX_TOOLWINDOW

kCustomWindowFrame 

Custom Window frame. Mac Only - window proc is specified by client code, rather than platform window

kNoWindowFrame 

No Window frame. Standard for kHelpWindowLayer and kUtilityWindowLayer

kWindowControlsMask 

Window Controls. Most callers specify kStandardWindowControls. If you do not specify kStandardWindowControls, you must specify all controls that you want. 8 bits for Type of window controls, such as titlebar, resize controls, zoom controls. Multiple values can be or'd together. kWindowControlsMask is the mask to get at just the window control bits

kStandardWindowControls 

Standard controls based on specified frame and layer. Here's a list of what the standard controls are for various window frames: for windows with kNoWindowFrame, kStandardWindowControls ==> kNoWindowControls otherwise for kDocWindowFrame windows, kStandardWindowControls ==> kStandardDocWindowControls otherwise for kPaletteWindowFrame windows, kStandardWindowControls ==> kStandardPaletteWindowControls otherwise for kModelessDialogWindowFrame windows, kStandardWindowControls ==> kCloseWindowControl otherwise kStandardWindowControls ==> kNoWindowControls

kSideTitlebarControl 

Used to put the titlebar on the side of a paletteFrame window

kRemoveTitlebarControl 

Used to remove the titlebar of a paletteFrame window

kListAbsentWindowControls 

e.g., to get all except the toolbar control: kListAbsentWindowControls | kToolbarWindowControl

kStandardDocWindowControls 

Standard control attributes for doc window type.

kStandardPaletteWindowControls 

Standard control attributes for palette window type.

kWindowPolicyMask 

Window policy–presence of a bit overrides standard policy, so you only need spec the policies that are non-standard. Note that bits 16..31 come in mutually exclusive pairs–this is asserted in the code. (Hmm – this wastes bits as there are some bit patterns that are illegal such as kHideInBackgroundWindowPolicy | kDontHideInBackgroundWindowPolicy) 16 bits for window behavior. Use kWindowPolicyMask to get just these bits from the whole bitfield.

kStandardWindowPolicy 

use all standard policies for the specified controls, frame, and layer

kHideInBackgroundWindowPolicy 

The window should hide when the app is not frontmost. Standard above kDocumentWindowLayer

kDontHideInBackgroundWindowPolicy 

The window should not hide when the app is not frontmost. Standard at and below kDocumentWindowLayer

kTabCyclesKeyFocusWindowPolicy 

The tab key should move focus from one widget to the next in this window. Standard above kDocumentWindowLayer

kTabDoesntCycleKeyFocusWindowPolicy 

The tab key should not move focus from one widget to the next in this window. Standard at and below kDocumentWindowLayer

kRememberLastEditboxKeyFocusWindowPolicy 

Tells InDesign to remember the last widget in this window that has focus, so the user can restore focus to that editbox using a shortcut. Standard at kPaletteWindowLayer

kDontRememberLastEditboxKeyFocusWindowPolicy 

Standard at other layers

kHasDefaultButtonWindowPolicy 

This attribute indicates there's a default button we should push when the window closes. It's assumed to be the cancel button. Standard for any of the dialog or alert window frames

kMovableWindowPolicy 

Window is movable. Standard except for windows with kNoWindowFrame or a kModalDialogWindowFrame

kListBoxGrabsKeyFocusWindowPolicy 

When the user clicks on a treeview/listbox, this indicates it should take the keyboard focus. Standard for dialog window frames

Member Function Documentation

virtual void IWindow::Activate ()
pure virtual

Notify this window it's being activated.

virtual void IWindow::BringToFront ()
pure virtual

Bring this window to the front of it's window layer.

virtual void IWindow::CenterOnScreen ()
pure virtual

Put the window in the middle of the screen the mouse is currently on.

virtual void IWindow::CloseWindow ()
pure virtual

This call destroys the platform window, and does some cleanup. Also removes the window from the app window list.

virtual void IWindow::Deactivate ()
pure virtual

Notify this window it's being deactivated. Window implementation might do things like dim selections, hide scroll bars, etc.

virtual bool16 IWindow::DoesFloat () const
pure virtual

Returns true if this window is a floating window.

virtual void IWindow::EnsureOnScreen ()
pure virtual

Positions the window (if required) so that calling IsOnScreen returns kTrue

virtual void IWindow::ForceRedraw (SysRgn invalidRgnToAdopt,
bool16 forceRedraw 
)
pure virtual

Redraws the invalid region directly. If 'forceRedraw' is true the redraw will happen immedeately otherwise it just invals the region.

Parameters
invalidRgnToAdoptregion of the window to draw. This region will NOT be disposed by ForceRedraw. If nil then entire window.
forceRedrawkTrue if you'd like to draw now, kFalse to just inval.
virtual int32 IWindow::GetBorderWidth () const
pure virtual

Get the width of window's border(on one side) in pixels.

virtual GSysRect IWindow::GetContentBBox () const
pure virtual
Get the size of the window's content bounding box. The content bounding box excludes the title bar and any drop shadow. This includes just the 'client' area.

Returns
existing window content rectangle
virtual const InterfaceFontInfo& IWindow::GetFont () const
pure virtual

Return the font that should be used by all UI elements in this window. This is the mechanism which allows widgets in palettes to default to a smaller font than widgets in dialogs.

Returns
default UI font to use for widgets in this window.
virtual GSysRect IWindow::GetFrameBBox () const
pure virtual
Get the size of the window's frame bounding box. The frame bounding box includes the title bar and any drop shadow. This includes the 'non-client' area.

Returns
existing window frame rectangle
virtual const InterfaceFontInfo& IWindow::GetHiliteFont () const
pure virtual

Return the hilite font that should be used by all UI elements in this window. This is the mechanism which allows widgets in palettes to default to a smaller font than widgets in dialogs.

Returns
default UI hilite font to use for widgets in this window.
virtual SysCoord IWindow::GetLimits (const LimitType type) const
pure virtual

Get the current limits for this window for min/max width, height.

virtual SysWindow IWindow::GetSysWindow () const
pure virtual

Get the platform window we are wrapping.

Returns
the platform window.
virtual const PMString& IWindow::GetTitle () const
pure virtual

Get the title of the window.

Returns
the last title set by calling SetTitle. Does not fetch the actual title from the window.
virtual int32 IWindow::GetTitlebarHeight () const
pure virtual

Get the height of window's titlebar, in pixels.

virtual VisibleState IWindow::GetVisible () const
pure virtual

Get the visibility.

virtual SysRect IWindow::GetVisRgnBBox () const
pure virtual
Get the visible region bounding box for this window. If the window is not open, this returns an empty rect. Otherwise it returns the content bbox. This might be removed in a future version.

Returns
bbox for visible window content bounds.
virtual uint32 IWindow::GetWindowPolicy () const
pure virtual
Get the WindowSpec bitfield for this window. Can be useful to test if certain bits are enabled.

Returns
This window's WindowSpec bitfield.
virtual ZoomState IWindow::GetZoomState () const
pure virtual

Return the current zoom state, either zoomIn or zoomOut.

virtual void IWindow::InitWindow (uint32 policyBits)
pure virtual

Initialize the window. Call this after constructing the window, but before opening it. This tells us what kind of window to create.

See Also
IWindow::WindowSpec
Parameters
policyBitsthe WindowSpec policy bits defining the window layer, frame, controls, and policies.
virtual bool16 IWindow::IsActive () const
pure virtual

Check if this window is active.

virtual bool16 IWindow::IsOnScreen () const
pure virtual

Returns kTrue if any portion of this window is visible on any monitor

virtual bool16 IWindow::IsRolledUp (bool16 & changed) const
pure virtual

Is the window rolled up and has this state changed since it was last checked

virtual bool16 IWindow::IsVisible () const
pure virtual

Check if the window is currently visible

virtual void IWindow::OpenWindow ()
pure virtual

This call actually creates the platform window, and gets it ready to use. Must be called after InitWindow. Also adds the window to the app window list.

virtual void IWindow::Paint (IViewPortviewPort,
SysRgn updateRgn 
)
pure virtual

Draw the window contents. Paint is usually called by SystemPaint

virtual void IWindow::PlatformWindowClosed ()
pure virtual

Notify the window that the platform window has been closed

virtual void IWindow::Resize (SysCoord newWidth,
SysCoord newHeight 
)
pure virtual
Resize the content bbox to be this new size.

Parameters
newWidththe new width for the content bbox
newHeightthe new height for the content bbox
virtual void IWindow::SetContentBBox (const GSysRectbbox)
pure virtual
Set the size of the window using its content bounding box. The content bounding box excludes the title bar and any drop shadow. This includes just the 'client' area.

Parameters
rtnew window content rect
virtual void IWindow::SetFrameBBox (const GSysRectrt)
pure virtual
Set the size of the window using its frame bounding box. The frame bounding box includes the title bar and any drop shadow. This includes the 'non-client' area.

Parameters
rtnew window frame rect
virtual void IWindow::SetLimits (const LimitType type,
const SysCoord newLimit 
)
pure virtual

Set the current limits for this window for min/max width, height.

virtual void IWindow::SetPosition (GSysCoord xPos,
GSysCoord yPos,
bool16 inFront 
)
pure virtual

Move window's frame bbox top left to (xPos, yPos), where the coordinates are global coordinates. If inFront is true, the window will be moved to the front of the window list. Otherwise, the window retains its position in the window list.

Parameters
xPosnew x position for the window's left side.
yPosnew y position for the window's top edge
inFrontwhether or not to bring this window to the front of it's layer.
See Also
BringToFront if that's all you want to do.
virtual void IWindow::SetTitle (const PMStringnewtitle)
pure virtual

Set the title of the window. Will be translated and displayed in the window titlebar if this window has one.

Parameters
newtitlethe new title for the window
virtual void IWindow::SetVisible (VisibleState state,
bool16 apply = kTrue 
)
pure virtual

Set the visibility. Call SetVisible(kHide) to make the windowinvisible, SetVisible(kShow) to make it visible again.

virtual void IWindow::SetWindowPolicy (uint32 policy)
pure virtual

Change the window attributes, Currently only can change kSideTitlebarControl for existing windows.

Parameters
policyNew WindowSpec bitfiled for this window.
virtual void IWindow::SetZoomState (ZoomState zoomState)
pure virtual

Set the current zoom state without zooming the window.

virtual void IWindow::SystemPaint ()
pure virtual

SystemPaint is called in response to an update event, and it sets the window up for Paint.

virtual SysRgn IWindow::SystemScroll (const SysPointdelta,
bool16 bDoInval = kTrue,
SysRectbbox = nil 
)
pure virtual

Performs the hardware scroll Bitblt scrolling is a two step process. First, the bitblt is done using SystemScroll. SystemScroll returns the exposed region. The caller is responsible for disposing the region. The second step is to update the exposed region. This is done by calling ForceRedraw. This two step process makes it easier for cooperating panoramas to scroll sychronously, by making it possible for all panoramas to do the bitblt and then all panoramas update the exposed region. [amb]

Parameters
deltaHow much to scroll by.
bDoInvalA boolean indicating whether the OS should generate an inval message or not.
bboxThe part of the window to scroll. If this is nil, the content area is scrolled.
Returns
a region for the newly exposed part of the window, i.e. the part that needs to be redrawn. Caller must dispose.
virtual void IWindow::VisibleStateChanged (VisibleState state)
pure virtual

VisibleStateChanged is called when the visible state changes, to allow implementations of IWindow to do anything they need to.

virtual void IWindow::Zoom (ZoomState zoomState,
GSysRectzoomRect 
)
pure virtual

Zoom the window in or out, or snapshot the current size as the new zoomed out size and set the window to zoomed out. If not, the window is zoomed to whereever it was before it was last zoomed out. The new bounding box is returned in zoomRect, in global QuickDraw coordinates.