31005
|
1 ######################################################################## |
|
2 ## |
|
3 ## Copyright (C) 2022 The Octave Project Developers |
|
4 ## |
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
|
6 ## distribution or <https://octave.org/copyright/>. |
|
7 ## |
|
8 ## This file is part of Octave. |
|
9 ## |
|
10 ## Octave is free software: you can redistribute it and/or modify it |
|
11 ## under the terms of the GNU General Public License as published by |
|
12 ## the Free Software Foundation, either version 3 of the License, or |
|
13 ## (at your option) any later version. |
|
14 ## |
|
15 ## Octave is distributed in the hope that it will be useful, but |
|
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 ## GNU General Public License for more details. |
|
19 ## |
|
20 ## You should have received a copy of the GNU General Public License |
|
21 ## along with Octave; see the file COPYING. If not, see |
|
22 ## <https://www.gnu.org/licenses/>. |
|
23 ## |
|
24 ######################################################################## |
|
25 |
|
26 ## -*- texinfo -*- |
|
27 ## @deftypefn {} {@var{h} =} uifigure () |
|
28 ## @deftypefnx {} {@var{h} =} uifigure ("@var{property}", @var{value}, @dots{}) |
|
29 ## Create a new figure window for applications. |
|
30 ## |
|
31 ## Multiple property-value pairs may be specified for the figure object, but |
|
32 ## they must occur in pairs. |
|
33 ## |
|
34 ## The return value @var{h} is a graphics handle to the created figure object. |
|
35 ## |
|
36 ## Programming Note: The full list of properties is documented at |
|
37 ## @ref{Figure Properties}. This function differs from @code{figure} in that |
|
38 ## the created figure is optimized for application development, rather than |
|
39 ## plotting. This means features such as menubars and toolbars are turned off. |
|
40 ## @seealso{uipanel, uibuttongroup} |
|
41 ## @end deftypefn |
|
42 |
|
43 ## FIXME: This is not a perfect replica of a Matlab uifigure object because |
|
44 ## some ordinary figure object properties are exposed (e.g., the "PaperXXX" |
|
45 ## properties). In addition, the following properties are missing: |
|
46 ## "AutoResizeChildren", "Icon", "Scrollable". |
|
47 |
|
48 function h = uifigure (varargin) |
|
49 |
|
50 if (mod (nargin, 2) != 0) |
|
51 error ("uifigure: PROPERTY/VALUE parameters must occur in pairs"); |
|
52 endif |
|
53 |
|
54 h = __go_figure__ (NaN, "handlevisibility", "off", |
|
55 "numbertitle", "off", "integerhandle", "off", |
|
56 "menubar", "none", "toolbar", "none", |
|
57 varargin{:}); |
|
58 |
|
59 endfunction |
|
60 |
|
61 |
|
62 %!test |
|
63 %! hf = uifigure ("visible", "off"); |
|
64 %! unwind_protect |
|
65 %! assert (isfigure (hf)); |
|
66 %! assert (get (hf, {"numbertitle", "menubar"}), {"off", "none"}); |
|
67 %! unwind_protect_cleanup |
|
68 %! close (hf); |
|
69 %! end_unwind_protect |
|
70 |
|
71 %!error <parameters must occur in pairs> uifigure ("PROP1") |