18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

C++ APPLICATION PROGRAMMING INTERFACE<br />

Trying it out<br />

To compile your Motif program, you will need to link against libraries for Motif,<br />

Xt, and X11, in that order. If you are programming on Solaris, you will compile<br />

with the Sun Workshop (Forte), and if you are programming on Linux you will<br />

use GCC.<br />

CC pbExample.cpp -o pbExample -lXm -lXt -lX11<br />

Run the program:<br />

./pbExample<br />

As you click the button, you will see counts appear in your terminal window.<br />

Now that you have a feeling for Motif programming, look at the C++ samples<br />

for Motif, and see these steps applied there.<br />

Additional resources<br />

• Heller, Dan, Paula M. Ferguson, and David Brennan. Motif Programming<br />

Manual (The Definitive <strong>Guide</strong>s to the X Window System, Volume 6A) 2nd<br />

Edition. O’Reilly & Associates. 1994.<br />

Motif <strong>ArcGIS</strong> control programming<br />

The Solaris and Linux SDK also provides a set of Motif widgets that may be<br />

used to embed the <strong>ArcGIS</strong> controls in a Motif application. Due to the limitations<br />

of Motif, this code will only run on Solaris and Linux systems. If visual components<br />

are needed on Windows, you will need to use Visual C++, the COM API,<br />

and ActiveX controls.<br />

Header files<br />

To use the Motif <strong>ArcGIS</strong> controls, you will need to include both the <strong>ArcGIS</strong><br />

<strong>Engine</strong> header file, ArcSDK.h, and the <strong>ArcGIS</strong> <strong>Engine</strong> Motif controls header<br />

file, Ao/AoMotifControls.h.<br />

Control types and their details<br />

Control<br />

Globe Control<br />

Map Control<br />

PageLayout Control<br />

Reader Control<br />

Scene Control<br />

TOC Control<br />

Toolbar Control<br />

MwNprogID<br />

AoPROGID_GlobeControl<br />

AoPROGID_MapControl<br />

AoPROGID_PageLayoutControl<br />

AoPROGID_ReaderControl<br />

AoPROGID_SceneControl<br />

AoPROGID_TOCControl<br />

AoPROGID_ToolbarControl<br />

Interface Type<br />

IGlobeControl<br />

IMapControl3<br />

IPageLayoutControl<br />

IARControl<br />

ISceneControl<br />

ITOCControl<br />

IToolbarControl<br />

API functions and arguments<br />

• For each <strong>ArcGIS</strong> <strong>Engine</strong> Control interface, there is a smart pointer defined for<br />

you. Instead of IMapControl3*, you can use IMapControl3Ptr.<br />

• MwCtlAppMainLoop replaces XtAppMainLoop.<br />

extern "C" void MwCtlAppMainLoop(XtAppContext app);<br />

• MwCtlGetInterface is used to get the control’s interface pointer.<br />

HRESULT MwCtlGetInterface(Widget w, IUnknown** ppUnk);<br />

Chapter 4 • <strong>Developer</strong> environments • 239

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

Saved successfully!

Ooh no, something went wrong!