Indesign doesn't use windows to put together many panels into a palette or to draw the tab of a palette. It uses GDI (or the equivalent on the Mac) to draw everything on screen. IControlView is the interface for a "control", you can navigate the controls tree trough IWidgetParent interface (and GetParent method) and IPanelControlData or IPaletteControlData.
Suppose you have a panel that is subclassed by you, you can ask for the IPaletteControlData, this way:
IPaletteControlData* ppcd = nil;
InterfacePtr<IWidgetParent> parent(
this, UseDefaultIID());if( parent ) {ppcd =
static_cast<IPaletteControlData*>(parent->QueryParentFor(IID_IPALETTECONTROLDATA));}
InterfacePtr<IPaletteControlData> pcd(ppcd);
ASSERT(pcd);
Now you can use GetSectionCount and GetSection to retrieve the interface for the wanted control, the first one is the tab, the other is the entire panel. Suppose you want to enumerate the tabs in the palette, you need the PanelControlData for the tabs so:
InterfacePtr<IControlView> tabAreaView(pcd->GetSection(0), UseDefaultIID());
ASSERT(tabAreaView);
InterfacePtr<IPanelControlData> tabAreaCD(tabAreaView, UseDefaultIID());
ASSERT(tabAreaCD);
for(int32 idx = 0; idx < tabAreaCD->Length(); idx++) {
InterfacePtr<IControlView> tabWidget(tabAreaCD->GetWidget(idx), UseDefaultIID());
}
And there you can draw whatever you want on the tab.
2 comments:
Hello,
Be sure to let me know if you need help with development. Adobe offers several resources for developers who are working on plug-ins.
You can contact me at mnr@adobe.com.
Mark Niemann-Ross
InDesign Developer Evangelist
I checked out all the resources in http://partners.adobe.com/asn/indesign/sdk.jsp too, including the WebEx session on the User Interface but I found it too mimimalistic for my purposes.
Right now I'm fighting to draw custom tabs in a palette, I solved the problem with normal palette (including finding the right font for highlighted and not highlighted panels) but I still have some problems with stashed palette.
How do I find out which font must be used? It seems that it is not the same use for horizontal names....
How do I calculate the exact position of the text? I'm using empyrical values which I don't like at all.
regards,
- mn
Post a Comment