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 public:
49  virtual void execute(SymChooser*, bool accept);
50 };
51 
52 #if defined(__STDC__) || defined(__ANSI_CPP__)
53 #define SymChooserCallback(T) T##_SymChooserCallback
54 #define SymChooserMemberFunction(T) T##_SymChooserMemberFunction
55 #else
56 #define SymChooserCallback(T) T/**/_SymChooserCallback
57 #define SymChooserMemberFunction(T) T/**/_SymChooserMemberFunction
58 #endif
59 
60 #define declareSymChooserCallback(T) \
61 typedef void (T::*SymChooserMemberFunction(T))(SymChooser*, bool); \
62 class SymChooserCallback(T) : public SymChooserAction { \
63 public: \
64  SymChooserCallback(T)(T*, SymChooserMemberFunction(T)); \
65  virtual ~SymChooserCallback(T)(); \
66 \
67  virtual void execute(SymChooser*, bool accept); \
68 private: \
69  T* obj_; \
70  SymChooserMemberFunction(T) func_; \
71 };
72 
73 #define implementSymChooserCallback(T) \
74 SymChooserCallback(T)::SymChooserCallback(T)( \
75  T* obj, SymChooserMemberFunction(T) func \
76 ) { \
77  obj_ = obj; \
78  func_ = func; \
79 } \
80 \
81 SymChooserCallback(T)::~SymChooserCallback(T)() { } \
82 \
83 void SymChooserCallback(T)::execute(SymChooser* f, bool accept) { \
84  (obj_->*func_)(f, accept); \
85 }
86 
87 class SymChooser : public Dialog {
88 public:
89  SymChooser(
90  SymDirectory*, WidgetKit*, Style*, SymChooserAction* = NULL, int nbrowser = 3
91  );
92  virtual ~SymChooser();
93 
94  virtual const String* selected() const;
95  virtual double* selected_var();
96  virtual int selected_vector_count();
97  virtual void reread();
98  virtual void dismiss(bool);
99 private:
100  SymChooserImpl* impl_;
101 };
102 
103 #include <InterViews/_leave.h>
104 
105 #endif
#define WidgetKit
Definition: _defines.h:331
SymChooserImpl * impl_
Definition: symchoos.h:100
#define Dialog
Definition: _defines.h:94
virtual ~SymChooserAction()
virtual void execute(SymChooser *, bool accept)
Definition: string.h:34
#define Style
Definition: _defines.h:281
return NULL
Definition: cabcode.cpp:461