TQMotifDialog Class

Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# TQMotifDialog Class Reference

The TQMotifDialog class provides the TQDialog API for Motif-based dialogs. More...

This class is part of the TQt Motif Extension.

`#include <qmotifdialog.h>`

Inherits TQDialog.

List of all member functions.

## Public Members

- enum DialogType { Prompt, Selection, Command, FileSelection, Template, Error, Information, Message, Question, Warning, Working } (obsolete)
- TQMotifDialog ( DialogType dialogtype, Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = false, WFlags flags = 0 ) (obsolete)
- TQMotifDialog ( Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = false, WFlags flags = 0 ) (obsolete)
- TQMotifDialog ( Widget parent, const char * name = 0, bool modal = false, WFlags flags = 0 )
- TQMotifDialog ( TQWidget * parent, const char * name = 0, bool modal = false, WFlags flags = 0 )
- virtual ~TQMotifDialog ()
- Widget shell () const
- Widget dialog () const

## Static Public Members

- void acceptCallback ( Widget, XtPointer client_data, XtPointer )
- void rejectCallback ( Widget, XtPointer client_data, XtPointer )

## Detailed Description

This class is defined in the TQt Motif Extension, which can be found in the `qt/extensions` directory. It is not included in the main TQt API.

The TQMotifDialog class provides the TQDialog API for Motif-based dialogs.

TQMotifDialog provides two separate modes of operation. The application programmer can use TQMotifDialog with an existing Motif-based dialog and a TQWidget parent, or the application programmer can use TQMotifDialog with a custom TQt-based dialog and a Motif-based parent. Modality continues to work as expected.

Motif-based dialogs must have a `Shell` widget parent with a single child, due to requirements of the Motif toolkit. The `Shell` widget, which is a special subclass of `XmDialogShell`, is created during construction. It can be accessed using the shell() member function.

The single child of the `Shell` can be accessed using the dialog() member function after it has been created.

The acceptCallback() and rejectCallback() functions provide a convenient way to call TQDialog::accept() and TQDialog::reject() through callbacks. A pointer to the TQMotifDialog should be passed as the `client_data` argument to the callback.

The API and behavior TQMotifDialog is identical to that of TQDialog when using a custom TQt-based dialog with a Motif-based parent. The only difference is that a Motif-based parent argument is passed to the constructor, instead of a TQWidget parent.

## Member Type Documentation

### TQMotifDialog::DialogType

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

This enum lists the predefined Motif dialog types.

- `TQMotifDialog::Prompt`
- `TQMotifDialog::Selection`
- `TQMotifDialog::Command`
- `TQMotifDialog::FileSelection`
- `TQMotifDialog::Template`
- `TQMotifDialog::Error`
- `TQMotifDialog::Information`
- `TQMotifDialog::Message`
- `TQMotifDialog::Question`
- `TQMotifDialog::Warning`
- `TQMotifDialog::Working`

## Member Function Documentation

### TQMotifDialog::TQMotifDialog ( DialogType dialogtype, Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = false, WFlags flags = 0 )

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

Creates a TQMotifDialog using one of the predefined Motif dialog types. The name, modal and flags arguments are passed to the TQDialog constructor.

This constructor creates a Shell widget, which is a special subclass of XmDialogShell. The parent, args and argcount arguments are passed to XtCreatePopupShell() when creating the subclass. You can access the Shell widget with the shell() member function.

This constructor also creates the dialog widget with the Shell widget as its parent. The type of the dialog created is specified by the dialogtype argument. See the DialogType enum for a list of available dialog types. You can access the dialog widget with the dialog() member function.

Warning: TQMotifDialog takes ownership of the child widget and destroys it during destruction. You should not destroy the dialog widget yourself.

See also DialogType, shell(), and dialog().

### TQMotifDialog::TQMotifDialog ( Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = false, WFlags flags = 0 )

This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

Creates a TQMotifDialog which allows the application programmer to use the Motif-based parent for a custom TQDialog. The name, modal and flags arguments are passed to the TQDialog constructor.

This constructor creates a Shell widget, which is a special subclass of XmDialogShell. The args and argcount arguments are passed to XtCreatePopupShell() when creating the subclass. You can access the Shell widget with the shell() member function.

The dialog widget is not created by the constructor. You must create the dialog widget as a child of the the widget returned by shell(). You can access the child widget with the dialog() member function.

A dialog widget is not created by this constructor. Instead, you should create the dialog widget as a child of this dialog. TQMotifDialog will take ownership of your custom dialog, and you can access it with the dialog() member function.

Warning: TQMotifDialog takes ownership of the child widget and destroys it during destruction. You should not destroy the dialog widget yourself.

See also shell() and dialog().

### TQMotifDialog::TQMotifDialog ( Widget parent, const char * name = 0, bool modal = false, WFlags flags = 0 )

Creates a TQMotifDialog which allows the application programmer to use the Motif-based parent for a custom TQDialog. The name, modal and flags arguments are passed to the TQDialog constructor.

This constructor creates a `Shell` widget, which is a special subclass of `XmDialogShell`. You can access the `Shell` widget with the shell() member function.

See also shell().

### TQMotifDialog::TQMotifDialog ( TQWidget * parent, const char * name = 0, bool modal = false, WFlags flags = 0 )

Creates a TQMotifDialog which allows the application programmer to use a TQWidget parent for an existing Motif-based dialog. The parent, name, modal and flags arguments are passed to the TQDialog constructor.

This constructor creates a `Shell` widget, which is a special subclass of `XmDialogShell`. You can access the `Shell` widget with the shell() member functon.

A dialog widget is not created by this constructor. Instead, you should create the dialog widget as a child of this dialog. TQMotifDialog will take ownership of your custom dialog, and you can access it with the dialog() member function.

Warning: TQMotifDialog takes ownership of the child widget and destroys it during destruction. You should not destroy the dialog widget yourself.

See also shell() and dialog().

### TQMotifDialog::~TQMotifDialog ()`[virtual]`

Destroys the TQDialog, dialog widget and `Shell` widget.

### void TQMotifDialog::acceptCallback ( Widget, XtPointer client_data, XtPointer )`[static]`

Convenient Xt/Motif callback to accept the TQMotifDialog.

The data is passed in client_data.

### Widget TQMotifDialog::dialog () const

Returns the Motif widget embedded in this dialog.

### void TQMotifDialog::rejectCallback ( Widget, XtPointer client_data, XtPointer )`[static]`

Convenient Xt/Motif callback to reject the TQMotifDialog.

The data is passed in client_data.

### Widget TQMotifDialog::shell () const

Returns the `Shell` widget embedded in this dialog.

Example: dialog/mainwindow.cpp.

This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.