Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / programs / dtprintinfo / libUI / MotifUI / Button.h
1 /* $XConsortium: Button.h /main/3 1995/11/06 09:39:10 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 BUTTON_H
10 #define BUTTON_H
11
12 #include "MotifUI.h"
13
14 class Button : public MotifUI {
15
16  private:
17    
18    ButtonCallback _callback;
19    void * _callback_data;
20    static void ActivateCB(Widget, XtPointer, XtPointer);
21    ButtonType _button_type;
22    char *_iconFile;
23    void CreateButton(MotifUI *, char *, char *, ButtonType, ButtonCallback,
24                      void *, char *, char *, char *, char *);
25
26  public:
27
28    // If the callback_data is NULL, the this pointer will be the callback data
29    Button(MotifUI *parent,
30           char *name,
31           ButtonType button_type = PUSH_BUTTON,
32           ButtonCallback callback = NULL,
33           void * callback_data = NULL,
34           char *mnemonic = NULL,
35           char *acceleratorText = NULL, 
36           char *accelerator = NULL, 
37           char *iconFile = NULL);
38
39    Button(char *category,
40           MotifUI *parent,
41           char *name,
42           ButtonType button_type = PUSH_BUTTON,
43           ButtonCallback callback = NULL,
44           void * callback_data = NULL,
45           char *mnemonic = NULL,
46           char *acceleratorText = NULL, 
47           char *accelerator = NULL,
48           char *iconFile = NULL);
49
50    ~Button();
51
52    void Callback(ButtonCallback cb) { _callback = cb; }
53    void CallbackData(void *data)    { _callback_data = data; }
54    ButtonCallback Callback()        { return _callback; }
55    void * CallbackData()            { return _callback_data; }
56    const char *IconFile()           { return _iconFile; }
57    void IconFile(char *);
58
59    const UI_Class UIClass()         { return BUTTON; }
60    const int UISubClass()           { return _button_type; }
61    const char *const UIClassName()  { return "Button"; }
62 };
63
64 #endif /* BUTTON_H */