NEURON
symchoos.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1991 Stanford University
3  * Copyright (c) 1991 Silicon Graphics, Inc.
4  *
5  * Permission to use, copy, modify, distribute, and sell this software and
6  * its documentation for any purpose is hereby granted without fee, provided
7  * that (i) the above copyright notices and this permission notice appear in
8  * all copies of the software and related documentation, and (ii) the names of
9  * Stanford and Silicon Graphics may not be used in any advertising or
10  * publicity relating to the software without the specific, prior written
11  * permission of Stanford and Silicon Graphics.
12  *
13  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
14  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
15  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR
18  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
19  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
21  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
22  * OF THIS SOFTWARE.
23  */
24 
25 /* hacked by Michael Hines from fchooser.h */
26 /*
27  * SymChooser -- select a Symbol
28  */
29 
30 #ifndef symchooser_h
31 #define symchooser_h
32 
33 #include <InterViews/dialog.h>
34 #include <InterViews/resource.h>
35 
36 #include <InterViews/_enter.h>
37 
38 class SymChooser;
39 class SymChooserImpl;
40 class String;
41 class WidgetKit;
42 class SymDirectory;
43 
44 class SymChooserAction: public Resource {
45  protected:
47  virtual ~SymChooserAction();
48 
49  public:
50  virtual void execute(SymChooser*, bool accept);
51 };
52 
53 #if defined(__STDC__) || defined(__ANSI_CPP__)
54 #define SymChooserCallback(T) T##_SymChooserCallback
55 #define SymChooserMemberFunction(T) T##_SymChooserMemberFunction
56 #else
57 #define SymChooserCallback(T) T /**/ _SymChooserCallback
58 #define SymChooserMemberFunction(T) T /**/ _SymChooserMemberFunction
59 #endif
60 
61 #define declareSymChooserCallback(T) \
62  typedef void (T::*SymChooserMemberFunction(T))(SymChooser*, bool); \
63  class SymChooserCallback(T) \
64  : public SymChooserAction { \
65  public: \
66  SymChooserCallback(T)(T*, SymChooserMemberFunction(T)); \
67  virtual ~SymChooserCallback(T)(); \
68  \
69  virtual void execute(SymChooser*, bool accept); \
70  \
71  private: \
72  T* obj_; \
73  SymChooserMemberFunction(T) func_; \
74  };
75 
76 #define implementSymChooserCallback(T) \
77  SymChooserCallback(T)::SymChooserCallback(T)(T * obj, SymChooserMemberFunction(T) func) { \
78  obj_ = obj; \
79  func_ = func; \
80  } \
81  \
82  SymChooserCallback(T)::~SymChooserCallback(T)() {} \
83  \
84  void SymChooserCallback(T)::execute(SymChooser* f, bool accept) { \
85  (obj_->*func_)(f, accept); \
86  }
87 
88 class SymChooser: public Dialog {
89  public:
91  virtual ~SymChooser();
92 
93  virtual const String* selected() const;
94  virtual double* selected_var();
95  virtual int selected_vector_count();
96  virtual void reread();
97  virtual void dismiss(bool);
98 
99  private:
100  SymChooserImpl* impl_;
101 };
102 
103 #include <InterViews/_leave.h>
104 
105 #endif
#define Style
Definition: _defines.h:281
#define Dialog
Definition: _defines.h:94
#define WidgetKit
Definition: _defines.h:331
Definition: string.h:34
virtual void execute(SymChooser *, bool accept)
virtual ~SymChooserAction()
virtual void reread()
virtual void dismiss(bool)
virtual ~SymChooser()
virtual double * selected_var()
SymChooserImpl * impl_
Definition: symchoos.h:100
virtual const String * selected() const
virtual int selected_vector_count()
SymChooser(SymDirectory *, WidgetKit *, Style *, SymChooserAction *=NULL, int nbrowser=3)
#define NULL
Definition: sptree.h:16