comparison libinterp/corefcn/graphics.in.h @ 30999:fef2957c38ec

Deprecate uimenu properties "label" and "callback" (bug #62443) Replace "label" property with "text". Replace "callback" property with "menuselectedfcn". Both old properties are hidden, but continue to exist and work as before to support old code. * NEWS.8.md: Announce deprecation. * graphics.in.h (uimenu::BEGIN_PROPERTIES): Mark "callback" property with "hgs" for hidden, get, set routines. Mark "label" property with "hgs". * graphics.in.h (uimenu::get_callback, uimenu::set_callback): New functions which simply relay calls to "get_menuselectedfcn" and "set_menuselectedfcn". * Menu.cc (Menu::actionTriggered, Menu::actionHovered): Replace "callback" with "menuselectedfcn" in gh_callback_event calls. * __init_fltk__.cc (script_cb): Rename "execute_callback" to "execute_menuselectedfcn". * __init_fltk__.cc (update_menuselectedfcn): Rename function from "update_callback". Rename "get_callback" to "get_menuselectedfcn". * __init_fltk__.cc (add_to_uimenu): Rename "update_callback" to "update_menuselectedfcn". * __init_fltk__.cc (uimenu_update): Rename "ID_CALLBACK" to "ID_MENUSELECTEDFCN". * uimenu.m: Update documentation to use "menuselectedfcn" and "text". Update demos and BIST tests to use new property names. * __add_default_menu__.m: Update code to use "menuselectedfcn" and "text".
author Rik <rik@octave.org>
date Sat, 14 May 2022 19:06:56 -0700
parents 1212ed22f962
children cb9451780a15
comparison
equal deleted inserted replaced
30998:1bf26f913b9c 30999:fef2957c38ec
5791 // properties declarations. 5791 // properties declarations.
5792 // Programming note: Keep property list sorted if new ones are added. 5792 // Programming note: Keep property list sorted if new ones are added.
5793 5793
5794 BEGIN_PROPERTIES (uimenu) 5794 BEGIN_PROPERTIES (uimenu)
5795 string_property accelerator , "" 5795 string_property accelerator , ""
5796 callback_property callback , Matrix () 5796 // Deprecated in R2017b (replaced by "MenuSelectedFcn")
5797 callback_property callback hgs , Matrix ()
5797 bool_property checked , "off" 5798 bool_property checked , "off"
5798 bool_property enable , "on" 5799 bool_property enable , "on"
5799 color_property foregroundcolor , color_values (0, 0, 0) 5800 color_property foregroundcolor , color_values (0, 0, 0)
5800 string_property label gs , "" 5801 // Deprecated in R2017b (replaced by "Text")
5802 string_property label hgs , ""
5803 callback_property menuselectedfcn , Matrix ()
5804 // Deprecated in R2017b, but replacement of re-ordering "children"
5805 // property of parent does not work yet in Octave.
5801 double_property position , 0 5806 double_property position , 0
5802 bool_property separator , "off" 5807 bool_property separator , "off"
5803 string_property text , "" 5808 string_property text , ""
5804 5809
5805 // Octave-specific properties 5810 // Octave-specific properties
5806 string_property __fltk_label__ h , "" 5811 string_property __fltk_label__ h , ""
5807 any_property __object__ h , Matrix () 5812 any_property __object__ h , Matrix ()
5808 END_PROPERTIES 5813 END_PROPERTIES
5809 5814
5810 // Redirect calls from "Label" to "Text". 5815 // Make "Label" an alias for "Text".
5811 std::string get_label (void) const 5816 std::string get_label (void) const
5812 { 5817 {
5813 return get_text (); 5818 return get_text ();
5814 } 5819 }
5815 5820
5816 void set_label (const octave_value& val) 5821 void set_label (const octave_value& val)
5817 { 5822 {
5818 set_text (val); 5823 set_text (val);
5824 }
5825
5826 // Make "Callback" an alias for "MenuSelectedFcn".
5827 octave_value get_callback (void) const
5828 {
5829 return get_menuselectedfcn ();
5830 }
5831
5832 void set_callback (const octave_value& val)
5833 {
5834 set_menuselectedfcn (val);
5819 } 5835 }
5820 5836
5821 protected: 5837 protected:
5822 void init (void) 5838 void init (void)
5823 { 5839 {