~ubuntu-branches/ubuntu/quantal/openmotif/quantal

« back to all changes in this revision

Viewing changes to demos/lib/Xmd/onHelp.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Bauer
  • Date: 2010-06-23 12:12:31 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100623121231-u89gxdp51sg9wjj2
Tags: 2.3.0-1
* New Maintainer (Closes: #379258) 
* Acknowledge NMU changes
* New upstream release (Closes: #494375)
* Get rid of security patches as they are already part of new upstream
  release (00-xpmvuln.openmotif.patch, 342092-CVE-2005-3964.patch)
* Bump Standards to 3.8.4
* Added {misc:Depends} to make the package lintian cleaner
* Fix weak-library-dev-dependency by adding ${binary:Version}) for the
  -dev Package of openmotif
* Let package depend on autotools-dev to use newer autotools-helper-files
* Work around an autoconf-bug (Gentoo-Bug #1475)
* Added Client-side anti-aliased fonts support via XFT
* Added UTF-8 and UTF8_STRING atom support
* Ability to show text and pixmaps in Label, LabelGadget and all
  derived widgets
* Support of PNG/JPEG image formats in the same way as XPM is supported
* Increase FILE_OFFSET_BITS to 64 to show files >2GB in file-selector
  Idea taken from Magne Oestlyngen (Closes: #288537)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $XConsortium: onHelp.c /main/4 1995/07/15 20:44:13 drk $ */
 
2
/*
 
3
 * @OPENGROUP_COPYRIGHT@
 
4
 * COPYRIGHT NOTICE
 
5
 * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
 
6
 * Copyright (c) 1996, 1997, 1998, 1999, 2000 The Open Group
 
7
 * ALL RIGHTS RESERVED (MOTIF).  See the file named COPYRIGHT.MOTIF for
 
8
 * the full copyright text.
 
9
 * 
 
10
 * This software is subject to an open license. It may only be
 
11
 * used on, with or for operating systems which are themselves open
 
12
 * source systems. You must contact The Open Group for a license
 
13
 * allowing distribution and sublicensing of this software on, with,
 
14
 * or for operating systems which are not Open Source programs.
 
15
 * 
 
16
 * See http://www.opengroup.org/openmotif/license for full
 
17
 * details of the license agreement. Any use, reproduction, or
 
18
 * distribution of the program constitutes recipient's acceptance of
 
19
 * this agreement.
 
20
 * 
 
21
 * EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
 
22
 * PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 
23
 * KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
 
24
 * WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
 
25
 * OR FITNESS FOR A PARTICULAR PURPOSE
 
26
 * 
 
27
 * EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
 
28
 * NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT,
 
29
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 
30
 * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED
 
31
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
32
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
33
 * ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
 
34
 * EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
 
35
 * POSSIBILITY OF SUCH DAMAGES.
 
36
 * 
 
37
 */
 
38
/*
 
39
 * HISTORY
 
40
 */
 
41
 
 
42
#include <stdlib.h>
 
43
#include <Xm/Xm.h>
 
44
#include "Help.h"
 
45
 
 
46
void quitCB( Widget widget, char *tag, XmAnyCallbackStruct *callback_data )
 
47
{
 
48
  exit(0);
 
49
}
 
50
 
 
51
/*
 
52
 *  Main program
 
53
 */
 
54
int main(int argc, String argv[])
 
55
{
 
56
  Arg   args[10];
 
57
  XtAppContext app_context;
 
58
  int n;
 
59
  Widget toplevel, help;
 
60
  Cardinal size;
 
61
  XmRendition rend[10];
 
62
  XmRenderTable rt;
 
63
  int i;
 
64
  XmTab tabs[5];
 
65
  XmTabList tablist;
 
66
  Widget dismiss;
 
67
 
 
68
  toplevel = XtVaAppInitialize(&app_context, "HelpOnHelp", NULL, 0, 
 
69
                               &argc, argv, NULL, 0);
 
70
  n = 0;
 
71
  XtSetArg(args[n], XmdNhelpFile, "helpOn"); n++;
 
72
  help = XmdCreateHelp(toplevel, "help", args, n);
 
73
  dismiss = XtNameToWidget(help, "*Dismiss");
 
74
  XtAddCallback(dismiss, XmNactivateCallback,
 
75
                (XtCallbackProc) quitCB, NULL);
 
76
  /* Get the rendertable and add some new renditions */
 
77
  XtVaGetValues(help, XmNrenderTable, &rt, NULL, NULL);
 
78
  /* Make the tabs for the tables */
 
79
  n = 0;
 
80
  tabs[n] = XmTabCreate(2.0, XmINCHES, XmABSOLUTE,
 
81
                        XmALIGNMENT_BEGINNING, NULL); n++;
 
82
  tabs[n] = XmTabCreate(4.0, XmINCHES, XmABSOLUTE,
 
83
                        XmALIGNMENT_BEGINNING, NULL); n++;
 
84
  tablist = XmTabListInsertTabs(NULL, tabs, n, 0);
 
85
  for(i = 0; i < n; i++) XmTabFree(tabs[i]);
 
86
 
 
87
  /* Add extra renditions needed for the help file */
 
88
  n = 0; i = 0;
 
89
  XtSetArg(args[n], XmNtabList, tablist); n++;
 
90
  rend[i] = XmRenditionCreate(help, "table", args, n); i++;
 
91
  n = 0;
 
92
  XtSetArg(args[n], XmNfontName, "*courier-medium-r-*-12-*"); n++;
 
93
  XtSetArg(args[n], XmNfontType, XmFONT_IS_FONT); n++;
 
94
  rend[i] = XmRenditionCreate(help, "program", args, n); i++; 
 
95
  n = 0;
 
96
  XtSetArg(args[n], XmNunderlineType, XmSINGLE_LINE); n++;
 
97
  rend[i] = XmRenditionCreate(help, "underline", args, n); i++; 
 
98
  /* Make a copy so that setvalues will work correctly */
 
99
  rt = XmRenderTableCopy(rt, NULL, 0);
 
100
  rt = XmRenderTableAddRenditions(rt, rend, i, XmMERGE_NEW);
 
101
  for(n = 0; n < i; n++) XmRenditionFree(rend[n]);
 
102
 
 
103
  XtVaSetValues(help, XmNrenderTable, rt, NULL, NULL);
 
104
  XmRenderTableFree(rt);
 
105
 
 
106
  XtManageChild(help);
 
107
 
 
108
  XtRealizeWidget(toplevel);
 
109
 
 
110
  XtAppMainLoop(app_context);
 
111
 
 
112
  return 0;    /* make compiler happy */
 
113
}