casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DParameterButton.h
Go to the documentation of this file.
1 //# DParameterButton.h: class to package interface to button autoguis.
2 //# Copyright (C) 2000,2002
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef TRIALDISPLAY_DPARAMETERBUTTON_H
29 #define TRIALDISPLAY_DPARAMETERBUTTON_H
30 
31 #include <casa/aips.h>
33 
34 namespace casa { //# NAMESPACE CASA - BEGIN
35 
36 // <summary>
37 // Implementation of DisplayParameter to package interface to button autoguis.
38 // </summary>
39 
40 // <use visibility=export>
41 
42 // <reviewed reviewer="" date="" test="" demos="">
43 // </reviewed>
44 
45 // <prerequisite>
46 // <li> <linkto class=DisplayParameter>DisplayParameter</linkto>
47 // </prerequisite>
48 
49 // <etymology>
50 // DParameterButton is an implementation of a DisplayParameter for Buttons.
51 // It defines the necessary information to define a button in autogui.g,
52 // and packages it into the parameter record field autogui requires.
53 //
54 // </etymology>
55 
56 // <synopsis>
57 // This class is derived from <linkto
58 // class=DisplayParameter>DisplayParameter</linkto>
59 // It holds the meta-information neccessary to define a button widget,
60 // packaging it into the 'parameter record' field required by autogui.g.
61 // It can determine whether the button was pressed.
62 // The 'value' has no meaning here (it will be true).
63 // </synopsis>
64 
65 // <example>
66 
67 // <srcblock>
68 // DParameterButton pbtn("unique_btn_id", "Label Beside Button",
69 // "Text on Button", "Help Message for Button");
70 //
71 // casacore::Record rec; // (usually within 'getoptions()')
72 // pstring.toRecord(rec); // rec is returned to autogui.g
73 // // to define the button.
74 //
75 // // ...when inRec is received recording user gui updates
76 // // (usually within 'setOptions()'):
77 //
78 // if(pbtn.fromRecord(inRec)) /* button was pressed; respond */ ;
79 //
80 // </srcblock>
81 // </example>
82 
83 // <motivation>
84 // Allows buttons to be defined using the same compact DParameter
85 // interface used for other autogui widgets.
86 // </motivation>
87 
88 // <thrown>
89 // <li> None.
90 // </thrown>
91 
93 
94  public:
95 
96  // Constructor taking the name (id) of the button, a label which will
97  // appear beside the button, and the text which will appear on the button.
98  // Optionally, popup help text, 'context' string, and a flag indicating
99  // whether the button is enabled (disable is not fully supported yet).
100  // The context string determines which autogui rollup the button will
101  // appear in (replace spaces with underscores in this string).
103  const casacore::String text, const casacore::String help="",
104  const casacore::String context="", const casacore::Bool editable=true);
105 
106  // copy constructor.
107  DParameterButton(const DParameterButton &other);
108 
109  // Destructor.
110  virtual ~DParameterButton();
111 
112  // copy assignment.
114 
115  // Determine whether the record (passed originally from autogui.g)
116  // indicates that the button was pressed.
117  virtual casacore::Bool fromRecord(const casacore::RecordInterface &record);
118 
119  // Place a record describing this button in a sub-field of
120  // <src>record</src> with name matching that of this parameter. If
121  // <src>overwrite</src> is <src>true</src>, then any existing field
122  // with matching name will be overwritten. If <src>fullrecord</src>
123  // is <src>true</src>, then a complete description of the parameter
124  // is given, otherwise just its current value is stored in
125  // <src>record</src>. (At present, <src>fullrecord</src> is ignored;
126  // the full record is always returned).
127  virtual void toRecord(casacore::RecordInterface &record, const casacore::Bool fullrecord = true,
128  const casacore::Bool overwrite = false);
129 
130  private:
131 
132  // default constructor disabled--do not use.
134 
135  // Store for the text on the button.
137 
138  };
139 
140 
141 } //# NAMESPACE CASA - END
142 
143 #endif
DParameterButton & operator=(const DParameterButton &other)
copy assignment.
Implementation of DisplayParameter to package interface to button autoguis.
casacore::String name() const
Return the name of this parameter.
casacore::String help() const
Return the help for this parameter.
virtual void toRecord(casacore::RecordInterface &record, const casacore::Bool fullrecord=true, const casacore::Bool overwrite=false)
Place a record describing this button in a sub-field of record with name matching that of this parame...
casacore::String itsText
Store for the text on the button.
casacore::String description() const
Return the description of this parameter.
casacore::Bool editable() const
Return whether this parameter is editable.
DParameterButton()
default constructor disabled–do not use.
casacore::String context() const
Return the context of this parameter.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual ~DParameterButton()
Destructor.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
Abstract base class for Record classes.
virtual casacore::Bool fromRecord(const casacore::RecordInterface &record)
Determine whether the record (passed originally from autogui.g) indicates that the button was pressed...
Base class for storing and parsing of parameters for display classes.