mirror of
https://github.com/fltk/fltk.git
synced 2026-09-24 00:03:48 +08:00
> Added ^A to 'select all' when tree has focus
> A user click on the tree's background does a 'deselect all' git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9359 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+21
-3
@@ -236,6 +236,15 @@ int Fl_Tree::handle(int e) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'a':
|
||||
case 'A': {
|
||||
if ( Fl::event_state() & FL_CTRL ) {
|
||||
select_all();
|
||||
take_focus();
|
||||
return(1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -259,14 +268,23 @@ int Fl_Tree::handle(int e) {
|
||||
// fprintf(stderr, "ERCODEBUG: Fl_Tree::handle(): Event was %s (%d)\n", fl_eventnames[e], e); // DEBUGGING
|
||||
if ( ! _root ) return(ret);
|
||||
switch ( e ) {
|
||||
case FL_PUSH: {
|
||||
// clicked on a tree item?
|
||||
case FL_PUSH: { // clicked on tree
|
||||
if (Fl::visible_focus() && handle(FL_FOCUS)) {
|
||||
Fl::focus(this);
|
||||
}
|
||||
_lastselect = 0;
|
||||
Fl_Tree_Item *o = _root->find_clicked(_prefs);
|
||||
if ( ! o ) break;
|
||||
if ( !o ) { // clicked, but not on an item?
|
||||
switch ( _prefs.selectmode() ) {
|
||||
case FL_TREE_SELECT_NONE:
|
||||
break;
|
||||
case FL_TREE_SELECT_SINGLE:
|
||||
case FL_TREE_SELECT_MULTI:
|
||||
deselect_all();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
set_item_focus(o); // becomes new focus widget
|
||||
redraw();
|
||||
ret |= 1; // handled
|
||||
|
||||
Reference in New Issue
Block a user