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.

C++ APPLICATION PROGRAMMING INTERFACE<br />

Additional resources<br />

• www.gtk.org<br />

GTK ARCGIS control programming<br />

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

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

GTK, 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, and<br />

ActiveX controls.<br />

Header files<br />

For an <strong>ArcGIS</strong> GTK control application, you will need to include Ao/<br />

GtkControls.h in addition to your <strong>ArcGIS</strong> <strong>Engine</strong> and GTK includes (ArcSDK.h<br />

and gtk/gtk.h, respectively).<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 />

ProgID<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 />

• gtk_axctl_new is used to create the GTK <strong>ArcGIS</strong> Control Widget.<br />

GtkWidget *gtk_axctl_new(ControlDataPtr cd);<br />

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

HRESULT gtk_axctl_get_interface(GtkWidget *axctl, IUnknown **ppUnk);<br />

• gtk_axctl_initialize_message_queue is used to enable MainWin message delivery<br />

before starting the main GTK loop with gtk_main.<br />

void gtk_axctl_initialize_message_queue();<br />

Control widget creation example<br />

The following example demonstrates creating and placing a map control that fills<br />

the entire GTK form window (defined outside this code snippet) and retrieves a<br />

smart pointer for the control. The bold sections highlight functions and resources<br />

discussed above.<br />

// ArcObjects Headers<br />

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

#include <br />

// Controls<br />

#include <br />

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

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

Saved successfully!

Ooh no, something went wrong!