tomwalters@0
|
1 % method of class @parameter
|
tomwalters@0
|
2 %
|
tomwalters@0
|
3 % (c) 2003-2008, University of Cambridge
|
tomwalters@0
|
4 % Maintained by Tom Walters (tcw24@cam.ac.uk), written by Stefan Bleeck (stefan@bleeck.de)
|
tomwalters@0
|
5 % http://www.pdn.cam.ac.uk/cnbh/aim2006/tools/parameter
|
tomwalters@0
|
6 % $Date: 2008-06-10 18:00:16 +0100 (Tue, 10 Jun 2008) $
|
tomwalters@0
|
7 function dstr=parameter(inp,mode,position)
|
tomwalters@0
|
8 % class parameter
|
tomwalters@0
|
9
|
tomwalters@0
|
10
|
tomwalters@0
|
11 if nargin<1
|
tomwalters@0
|
12 param.name='data structure';
|
tomwalters@0
|
13 param.entries=[];
|
tomwalters@0
|
14 else
|
tomwalters@0
|
15 if isobject(inp)
|
tomwalters@0
|
16 param=inp;
|
tomwalters@0
|
17 else
|
tomwalters@0
|
18 if isstr(inp)
|
tomwalters@0
|
19 param.name=inp;
|
tomwalters@0
|
20 param.entries=[];
|
tomwalters@0
|
21 else
|
tomwalters@0
|
22 error('data structure must be called with a name');
|
tomwalters@0
|
23 end
|
tomwalters@0
|
24 end
|
tomwalters@0
|
25 end
|
tomwalters@0
|
26
|
tomwalters@0
|
27
|
tomwalters@0
|
28
|
tomwalters@0
|
29 % protected variables (only accessible through set/get)
|
tomwalters@0
|
30
|
tomwalters@0
|
31 % version number.
|
tomwalters@0
|
32 % Version 1.0: basic functionallity works
|
tomwalters@0
|
33 param.version='1.0';
|
tomwalters@0
|
34
|
tomwalters@0
|
35
|
tomwalters@0
|
36 % these values are used when a gui is used
|
tomwalters@0
|
37 % that one is the default value that is given back when the gui is closed
|
tomwalters@0
|
38 param.default_value='';
|
tomwalters@0
|
39
|
tomwalters@0
|
40 % that one defines whether the gui is modal or not
|
tomwalters@0
|
41 if nargin < 2
|
tomwalters@0
|
42 param.mode='nonmodal';
|
tomwalters@0
|
43 else
|
tomwalters@0
|
44 if strcmp(mode,'modal') || strcmp(mode,'nonmodal')
|
tomwalters@0
|
45 param.mode=mode;
|
tomwalters@0
|
46 else
|
tomwalters@0
|
47 disp('mode not recognised');
|
tomwalters@0
|
48 param.mode='nonmodal';
|
tomwalters@0
|
49 end
|
tomwalters@0
|
50 end
|
tomwalters@0
|
51 % data that the user can use to shift it between gui and application:
|
tomwalters@0
|
52 param.userdata=[];
|
tomwalters@0
|
53
|
tomwalters@0
|
54 % north - top center edge of screen
|
tomwalters@0
|
55 % south - bottom center edge of screen
|
tomwalters@0
|
56 % east - right center edge of screen
|
tomwalters@0
|
57 % west - left center edge of screen
|
tomwalters@0
|
58 % northeast - top right corner of screen
|
tomwalters@0
|
59 % northwest - top left corner of screen
|
tomwalters@0
|
60 % southeast - bottom right corner of screen
|
tomwalters@0
|
61 % southwest - bottom left corner
|
tomwalters@0
|
62 % center - center of screen
|
tomwalters@0
|
63 % onscreen - nearest location with respect to current location that is on
|
tomwalters@0
|
64 % screen The position argument can also be a two-element vector [h,v], where depending on sign, h specifies the
|
tomwalters@0
|
65 % the default position of the gui is in the top right corner
|
tomwalters@0
|
66 if nargin <3
|
tomwalters@0
|
67 param.position='center';
|
tomwalters@0
|
68 else
|
tomwalters@0
|
69 if strcmp(position,'north') || strcmp(position,'south') || strcmp(position,'west') || strcmp(position,'east') || strcmp(position,'northeast') || strcmp(position,'northwest') || strcmp(position,'southeast') || strcmp(position,'southwest') || strcmp(position,'center') || strcmp(position,'onscreen')
|
tomwalters@0
|
70 param.position=position;
|
tomwalters@0
|
71 elseif size(position)==2
|
tomwalters@0
|
72 param.position=position;
|
tomwalters@0
|
73 else
|
tomwalters@0
|
74 disp('position not reconised');
|
tomwalters@0
|
75 param.position='center';
|
tomwalters@0
|
76 end
|
tomwalters@0
|
77 end
|
tomwalters@0
|
78
|
tomwalters@0
|
79 % where the focus is directly after calling
|
tomwalters@0
|
80 param.firstfocus='';
|
tomwalters@0
|
81
|
tomwalters@0
|
82 % diosplayed when with the mouse over it
|
tomwalters@0
|
83 param.tooltiptext='';
|
tomwalters@0
|
84
|
tomwalters@0
|
85
|
tomwalters@0
|
86 % a couple of informations that are used during installations (private
|
tomwalters@0
|
87 % variables
|
tomwalters@0
|
88 param.panelinfo=[];
|
tomwalters@0
|
89
|
tomwalters@0
|
90 dstr=class(param,'parameter');
|
tomwalters@0
|
91
|
tomwalters@0
|
92
|
tomwalters@0
|
93
|