Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtprintinfo / libUI / MotifUI / Button.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: Button.h /main/3 1995/11/06 09:39:10 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 BUTTON_H
32 #define BUTTON_H
33
34 #include "MotifUI.h"
35
36 class Button : public MotifUI {
37
38  private:
39    
40    ButtonCallback _callback;
41    void * _callback_data;
42    static void ActivateCB(Widget, XtPointer, XtPointer);
43    ButtonType _button_type;
44    char *_iconFile;
45    void CreateButton(MotifUI *, char *, char *, ButtonType, ButtonCallback,
46                      void *, char *, char *, char *, char *);
47
48  public:
49
50    // If the callback_data is NULL, the this pointer will be the callback data
51    Button(MotifUI *parent,
52           char *name,
53           ButtonType button_type = PUSH_BUTTON,
54           ButtonCallback callback = NULL,
55           void * callback_data = NULL,
56           char *mnemonic = NULL,
57           char *acceleratorText = NULL, 
58           char *accelerator = NULL, 
59           char *iconFile = NULL);
60
61    Button(char *category,
62           MotifUI *parent,
63           char *name,
64           ButtonType button_type = PUSH_BUTTON,
65           ButtonCallback callback = NULL,
66           void * callback_data = NULL,
67           char *mnemonic = NULL,
68           char *acceleratorText = NULL, 
69           char *accelerator = NULL,
70           char *iconFile = NULL);
71
72    ~Button();
73
74    void Callback(ButtonCallback cb) { _callback = cb; }
75    void CallbackData(void *data)    { _callback_data = data; }
76    ButtonCallback Callback()        { return _callback; }
77    void * CallbackData()            { return _callback_data; }
78    const char *IconFile()           { return _iconFile; }
79    void IconFile(char *);
80
81    const UI_Class UIClass()         { return BUTTON; }
82    const int UISubClass()           { return _button_type; }
83    const char *const UIClassName()  { return "Button"; }
84 };
85
86 #endif /* BUTTON_H */