summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Ercolano <erco@seriss.com>2012-04-13 02:51:15 +0000
committerGreg Ercolano <erco@seriss.com>2012-04-13 02:51:15 +0000
commit418dd143f048cad1035803fdd7118e791fb7dd26 (patch)
tree5fe5534e8a257b16fc0f9678e9a784878cf94e0a
parentc28adce903579741b3da98ea58c632666acabed8 (diff)
ABI modifications to Fl_Tree: deprecate mouse selection hotfix with proper solution.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9340 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--FL/Fl_Tree.H7
-rw-r--r--src/Fl_Tree.cxx23
2 files changed, 25 insertions, 5 deletions
diff --git a/FL/Fl_Tree.H b/FL/Fl_Tree.H
index 7a9111114..67278cca8 100644
--- a/FL/Fl_Tree.H
+++ b/FL/Fl_Tree.H
@@ -199,6 +199,13 @@ class FL_EXPORT Fl_Tree : public Fl_Group {
Fl_Tree_Prefs _prefs; // all the tree's settings
int _scrollbar_size; // size of scrollbar trough
+#if FLTK_ABI_VERSION >= 10302
+ // NEW:
+ Fl_Tree_Item *_lastselect;
+#else
+ // OLD: static data inside handle() method
+#endif
+
void fix_scrollbar_order();
protected:
diff --git a/src/Fl_Tree.cxx b/src/Fl_Tree.cxx
index 887723150..0635c7d05 100644
--- a/src/Fl_Tree.cxx
+++ b/src/Fl_Tree.cxx
@@ -98,6 +98,14 @@ Fl_Tree::Fl_Tree(int X, int Y, int W, int H, const char *L) : Fl_Group(X,Y,W,H,L
_callback_item = 0;
_callback_reason = FL_TREE_REASON_NONE;
_scrollbar_size = 0; // 0: uses Fl::scrollbar_size()
+
+#if FLTK_ABI_VERSION >= 10302
+ // NEW
+ _lastselect = 0;
+#else
+ // OLD: data initialized static inside handle()
+#endif
+
box(FL_DOWN_BOX);
color(FL_BACKGROUND2_COLOR, FL_SELECTION_COLOR);
when(FL_WHEN_CHANGED);
@@ -240,7 +248,12 @@ int Fl_Tree::handle(int e) {
// Handle events the child FLTK widgets didn't need
- static Fl_Tree_Item *lastselect = 0;
+#if FLTK_ABI_VERSION >= 10302
+ // NEW: data inside Fl_Tree
+#else
+ // OLD:
+ static Fl_Tree_Item *_lastselect = 0;
+#endif
// fprintf(stderr, "ERCODEBUG: Fl_Tree::handle(): Event was %s (%d)\n", fl_eventnames[e], e); // DEBUGGING
if ( ! _root ) return(ret);
switch ( e ) {
@@ -248,7 +261,7 @@ int Fl_Tree::handle(int e) {
if (Fl::visible_focus() && handle(FL_FOCUS)) {
Fl::focus(this);
}
- lastselect = 0;
+ _lastselect = 0;
Fl_Tree_Item *o = _root->find_clicked(_prefs);
if ( ! o ) break;
set_item_focus(o); // becomes new focus widget
@@ -271,7 +284,7 @@ int Fl_Tree::handle(int e) {
select(o); // add to selection
} else if ( Fl::event_state() & FL_CTRL ) { // CTRL+PUSH?
select_toggle(o, when()); // toggle selection state
- lastselect = o; // save toggled item (prevent oscillation)
+ _lastselect = o; // save toggled item (prevent oscillation)
} else {
select_only(o, when());
}
@@ -312,9 +325,9 @@ int Fl_Tree::handle(int e) {
break;
case FL_TREE_SELECT_MULTI:
if ( Fl::event_state() & FL_CTRL && // CTRL-DRAG: toggle?
- lastselect != o ) { // not already toggled from last microdrag?
+ _lastselect != o ) { // not already toggled from last microdrag?
select_toggle(o, when()); // toggle selection
- lastselect = o; // save we toggled it (prevents oscillation)
+ _lastselect = o; // save we toggled it (prevents oscillation)
} else {
select(o); // select this
}