From a42ded75e297cedfcb448537e77d13350df0fe92 Mon Sep 17 00:00:00 2001
From: Michael R Sweet
Date: Tue, 23 Nov 2004 19:47:52 +0000
Subject: Added the 2.0 Fl_Widget::copy_label() method to allow FLTK 1.x
applications to have their label strings managed by FLTK (STR #630)
Added Fl::delete_widget() method to safely delete widgets in
callback methods (STR #629)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3917 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
---
CHANGES | 5 +++++
FL/Fl.H | 8 ++++++--
FL/Fl_Widget.H | 9 +++++----
documentation/Fl.html | 11 ++++++++++
documentation/Fl_Widget.html | 16 +++++++++++++--
documentation/common.html | 11 +++++++++-
documentation/index.html | 6 +++---
documentation/preface.html | 6 +++---
src/Fl.cxx | 48 ++++++++++++++++++++++++++++++++++++++++++--
src/Fl_Widget.cxx | 26 ++++++++++++++++++++++--
10 files changed, 127 insertions(+), 19 deletions(-)
diff --git a/CHANGES b/CHANGES
index 45a7fce3a..1d8251b35 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,11 @@
CHANGES IN FLTK 1.1.6
- Documentation updates (STR #552, STR #608)
+ - Added the 2.0 Fl_Widget::copy_label() method to
+ allow FLTK 1.x applications to have their label
+ strings managed by FLTK (STR #630)
+ - Added Fl::delete_widget() method to safely delete
+ widgets in callback methods (STR #629)
- Fl_Widget::damage(uchar,int,int,int,int) didn't clip
the bounding box properly (STR #626)
- Windows could appear on the wrong screen on OSX (STR
diff --git a/FL/Fl.H b/FL/Fl.H
index d0f65683c..9971de1de 100644
--- a/FL/Fl.H
+++ b/FL/Fl.H
@@ -1,5 +1,5 @@
//
-// "$Id: Fl.H,v 1.8.2.11.2.23 2004/04/11 04:38:53 easysw Exp $"
+// "$Id: Fl.H,v 1.8.2.11.2.24 2004/11/23 19:47:50 easysw Exp $"
//
// Main header file for the Fast Light Tool Kit (FLTK).
//
@@ -257,10 +257,14 @@ public:
static void unlock();
static void awake(void* message = 0);
static void* thread_message();
+
+ // Widget deletion:
+ static void delete_widget(Fl_Widget *w);
+ static void do_widget_deletion();
};
#endif // !Fl_H
//
-// End of "$Id: Fl.H,v 1.8.2.11.2.23 2004/04/11 04:38:53 easysw Exp $".
+// End of "$Id: Fl.H,v 1.8.2.11.2.24 2004/11/23 19:47:50 easysw Exp $".
//
diff --git a/FL/Fl_Widget.H b/FL/Fl_Widget.H
index 7fed7af76..e33e1d47d 100644
--- a/FL/Fl_Widget.H
+++ b/FL/Fl_Widget.H
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Widget.H,v 1.6.2.4.2.25 2004/09/24 16:00:08 easysw Exp $"
+// "$Id: Fl_Widget.H,v 1.6.2.4.2.26 2004/11/23 19:47:50 easysw Exp $"
//
// Widget header file for the Fast Light Tool Kit (FLTK).
//
@@ -90,7 +90,7 @@ protected:
void set_flag(int c) {flags_ |= c;}
void clear_flag(int c) {flags_ &= ~c;}
enum {INACTIVE=1, INVISIBLE=2, OUTPUT=4, SHORTCUT_LABEL=64,
- CHANGED=128, VISIBLE_FOCUS=512};
+ CHANGED=128, VISIBLE_FOCUS=512, COPIED_LABEL = 1024};
void draw_box() const;
void draw_box(Fl_Boxtype, Fl_Color) const;
@@ -131,7 +131,8 @@ public:
void selection_color(unsigned a) {color2_ = a;}
void color(unsigned a, unsigned b) {color_=a; color2_=b;}
const char* label() const {return label_.value;}
- void label(const char* a) {label_.value=a; redraw_label();}
+ void label(const char* a);
+ void copy_label(const char* a);
void label(Fl_Labeltype a,const char* b) {label_.type = a; label_.value = b;}
Fl_Labeltype labeltype() const {return (Fl_Labeltype)label_.type;}
void labeltype(Fl_Labeltype a) {label_.type = a;}
@@ -217,5 +218,5 @@ public:
#endif
//
-// End of "$Id: Fl_Widget.H,v 1.6.2.4.2.25 2004/09/24 16:00:08 easysw Exp $".
+// End of "$Id: Fl_Widget.H,v 1.6.2.4.2.26 2004/11/23 19:47:50 easysw Exp $".
//
diff --git a/documentation/Fl.html b/documentation/Fl.html
index 5e34d8394..96791f3d3 100644
--- a/documentation/Fl.html
+++ b/documentation/Fl.html
@@ -49,6 +49,7 @@ state information and global methods for the current application.
copy
damage
default_atclose
+ delete_widget
display
dnd
dnd_text_ops
@@ -491,6 +492,16 @@ void damage(int x);
+This is the default callback for window widgets. It hides the
+window and then calls the default widget callback.
+
+
+
+Schedules a widget for deletion when it is safe to do so. Use
+this method to delete a widget inside a callback function. When
+deleting groups or windows, you must only delete the group or
+window widget and not the individual child widgets.
+
Sets the X display to use for all windows. Actually this just sets
diff --git a/documentation/Fl_Widget.html b/documentation/Fl_Widget.html
index f7e0e09e5..179693959 100644
--- a/documentation/Fl_Widget.html
+++ b/documentation/Fl_Widget.html
@@ -53,6 +53,7 @@ to call redraw() after these.
+- labelcolor
- labelfont
- labelsize
- labeltype
@@ -258,6 +259,14 @@ method for more information.
equal to this widget. Returns 0 if b is NULL.
+
+
+Sets the current label. Unlike label(), this method
+allocates a copy of the label string instead of using the
+original string pointer.
+
+
@@ -329,7 +338,10 @@ equal to a. Returns 0 if a is NULL.
somewhere on or next to the widget. The passed pointer is stored
unchanged in the widget (the string is not copied), so if
you need to set the label to a formatted value, make sure the
-buffer is static, global, or allocated.
+buffer is static, global, or allocated. The copy_label() method
+can be used to make a copy of the label string
+automatically.
|