dtinfo: Fix coverity warning related to using delete not delete []
[oweals/cde.git] / cde / programs / dtpdm / MainWindow.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: MainWindow.h /main/4 1996/08/12 18:42:19 cde-hp $ */
24 /*
25  * dtpdm/MainWindow.h
26  */
27 /*
28  * (c) Copyright 1996 Digital Equipment Corporation.
29  * (c) Copyright 1996 Hewlett-Packard Company.
30  * (c) Copyright 1996 International Business Machines Corp.
31  * (c) Copyright 1996 Sun Microsystems, Inc.
32  * (c) Copyright 1996 Novell, Inc. 
33  * (c) Copyright 1996 FUJITSU LIMITED.
34  * (c) Copyright 1996 Hitachi.
35  */
36 #ifndef _pdmMainWin_h
37 #define _pdmMainWin_h
38
39 #include "PdmXp.h"
40
41 /*
42  * return codes for a PdmBoxVerifyAttrProc
43  */
44 typedef enum { PDM_SUCCESS, PDM_FAILURE } PdmStatus;
45
46 /*
47  * callback procedure types for setup box children of the PDM main window
48  */
49 typedef struct _PdmSetupBox* (*PdmBoxNewProc) (void);
50 typedef void (*PdmBoxDeleteProc)(struct _PdmSetupBox* me);
51 typedef void (*PdmBoxCreateProc)(struct _PdmSetupBox* me, Widget parent);
52 typedef PdmStatus (*PdmBoxVerifyAttrProc)(struct _PdmSetupBox* me,
53                                           PdmXp* pdm_xp);
54 typedef void (*PdmBoxGetAttrProc)(struct _PdmSetupBox* me, PdmXp* pdm_xp);
55 typedef void (*PdmBoxSetAttrProc)(struct _PdmSetupBox* me, PdmXp* pdm_xp);
56
57 /*
58  * instance structure for setup box children of the PDM main window
59  */
60 typedef struct _PdmSetupBox
61 {
62     /*
63      * define common setup box functions
64      */
65     PdmBoxDeleteProc delete_proc;
66     PdmBoxCreateProc create_proc;
67     PdmBoxVerifyAttrProc verify_attr_proc;
68     PdmBoxGetAttrProc get_attr_proc;
69     PdmBoxSetAttrProc set_attr_proc;
70     /*
71      * the setup box child's widget ID
72      */
73     Widget widget;
74     /*
75      * the setup box provides its own fallback resources and the
76      * notebook tab widget instance name
77      */
78     const String* fallback_resources;
79     int fallback_resources_count;
80     const char* tab_name;
81     /*
82      * allow child setup box-specific data
83      */
84     void* subclass_data;
85     
86 } PdmSetupBox;
87
88 /*
89  * node structure for the list of setup box children managed by the PDM
90  * main window
91  */
92 typedef struct _PdmBoxNode
93 {
94     PdmSetupBox* box;
95     Widget tab;
96     struct _PdmBoxNode* next;
97 } PdmBoxNode, *PdmBoxList;
98
99 /*
100  * PDM main window instance structure
101  */
102 typedef struct _PdmMainWin
103 {
104     /*
105      * widget IDs
106      */
107     Widget widget;
108     Widget notebook;
109     /*
110      * printer information
111      */
112     char* print_display_spec;
113     
114     const char* printer_descriptor;
115     const char* printer_name;
116     /*
117      * linked list of setup boxes
118      */
119     PdmBoxList box_list_head;
120     PdmBoxList box_list_tail;
121     /*
122      * Xp interface
123      */
124     PdmXp* pdm_xp;
125     /*
126      * online help
127      */
128     Widget help_dialog;
129
130 } PdmMainWin;
131
132 /*
133  * public PdmMainWin methods
134  */
135 PdmMainWin* PdmMainWinNew(void);
136 PdmMainWin* PdmMainWinCreate(
137                              PdmMainWin* me,
138                              Widget parent,
139                              String print_display_spec,
140                              String print_context_str);
141 void PdmMainWinDelete(PdmMainWin* me);
142 PdmSetupBox* PdmMainWinAddSetupBox(PdmMainWin* me, PdmSetupBox* box);
143 String* PdmMainWinMergeFallbacks(PdmMainWin* me,
144                                  const String* app_fallbacks,
145                                  int count);
146
147 #endif /* _pdmMainWin_h */
148
149