# HG changeset patch
# User Kai Habel
# Date 1285308269 -7200
# Node ID a02a47f866d55e5d3cd543471c7b019d95f52a68
# Parent 0c752b657217eb630da8fd48ff093a83c4c470c4
[mq]: uimenu.go
diff -r 0c752b657217 -r a02a47f866d5 NEWS
--- a/NEWS Thu Sep 23 14:55:53 2010 -0400
+++ b/NEWS Fri Sep 24 08:04:29 2010 +0200
@@ -320,8 +320,8 @@
bitpack fileread merge ppint sizemax
bitunpack fminbnd nfields ppjumps strread
blkmm fskipl nth_element pqpnonneg textread
- cbrt ifelse onCleanup randi whitebg
- chop ishermitian pbaspect repelems
+ cbrt ifelse onCleanup randi uimenu
+ chop ishermitian pbaspect repelems whitebg
daspect isindex powerset reset
** The behavior of struct assignments to non-struct values has been changed.
diff -r 0c752b657217 -r a02a47f866d5 scripts/ChangeLog
--- a/scripts/ChangeLog Thu Sep 23 14:55:53 2010 -0400
+++ b/scripts/ChangeLog Fri Sep 24 08:04:29 2010 +0200
@@ -1,3 +1,8 @@
+2010-09-24 Kai Habel
+ * plot/uimenu.m: New function
+ * plot/__go_draw_figure__.m: Ignore uimenu objects for gnuplot
+ backend
+
2010-09-23 John W. Eaton
* miscellaneous/bug_report.m: Display information about how to
diff -r 0c752b657217 -r a02a47f866d5 scripts/plot/__go_draw_figure__.m
--- a/scripts/plot/__go_draw_figure__.m Thu Sep 23 14:55:53 2010 -0400
+++ b/scripts/plot/__go_draw_figure__.m Fri Sep 24 08:04:29 2010 +0200
@@ -95,6 +95,7 @@
fputs (plot_stream, "unset obj 2\n");
endif
end_unwind_protect
+ case "uimenu"
otherwise
error ("__go_draw_figure__: unknown object class, %s", type);
endswitch
diff -r 0c752b657217 -r a02a47f866d5 scripts/plot/uimenu.m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/plot/uimenu.m Fri Sep 24 08:04:29 2010 +0200
@@ -0,0 +1,54 @@
+## Copyright (C) 2010 Kai Habel
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING. If not, see
+## .
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} uimenu (@var{property}, @var{value}, @dots{})
+## @deftypefnx {Function File} {} uimenu (@var{h}, @var{property}, @var{value}, @dots{})
+## Create an uimenu object and return a handle to it.
+## @end deftypefn
+
+## Author: Kai Habel
+
+function hui = uimenu (varargin)
+
+ args = varargin;
+ if (nargin == 0)
+ h = gcf();
+ elseif (nargin == 1)
+ if (ishandle(args{1}))
+ h = args{1};
+ args(1) = [];
+ else
+ error("expected handle as first argument");
+ endif
+ else
+ if (ishandle(args{1}))
+ h = args{1};
+ args(1) = [];
+ else
+ h = gcf();
+ endif
+ endif
+
+ tmp = __go_uimenu__ (h, args{:});
+
+ if (nargout > 0)
+ hui = tmp;
+ endif
+
+endfunction
diff -r 0c752b657217 -r a02a47f866d5 src/ChangeLog
--- a/src/ChangeLog Thu Sep 23 14:55:53 2010 -0400
+++ b/src/ChangeLog Fri Sep 24 08:04:29 2010 +0200
@@ -1,3 +1,13 @@
+2010-09-24 Kai Habel
+ * gl-render.cc (opengl_renderer::draw ): Ignore uimenu objects here.
+ * graphics.h.in (class OCTINTERP_API uimenu): New graphics object.
+ * graphics.cc (lookup_object_name): Add uimenu here.
+ (make_graphics_object_from_type): Likewise.
+ (property_list::set): Likewise.
+ (property_list::lookup): Likewise.
+ (root_figure::init_factory_properties): Likewise.
+ (__go_uimenu__): New function.
+
2010-09-23 John W. Eaton
* Makefile.am (ALL_DEF_FILES): New variable.
diff -r 0c752b657217 -r a02a47f866d5 src/gl-render.cc
--- a/src/gl-render.cc Thu Sep 23 14:55:53 2010 -0400
+++ b/src/gl-render.cc Fri Sep 24 08:04:29 2010 +0200
@@ -554,6 +554,8 @@
draw_text (dynamic_cast (props));
else if (go.isa ("image"))
draw_image (dynamic_cast (props));
+ else if (go.isa ("uimenu"))
+ ;
else
warning ("opengl_renderer: cannot render object of type `%s'",
props.graphics_object_name ().c_str ());
diff -r 0c752b657217 -r a02a47f866d5 src/graphics.cc
--- a/src/graphics.cc Thu Sep 23 14:55:53 2010 -0400
+++ b/src/graphics.cc Fri Sep 24 08:04:29 2010 +0200
@@ -727,7 +727,7 @@
{
pfx = name.substr (0, 6);
- if (pfx.compare ("figure"))
+ if (pfx.compare ("figure") || pfx.compare ("uimenu"))
offset = 6;
else if (len >= 7)
{
@@ -773,7 +773,8 @@
go = new surface (h, p);
else if (type.compare ("hggroup"))
go = new hggroup (h, p);
-
+ else if (type.compare ("uimenu"))
+ go = new uimenu (h, p);
return go;
}
@@ -1416,7 +1417,7 @@
{
pfx = name.substr (0, 6);
- if (pfx.compare ("figure"))
+ if (pfx.compare ("figure") || pfx.compare ("uimenu"))
offset = 6;
else if (len > 7)
{
@@ -1454,6 +1455,8 @@
has_property = surface::properties::has_core_property (pname);
else if (pfx == "hggroup")
has_property = hggroup::properties::has_core_property (pname);
+ else if (pfx == "uimenu")
+ has_property = uimenu::properties::has_core_property (pname);
if (has_property)
{
@@ -1512,7 +1515,7 @@
{
pfx = name.substr (0, 6);
- if (pfx.compare ("figure"))
+ if (pfx.compare ("figure") || pfx.compare ("uimenu"))
offset = 6;
else if (len > 7)
{
@@ -5456,6 +5459,7 @@
plist_map["patch"] = patch::properties::factory_defaults ();
plist_map["surface"] = surface::properties::factory_defaults ();
plist_map["hggroup"] = hggroup::properties::factory_defaults ();
+ plist_map["uimenu"] = uimenu::properties::factory_defaults ();
return plist_map;
}
@@ -6027,6 +6031,15 @@
GO_BODY (hggroup);
}
+DEFUN (__go_uimenu__, args, ,
+ "-*- texinfo -*-\n\
address@hidden {Built-in Function} {} __go_uimenu__ (@var{parent})\n\
+Undocumented internal function.\n\
address@hidden deftypefn")
+{
+ GO_BODY (uimenu);
+}
+
DEFUN (__go_delete__, args, ,
"-*- texinfo -*-\n\
@deftypefn {Built-in Function} {} __go_delete__ (@var{h})\n\
diff -r 0c752b657217 -r a02a47f866d5 src/graphics.h.in
--- a/src/graphics.h.in Thu Sep 23 14:55:53 2010 -0400
+++ b/src/graphics.h.in Fri Sep 24 08:04:29 2010 +0200
@@ -3869,6 +3869,63 @@
// ---------------------------------------------------------------------
+class OCTINTERP_API uimenu : public base_graphics_object
+{
+public:
+ class OCTINTERP_API properties : public base_properties
+ {
+ public:
+ void remove_child (const graphics_handle& h)
+ {
+ base_properties::remove_child (h);
+ }
+
+ void adopt (const graphics_handle& h)
+ {
+ base_properties::adopt (h);
+ }
+
+ // See the genprops.awk script for an explanation of the
+ // properties declarations.
+
+ BEGIN_PROPERTIES (uimenu)
+ string_property accelerator , ""
+ callback_property callback , Matrix()
+ bool_property checked , "off"
+ bool_property enable , "on"
+ color_property foregroundcolor , color_values (0, 0, 0)
+ string_property label , ""
+ double_property position , 9
+ bool_property separator , "off"
+ END_PROPERTIES
+
+ protected:
+ void init (void)
+ { }
+ };
+
+private:
+ properties xproperties;
+
+public:
+ uimenu (const graphics_handle& mh, const graphics_handle& p)
+ : base_graphics_object (), xproperties (mh, p)
+ {
+ xproperties.override_defaults (*this);
+ }
+
+ ~uimenu (void) { xproperties.delete_children (); }
+
+ base_properties& get_properties (void) { return xproperties; }
+
+ const base_properties& get_properties (void) const { return xproperties; }
+
+ bool valid_object (void) const { return true; }
+
+};
+
+// ---------------------------------------------------------------------
+
octave_value
get_property_from_handle (double handle, const std::string &property,
const std::string &func);