* BUG: Fix TreeView, ListView, ColumnView and ListBox click detection.


git-svn-id: svn://localhost/gambas/trunk@5086 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2012-08-27 20:10:24 +00:00
parent d39067841a
commit 52827905de
2 changed files with 19 additions and 4 deletions

View file

@ -47,15 +47,26 @@ static void cb_select(GtkTreeSelection *selection, gTreeView *control)
control->emit(SIGNAL(control->onSelect));
}
static void cb_click(GtkTreeSelection *selection, gTreeView *control)
static void cb_click(GtkTreeView *widget, gTreeView *control)
{
if ((gApplication::lastEventTime() - control->_last_click_time) >= 500)
GtkTreePath *path;
gtk_tree_view_get_cursor(widget, &path, NULL);
if (path && control->_last_click_path && gtk_tree_path_compare(path, control->_last_click_path) == 0)
{
//fprintf(stderr, "cb_click\n");
control->emit(SIGNAL(control->onClick));
if ((gApplication::lastEventTime() - control->_last_click_time) < 500)
goto __IGNORE;
}
control->emit(SIGNAL(control->onClick));
__IGNORE:
control->_last_click_time = gApplication::lastEventTime();
if (control->_last_click_path)
gtk_tree_path_free(control->_last_click_path);
control->_last_click_path = path;
}
/*
@ -131,6 +142,7 @@ gTreeView::gTreeView(gContainer *parent, bool list) : gControl(parent)
use_base = true;
_fix_border = false;
_last_click_time = 0;
_last_click_path = NULL;
tree = new gTree(this);
tree->addColumn();
@ -169,6 +181,8 @@ gTreeView::gTreeView(gContainer *parent, bool list) : gControl(parent)
gTreeView::~gTreeView()
{
if (_last_click_path)
gtk_tree_path_free(_last_click_path);
delete tree;
}

View file

@ -136,6 +136,7 @@ public:
unsigned _fix_border : 1;
int _last_click_time;
GtkTreePath *_last_click_path;
protected:
gTree *tree;