summaryrefslogtreecommitdiffstats
path: root/doc/html/motif-walkthrough-5.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/html/motif-walkthrough-5.html')
-rw-r--r--doc/html/motif-walkthrough-5.html109
1 files changed, 109 insertions, 0 deletions
diff --git a/doc/html/motif-walkthrough-5.html b/doc/html/motif-walkthrough-5.html
new file mode 100644
index 0000000..357fe93
--- /dev/null
+++ b/doc/html/motif-walkthrough-5.html
@@ -0,0 +1,109 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/extensions/motif/doc/walkthrough.doc:661 -->
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Using Existing Dialogs with QMotifDialog</title>
+<style type="text/css"><!--
+fn { margin-left: 1cm; text-indent: -1cm; }
+a:link { color: #004faf; text-decoration: none }
+a:visited { color: #672967; text-decoration: none }
+body { background: #ffffff; color: black; }
+--></style>
+</head>
+<body>
+
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr bgcolor="#E5E5E5">
+<td valign=center>
+ <a href="index.html">
+<font color="#004faf">Home</font></a>
+ | <a href="classes.html">
+<font color="#004faf">All&nbsp;Classes</font></a>
+ | <a href="mainclasses.html">
+<font color="#004faf">Main&nbsp;Classes</font></a>
+ | <a href="annotated.html">
+<font color="#004faf">Annotated</font></a>
+ | <a href="groups.html">
+<font color="#004faf">Grouped&nbsp;Classes</font></a>
+ | <a href="functions.html">
+<font color="#004faf">Functions</font></a>
+</td>
+<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>Using Existing Dialogs with QMotifDialog</h1>
+
+
+
+[ <a href="motif-walkthrough-4.html">Previous: Using Custom QDialogs</a> ]
+[ <a href="motif-walkthrough.html">Home</a> ]
+[ <a href="motif-walkthrough-6.html">Next: Using Qt Main Window Classes</a> ]
+<p> As mentioned earlier, the <em>Print</em> dialog cannot be replaced until we
+have converted the <em>View</em> widget. The <em>Print</em> dialog will be
+removed once we have finished our migration, since we will use
+<a href="qprinter.html">QPrinter</a> instead. Based on this information, we decide that it is not
+worth replacing the <em>Print</em> dialog with a custom <a href="qdialog.html">QDialog</a> replacement.
+Instead, we will keep the <a href="motif-extension.html#Motif">Motif</a> based dialog and use <a href="qmotifdialog.html">QMotifDialog</a> to
+integrate the dialog with the application.
+<p> <h2> Modality Requirements
+</h2>
+<a name="1"></a><p> Modality with QDialog is different from Motif. The <a href="qdialog.html#exec">QDialog::exec</a>()
+function does not return until the dialog is finished. In Motif,
+modality is simply a property of the shell, and the application
+programmer must write QDialog::exec() style functionality if they
+want that behavior.
+<p> Since we will be using QMotifDialog (which is a QDialog subclass), we
+will need to have an <em>accept</em> and a <em>reject</em> callback for each
+dialog we integrate with QMotifDialog. The predefined Motif dialogs
+have these already: the <tt>XmNokCallback</tt> and <tt>XmNcancelCallback</tt>
+callbacks. However, the <em>Print</em> dialog only has an <em>accept</em> callback
+(the <tt>XmdNprintCallback</tt>), but it does not have a <em>reject</em> callback.
+We need to add this.
+<p> This is easily done. We add an <tt>XtCallbackList</tt> for the <tt>XmNcancelCallback</tt> callback in <tt>Xmd/PrintP.h</tt>:
+<p>
+
+<pre></pre>
+<p> We add the <tt>XmNcancelCallback</tt> callback to the list of resources for
+the <tt>XmdPrint</tt> widget class in <tt>Xmd/Print.c</tt>:
+<p>
+
+<pre></pre>
+<p> We need to activate this callback whenever we unmanage the widget and
+do not activate the <em>print</em> callback, which is in the <tt>do_help_cb()</tt>
+function:
+<p> <pre></pre>
+<p> ... and in the unmanage_cb() function:
+<p> <pre></pre>
+<p> <h2> Integrating the <em>Print</em> Dialog
+</h2>
+<a name="2"></a><p> Now that the <em>Print</em> dialog has the appropriate <em>accept</em> and <em>reject</em> callbacks, we can use <a href="qmotifdialog.html">QMotifDialog</a>. First we need to include
+the QMotifDialog header in <tt>todo.cpp</tt>.
+<p>
+
+<p> <pre></pre>
+<p> We add a <tt>ShowPrintDialog()</tt> function which will create and execute the
+print dialog.
+<p> <pre></pre>
+<p> We change the <em>Print</em> menu item callback to call the new <tt>ShowPrintDialog()</tt> function. We pass the top-level <a href="qmotifwidget.html">QMotifWidget</a>, which
+we will use as the parent for the dialog.
+<p> <pre></pre>
+<p> The <tt>ShowPrintDialog()</tt> function creates the <em>Print</em> dialog and
+executes it. We use the <tt>XmdNprintCallback</tt> callback to accept the
+dialog and the <tt>XmNcancelCallback</tt> callback to reject the dialog. We
+can do this easily by using the <a href="qmotifdialog.html#acceptCallback">QMotifDialog::acceptCallback</a>() and
+<a href="qmotifdialog.html#rejectCallback">QMotifDialog::rejectCallback</a>() functions, respectively. We also
+ensure that the <em>print</em> callback continues to call the <tt>Print()</tt> function as before.
+<p> <pre></pre>
+<p> After we build the project, the application runs and operates as
+expected. There is no visual or behavioral difference, even though
+the <em>Print</em> dialog is using <a href="qmotifdialog.html">QMotifDialog</a>.
+<p> [ <a href="motif-walkthrough-4.html">Previous: Using Custom QDialogs</a> ]
+[ <a href="motif-walkthrough.html">Home</a> ]
+[ <a href="motif-walkthrough-6.html">Next: Using Qt Main Window Classes</a> ]
+<p>
+<!-- eof -->
+<p><address><hr><div align=center>
+<table width=100% cellspacing=0 border=0><tr>
+<td>Copyright &copy; 2007
+<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
+<td align=right><div align=right>Qt 3.3.8</div>
+</table></div></address></body>
+</html>