Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / programs / dtprintinfo / libUI / MotifUI / MainWindow.h
1 /* $XConsortium: MainWindow.h /main/3 1995/11/06 09:42:47 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 MAINWINDOW_H
10 #define MAINWINDOW_H
11
12 #include "MotifUI.h"
13
14 class PopupMenuContainer;
15 class Button;
16
17 class MainWindow : public MotifUI {
18
19    friend void KeyboardPopupMenu(Widget, XEvent *, String *, Cardinal *);
20    friend void PopupMenu(Widget, XtPointer, XEvent *, Boolean *);
21
22  protected:
23
24    static XtActionsRec actions[];
25    static void KeyboardPopupMenu(Widget, XEvent *, String *, Cardinal *);
26    static void PopupMenu(Widget, XtPointer, XEvent *, Boolean *);
27
28    void PostMenu(MotifUI *, XEvent *);
29    PopupMenuContainer *popups;
30    Widget LastPopupMenu;
31    XtTranslations trans;
32    char *icon;
33    char *icon_name;
34
35    // Derived classes must define Initialize
36    virtual void Initialize() = 0;
37
38    void CreateMainWindow(MotifUI *parent, char *name, char *widgetName,
39                          char *icon, char *icon_name);
40
41  public:
42
43    MainWindow(MotifUI *parent,
44               char *name,
45               char *widgetName,
46               char *icon = NULL,
47               char *icon_name = NULL);
48
49    MainWindow(char *category,
50               MotifUI *parent,
51               char *name,
52               char *widgetName,
53               char *icon = NULL,
54               char *icon_name = NULL);
55    virtual ~MainWindow();
56
57    void IconFile(char *icon);
58    void IconName(char *icon_name);
59    char *IconFile() { return icon; }
60    char *IconName() { return icon_name; }
61
62    Button *AddAction(char *name, char *category, ButtonCallback callback,
63                      void *callback_data, char *mnemonic = NULL,
64                      char *acceleratorText = NULL, char *accelerator = NULL);
65    void RegisterPopup(MotifUI *object);
66    void AddSep(char *category);
67
68    void SetWorkWindow(MotifUI *obj);
69
70    BaseUI *PopupObject;
71    int PopupObjectUniqueID;
72
73    const UI_Class UIClass()            { return MAIN_WINDOW; }
74    const char *const UIClassName()     { return "MainWindow"; }
75
76 };
77
78 #endif /* MAINWINDOW_H */