18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

BUILDING APPLICATIONS WITH C++ AND CONTROL WIDGETS<br />

5. To put the toolbar into the customize state when the dialog box is started,<br />

listen for the CustomizeDialog events. Implement a class, CustomizeDialogEvents,<br />

which inherits from ICustomizeDialogEvents.<br />

a. First make the header file for the class: CustomizeDialogEvents.h. The class<br />

will need to have access to the global ToolbarControl and the<br />

g_customizeToggle widget. Make sure to include the files needed for the<br />

ToolbarControl and the toggle widget. ICustomizeDialogEvents is declared<br />

with the other classes for the ToolbarControl, so be sure to include<br />

toolbarcontrol.tlh and toolbarcontrol_events.tlh.<br />

#ifndef __CUSTOMIZEDIALOGEVENTS_H_<br />

#define __CUSTOMIZEDIALOGEVENTS_H_<br />

This class will be Motif specific since it must<br />

access the toggle button, a Motif widget. For the<br />

GTK-specific code, see CustomizeDialogEvents.h<br />

and CustomizeDialogEvents.cpp in the GTK zip<br />

file.<br />

// Motif Headers<br />

#define String esriXString<br />

#define Cursor esriXCursor<br />

#define Object esriXObject<br />

#define ObjectClass esriXObjectClass<br />

#include <br />

#include <br />

#include <br />

#include <br />

#include <br />

#undef String<br />

#undef Cursor<br />

#undef Object<br />

#undef ObjectClass<br />

// ArcObjects Headers<br />

// <strong>Engine</strong><br />

#include <br />

// Controls<br />

#include <br />

extern IToolbarControlPtr g_ipToolbarControl;<br />

extern Widget g_customizeToggle;<br />

class CustomizeDialogEvents : public ICustomizeDialogEvents<br />

{<br />

public:<br />

// IUnknown<br />

IUNKNOWN_METHOD_DEFS<br />

// ICustomizeDialogEvents<br />

HRESULT OnStartDialog();<br />

HRESULT OnCloseDialog();<br />

};<br />

#endif // __CUSTOMIZEDIALOGEVENTS_H_<br />

Chapter 6 • <strong>Developer</strong> scenarios • 405

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!