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