6257
|
1 ## Copyright (C) 2005 John W. Eaton |
|
2 ## |
|
3 ## This file is part of Octave. |
|
4 ## |
|
5 ## Octave is free software; you can redistribute it and/or modify it |
|
6 ## under the terms of the GNU General Public License as published by |
|
7 ## the Free Software Foundation; either version 2, or (at your option) |
|
8 ## any later version. |
|
9 ## |
|
10 ## Octave is distributed in the hope that it will be useful, but |
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 ## General Public License for more details. |
|
14 ## |
|
15 ## You should have received a copy of the GNU General Public License |
|
16 ## along with Octave; see the file COPYING. If not, write to the Free |
|
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 ## 02110-1301, USA. |
|
19 |
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {@var{s}} __uiobject_axes_setr__ (@var{p}, @var{v}, @dots{})) |
|
22 ## Set properties for axes objects. |
|
23 ## @end deftypefn |
|
24 |
|
25 ## Author: jwe |
|
26 |
|
27 function obj = __uiobject_axes_setr__ (h, varargin) |
|
28 |
|
29 obj = get (h); |
|
30 |
|
31 if (rem (nargin-1, 2) == 0) |
|
32 if (isstruct (obj)) |
|
33 for i = 1:2:nargin-1 |
|
34 property = varargin{i}; |
|
35 if (ischar (property)) |
|
36 key = tolower (property); |
|
37 if (isfield (obj, key)) |
|
38 val = varargin{i+1}; |
|
39 if (isfield (obj, "__validators__")) |
|
40 validators = obj.__validators__; |
|
41 if (isfield (validators, key)) |
|
42 feval (validators.(key), val); |
|
43 endif |
|
44 endif |
|
45 switch (key) |
|
46 case {"title", "xlabel", "ylabel", "zlabel"} |
|
47 val = __uiobject_text_ctor__ (h, "string", val); |
|
48 |
|
49 case {"xlim", "ylim", "zlim"} |
|
50 obj.(strcat (key, "mode")) = "manual"; |
|
51 |
|
52 case "dataaspectratio" |
|
53 obj.dataaspectratiomode = "manual"; |
|
54 |
|
55 case {"xtick", "ytick", "ztick"} |
|
56 obj.(strcat (key, "mode")) = "manual"; |
|
57 |
|
58 case {"xticklabel", "yticklabel", "zticklabel"} |
|
59 obj.(strcat (key, "mode")) = "manual"; |
|
60 |
|
61 endswitch |
|
62 obj.(key) = val; |
|
63 else |
|
64 warning ("set: unrecognized property `%s' for uiobject `%s'", |
|
65 property, obj.type); |
|
66 endif |
|
67 else |
|
68 error ("set: expecting property name to be a character string"); |
|
69 endif |
|
70 endfor |
|
71 else |
|
72 error ("__uiobject_axes_setr__: expecting axes object as first arg"); |
|
73 endif |
|
74 else |
|
75 print_usage (); |
|
76 endif |
|
77 |
|
78 endfunction |