![]() |
![]() |
To create custom windows and palettes, use the CIPMWinStyle and CIPMWindow interfaces (described on this page) as well as event notification.
The CIPMWindow interface allows you to create, manipulate, and destroy
your window. The CIPMWinStyle interface is used to set the window attributes
for your custom window. Finally, event notification allows you to receive
the system events that are sent to your window.
This page covers the three parts of creating a custom window within the PageMaker application.
CIPMWinStyle
CIPMWindow
The CIPMWinStyle methods are used to set the attributes for a window before it is created. During the creation of a PageMaker window, the pointer to the CIPMWinStyle object is passed to PageMaker.
void SetBorderState(PMBool bBorder);
Sets the borders state for your window. TRUE gives a thick border, FALSE - a single line.
void SetVisibilityState(PMBool bIsVisible);
Sets the initial visibility state of your window (visible or hidden.)
void SetTitleBarState(PMBool bHasTitleBar);
Set this to true to give your window a title bar.
void SetParentState(PMBool bIsParent);
Do not change this value. This value is set appropriately for plug-in windows, and you should not change it.
void SetChildState(PMBool bIsChild);
Do not change this value. This value is set appropriately for plug-in windows, and you should not change it.
void SetZoomState(PMBool bHasZoomBox);
Gives the window a zoom box.
void SetSizeState(PMBool bIsSizeable);
This will give the window a size-box.
void SetCloseState(PMBool bHasCloseBox);
This method will give the window a close box.
void SetMaximizeState(PMBool bIsMaximized);
Gives the window a Maximize/Restore box.
void SetStayOnTopState(PMBool bIsStayOnTop);
Setting this value to TRUE will cause the window to stay on top, or in front of the publication window. This method is used to make floating palettes.
void SetModalState(PMBool bIsModal);
Setting this will make the window modal.
void SetDefaultWindowState(PMBool bIsDefaultWindow);
If this value is set to TRUE, any changes made by the window or palette will affect the publication that is currently active. If the value is FALSE, changes made by the window will affect only the publication that was active when the window was created.
PMBool Create(CIPMWinStyle *pPlugInWinStyle, void *thePrivateWinData);
Creates a new window, with the attributes indicated by the
CIPMWinStyle
interface. The second argument,thePrivateWinData,
is used to point to information that is required when processing messages sent to the window. One common use of thethePrivateWinData
pointer is as an indicator of which window received the message (for plug-ins that implement more than one window.)
PMBool Destroy();
Destroys the window or palette. Note: be sure to remove the palette from the Plug-in Palettes menu, by using
DeleteFromMenu
otherwise the application may try to use the palette after you've calledDestroy
.
void SetPrivateWinData(void *thePrivateWinData);
Assigns the
thePrivateWinData
pointer to a new value.
void *GetPrivateWinData();
Retrieves the current value of the pointer associated with the window.
void SetTitle(char *title);
Sets the title text for the window. (The text shows up in the title bar.)
HWND GetWindowHandle(); GrafPtr GetWindowHandle();
Retrieves the window handle, in a platform specific type (
HWND
for Windows, orGrafPtr
for MacOS).
void GetSizeLimit(RECT *rect); void GetSizeLimit(Rect *rect);
Returns a
Rect, (
orRECT)
that contains the minimum and maximum size for the window. The top and left values represent the minimum height and width, while the bottom and right values represent the maximums.
void SetSizeLimit(RECT rect); void SetSizeLimit(Rect rect);
Changes the minimum and maximum size of the window.
PMErr AddToMenu(char *pShowMenuString, char *pHideMenuString, unsigned short menuState=kAdnLayoutState|kAdnNoPubState);
Adds the window to the "Plug-in Palettes" menu, with different strings to indicate showing and hiding the window. There will be one menu entry and the current state of the window will determine whether the "show" string or the "hide" string is in the menu.
PMErr DeleteFromMenu(char *pShowMenuString, char *pHideMenuString);
Removes the window from the "Plug-in Palettes" menu.
void Show();
Makes the window visible.
void Hide();
Hides the window.
PMBool IsVisible();
Dertermines if the window is visible.
When the operating system sends a message to your window, the PageMaker
application passes that on to your plug-in by sending the kPMSysEvent
opCode
, with a pointer to the PMSysEvent
in the
pPMData
field.
The opCode
and pPMData
fields are both part of
the PMMessage
structure.
The PMSysEvent
structure is the key to managing the window
after it is created, and the structure is platform specific, as follows;
typedef struct _PMSysEvent { CIPMWindow *thePMWindow; // Gives the CIPMWindow that received the msg EventRecord *pEvent; // The msg was received PMBool wasHandled; // Use this if you handled a msg. PMSysEventID sysEventID; // An Enum that indicates the msg. } PMSysEvent, *LPPMSysEvent;
typedef struct _PMSysEvent { CIPMWindow *thePMWindow; // Gives the CIPMWindow that received the msg HWND hWnd; // Windows information on the message UINT message; WPARAM wParam; LPARAM lParam; PMBool wasHandled; // Use this if you handled the message PMSysEventID sysEventID; // Indicates what the message is... } PMSysEvent, *LPPMSysEvent;
In both cases the structure provides the window that received the message, the message, and an ID that makes interpreting the message simpler.
Rather than give a code snippet here, we've provided a page that examines one of the sample plug-ins that has been included with this SDK. The NewPalette sample.
![]() |
Comments or suggestions? Contact Adobe Developer Support Copyright © 1997 - 2001 Adobe Systems Incorporated. All rights
reserved. |