Using Rogue Wave Views on X Window Systems > Integrating Rogue Wave Views with an X Application Using libxviews
 
Integrating Rogue Wave Views with an X Application Using libxviews
The Xlib version has the capability of integrating any Xlib-based application as soon as it is provided a pointer to a Display object, a Window to draw to, and a way to receive events from it.
In the following sections, you will find information on:
*Integration Steps
*Complete Template
*Complete Example with Motif
Integration Steps
To use Rogue Wave Views with any Xlib-based toolkit, you have to :
1. Create an IlvDisplay instance using an existing X Display.
Use the IlvDisplay constructor: 
IlvDisplay::IlvDisplay(IlAny exitingXDisplay, const char* name);
For example:
Display* xdisplay;
// ... initialize this Display*: xdisplay = XOpenDisplay(...);
IlvDisplay* ilvdisplay = new IlvDisplay((IlAny)xdisplay, "Views");
2. Create some IlvView or IlvContainer instances using an existing X Window :
Use the IlvView constructor:
IlvView::IlvView(IlvDisplay* display,
IlvSystemView existingXWindow)
For example:
IlvDisplay* display;
// initialize this 'display'
Window xWindow;
// initialize this X window
IlvView* view = new IlvView(display, (IlvSystemView)xWindow);
or
IlvContainer* container = new IlvContainer(display,
(IlvSystemView)xWindow);
3. Manage the events in these IlvView views :
Once you receive an X event, you must call
IlvEventLoop::getEventLoop()->dispatchEvent(&xevent);
Complete Template
The main procedure looks like this:
main()
{
// Initialize your toolkit
Display* xdisplay;
xdisplay = // XOpenDisplay...;
// Initialize an IlvDisplay
IlvDisplay* ilvdisplay = new IlvDisplay((IlAny)xdisplay, "Views");
// Create an X window:
Window xwindow;
xwindow = // ...;
// Create an IlvContainer
IlvContainer* container = new IlvContainer(display,(IlvSystemView)xwindow);
container->addObject(new IlvLabel(...));
// Now call the toolkit main event loop
}

Version 5.5.1
Copyright © 2012, Rogue Wave Software, Inc. All Rights Reserved.