@@ -209,7 +209,6 @@ Widget_Node::Widget_Node()
209209 for (int n=0 ; n<NUM_EXTRA_CODE; n++) {extra_code_[n] = nullptr ; }
210210 subclass_ = nullptr ;
211211 hotspot_ = 0 ;
212- tooltip_ = nullptr ;
213212 image_name_ = nullptr ;
214213 inactive_name_ = nullptr ;
215214 image = nullptr ;
@@ -234,7 +233,6 @@ Widget_Node::~Widget_Node() {
234233 win->redraw ();
235234 }
236235 if (subclass_) free ((void *)subclass_);
237- if (tooltip_) free ((void *)tooltip_);
238236 if (image_name_) {
239237 free ((void *)image_name_);
240238 if (image) image->dec_ref ();
@@ -258,9 +256,9 @@ void Widget_Node::subclass(const char *n) {
258256 redraw_browser ();
259257}
260258
261- void Widget_Node::tooltip (const char *n ) {
262- storestring (n, tooltip_) ;
263- o->tooltip (n );
259+ void Widget_Node::tooltip (std::string const & text ) {
260+ tooltip_ = text ;
261+ o->tooltip ( tooltip_. c_str () );
264262}
265263
266264void Widget_Node::image_name (const char *n) {
@@ -1483,7 +1481,7 @@ void Widget_Node::write_static(fld::io::Code_Writer& f) {
14831481 if (has_function (" static void" , buf))
14841482 write_extern_declaration = 0 ;
14851483 } else {
1486- if (has_toplevel_function (nullptr , buf))
1484+ if (has_toplevel_function (" " , buf))
14871485 write_extern_declaration = 0 ;
14881486 }
14891487 if (write_extern_declaration)
@@ -1723,23 +1721,23 @@ void Widget_Node::write_widget_code(fld::io::Code_Writer& f) {
17231721 Fl_Widget* tplate = ((Widget_Node*)factory)->o ;
17241722 const char *var = is_class () ? " this" : name () ? name () : " o" ;
17251723
1726- if (tooltip () && * tooltip ()) {
1724+ if (! tooltip (). empty ()) {
17271725 f.write_c (" %s%s->tooltip(" ,f.indent (), var);
17281726 switch (Fluid.proj .i18n .type ) {
17291727 case fld::I18n_Type::NONE : /* None */
1730- f.write_cstring (tooltip ());
1728+ f.write_cstring (tooltip (). c_str () );
17311729 break ;
17321730 case fld::I18n_Type::GNU : /* GNU gettext */
17331731 f.write_c (" %s(" , Fluid.proj .i18n .gnu_function .c_str ());
1734- f.write_cstring (tooltip ());
1732+ f.write_cstring (tooltip (). c_str () );
17351733 f.write_c (" )" );
17361734 break ;
17371735 case fld::I18n_Type::POSIX : /* POSIX catgets */
17381736 f.write_c (" catgets(%s,%s,%d," ,
17391737 Fluid.proj .i18n .posix_file .empty () ? " _catalog" : Fluid.proj .i18n .posix_file .c_str (),
17401738 Fluid.proj .i18n .posix_set .c_str (),
17411739 msgnum () + 1 );
1742- f.write_cstring (tooltip ());
1740+ f.write_cstring (tooltip (). c_str () );
17431741 f.write_c (" )" );
17441742 break ;
17451743 }
@@ -1944,9 +1942,9 @@ void Widget_Node::write_properties(fld::io::Project_Writer &f) {
19441942 case 1 : break ;
19451943 case 2 : f.write_string (" protected" ); break ;
19461944 }
1947- if (tooltip () && * tooltip ()) {
1945+ if (! tooltip (). empty ()) {
19481946 f.write_string (" tooltip" );
1949- f.write_word (tooltip ());
1947+ f.write_word (tooltip (). c_str () );
19501948 }
19511949 if (image_name () && *image_name ()) {
19521950 if (scale_image_w_ || scale_image_h_)
@@ -2417,7 +2415,7 @@ void Widget_Node::copy_properties() {
24172415 // copy all attributes common to all widget types
24182416 Fl_Widget *w = live_widget;
24192417 w->label (o->label ());
2420- w->tooltip ( tooltip ());
2418+ w->copy_tooltip ( tooltip (). c_str () );
24212419 w->type (o->type ());
24222420 w->box (o->box ());
24232421 w->color (o->color ());
0 commit comments