Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtprintinfo / UI / DtMainW.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: DtMainW.h /main/3 1995/11/06 09:35:41 rswiston $ */
24 /*                                                                      *
25  * (c) Copyright 1993, 1994 Hewlett-Packard Company                     *
26  * (c) Copyright 1993, 1994 International Business Machines Corp.       *
27  * (c) Copyright 1993, 1994 Sun Microsystems, Inc.                      *
28  * (c) Copyright 1993, 1994 Novell, Inc.                                *
29  */
30
31 #ifndef DTMAINW_H
32 #define DTMAINW_H
33
34 #include "MainWindow.h"
35 #include "Menu.h"
36 #include "MenuBar.h"
37 #include "DtActions.h"
38 #include "DtSetPref.h"
39 #include "DtPrinterIcon.h"
40
41 class Button;
42 class DtSetModList;
43 class DtWorkArea;
44 class DtFindD;
45 class LabelObj;
46 class HelpSystem;
47 class DtFindSet;
48
49 typedef void (*OpenCallback) (void *callback_data, BaseUI *object);
50
51 typedef struct 
52 {
53    ActionCallback actionCallback;
54    void *callback_data; 
55    char *actionReferenceName;
56 } ActionData;
57
58 class DtMenu : public Menu 
59 {
60  public:
61    char *location_id;
62    DtMenu(MenuBar *parent, char *name, char *mnemonic, char *help_location_id) :
63       Menu(parent, name, mnemonic)
64        {
65          location_id = help_location_id;
66        }
67    boolean HandleHelpRequest();
68 };
69
70 class DtMainW : public MainWindow 
71 {
72
73    friend void SetPrefCB(void *data);
74    friend void ExitCB(void *data);
75    friend void ActionCB(void *data);
76    friend void HelpCB(void *data);
77    friend void ReferenceCB(void *data);
78    friend void UsingHelpCB(void *data);
79    friend void TasksCB(void *data);
80    friend void AboutCB(void *data);
81
82  private:
83
84    OpenCallback _openClose;
85    PreferenceCallback _prefCB;
86    ContainerType _container_type;
87    SelectionType _select_type;
88    void *_openCallbackData;
89    void *_prefCallbackData;
90    char *_fileMenuName;
91    char *_fileMenuMnemonic;
92    ActionData **action_data;
93    int n_action_data;
94    int working_curs;
95    PrinterApplicationMode app_mode;
96
97    static void SetPrefCB(void *data);
98    static void ExitCB(void *data);
99    static void ActionCB(void *data);
100    static void OnItemCB(void *data);
101    static void HelpCB(void *data);
102    static void ReferenceCB(void *data);
103    static void UsingHelpCB(void *data);
104    static void TasksCB(void *data);
105    static void AboutCB(void *data);
106
107    boolean HandleHelpRequest();
108
109  public:
110
111    DtFindD *     findD;      // Find dialog
112    DtSetPref *   setPrefD;   // Set preferences dialog
113    DtSetModList *setModList; // Set printer list dialog
114    DtWorkArea *  container;  // Work Area
115    MenuBar *     mbar;       // Menu Bar
116    HelpSystem *  helpSystem;
117    DtFindSet *   findSetD;
118
119    // Pulldown menu structure
120    DtMenu *fileMenu;
121        Button *exitB;
122    DtMenu *viewMenu;
123        Button *setPref;
124    DtActions *actionsMenu;
125    DtMenu *helpMenu;
126        Button *introduction;
127        // ------------------- Separator
128        Button *tasks;
129        Button *reference;
130        Button *onWindow;
131        // ------------------- Separator
132        Button *usingHelp;
133        // ------------------- Separator
134        Button *version;
135
136    LabelObj *status_line;
137    boolean in_find;
138
139    DtMainW(char *category,
140            AnyUI *p,
141            char *name,
142            ContainerType container_type = SCROLLED_WORK_AREA,
143            SelectionType select_type = SINGLE_SELECT,
144            OpenCallback openCB = NULL,
145            void *openCallbackData = NULL,
146            PreferenceCallback prefCB = NULL,
147            void *prefCallbackData = NULL,
148            char *fileMenuName = NULL,
149            char *fileMenuMnemonic = NULL,
150            PrinterApplicationMode app_mode = SINGLE_PRINTER);
151    ~DtMainW();
152    void DtAddAction(char *name, char *category,
153                     char *actionReferenceName, ActionCallback callback,
154                     void *callback_data, char *mnemonic = NULL,
155                     char *acceleratorText = NULL, char *accelerator = NULL);
156
157    void WorkingCursor(boolean);
158    PrinterApplicationMode PrinterAppMode() { return app_mode; }
159    void DisplayHelp(char *location_id, char *volume = "Printmgr");
160    void DtAddSep(char *category);
161    void Initialize();
162    void OpenClose(BaseUI *obj);
163
164 };
165
166 #endif /* DTMAINW_H */