X2 Standard  Version 1.24
Public Member Functions | List of all members
X2GUIInterface Class Referenceabstract

The X2GUIInterface allows X2 implementors to display a customized, cross platform, graphical user interface. More...

#include <x2guiinterface.h>

Public Member Functions

virtual int loadUserInterface (const char *pszFileName, const int &dt, const int &nISIndex)=0
 
virtual X2GUIExchangeInterfaceX2DX ()=0
 
virtual int exec (bool &bPressedOK)=0
 

Detailed Description

The X2GUIInterface allows X2 implementors to display a customized, cross platform, graphical user interface.

TheSkyX Build 4174 or later is required for all X2GUI type interfaces.

When making a graphical user interface associated with a cross platform device driver, the developer is faced with basically two options.

Option A: the developer could write and maintain native GUI code specific to each operating system. While this is a perfectly valid solution, the code is difficult to maintain and native GUI expertise/experience is required on all supported operating systems.

Option B: the developer could use a cross platform graphical user interface library, for example qt or wxWidgets, to make their graphical user interface. Again a perfectly valid solution, but then the distribution of any associated GUI libraries falls on the driver developer and if not done carefully, dll $#&& will result (especially in a plug in architecture).

Option C: The X2 standard offers a third option when a driver developer is faced with the problem of creating custom graphical user interface associated with the hardware, that works on multiple operating systems. X2 developer can use the X2GUIInterface to have TheSky display their own, modal, custom, graphical user interface that is cross platform.
The X2GUIInterface is windowing library agnostic, it does not expose or depend on any cross platform GUI library or windowing code native to any operating system. The consequence is that X2 drivers using the X2GUIInterface are more or less encapsulated as far as the GUI goes. So development, distribution and maintenance are greatly simplified. There is of course some overhead in learning the X2GUIInterface, but the code samples show how to do it.

The X2GUIInterface requires creating the graphical user interface file with qt's Designer (an open source copy of Designer (designer.exe) is included in the X2 samples in the footer). The X2 developer distributes the .ui created by Designer and TheSkyX loads this user interface dynamically at run time. Graphical user interface events are supported through the X2GUIEventInterface. Qt's Designer is only required at design time by the X2 developer for the creation of the X2 user interface. The X2 developer does not need to worry about distribution of any qt binaries at run time because X2 is not dependent upon qt. Please note that the .ui created in this way is considered open source and since the .ui is visible in TheSkyX anyway there isn't much intellectual property disclosed.

There are a few rules when using qt's Designer to create a .ui file compatible with X2GUIInterface:

  1. All controls must be placed within a QFrame, promoted to an X2Form via the x2form.h and named X2Form (code samples do this for you).
  2. If you need access to GUI events through the X2GUIEventInterface, keep the default object name that qt Designer creates when dropping user interface controls inside the X2Form (for example, the first radio button is named "radioButton", the second is "radioButton_2", etc).

Please note, that not every control and not every event from every control is supported. Never-the-less, the most common ones are supported. Between the X2GUIExchangeInterface and using qt's Designer to set user interface control properties, a nice GUI can be created with a fairly broad range of capabilities.

Declare a local instance of the X2ModalUIUtil class to obtain this interface. See the X2Camera for a complete end to end example of creating a graphical user interface, setting control values, responding to GUI events and retrieving control values.

See also
X2ModalUIUtil

Member Function Documentation

◆ exec()

virtual int X2GUIInterface::exec ( bool &  bPressedOK)
pure virtual

Display the user interface.

◆ loadUserInterface()

virtual int X2GUIInterface::loadUserInterface ( const char *  pszFileName,
const int &  dt,
const int &  nISIndex 
)
pure virtual

Set the name of the Qt user interface file (.ui) that defines your custom user interface. This must be called before calling exec(). The .ui file goes into the same folder as the binary (shared library) of the driver.

◆ X2DX()

virtual X2GUIExchangeInterface* X2GUIInterface::X2DX ( )
pure virtual

Returns the X2GUIExchangeInterface associated with this user-interface.


The documentation for this class was generated from the following file:
X2 Examples
(C) Software Bisque, Inc. All rights reserved.