added event handling for double-click or Enter on TreeView items

This commit is contained in:
fgerlits 2005-08-25 17:53:08 +00:00
parent 8dc19fb932
commit 2bf8faeaef
6 changed files with 93 additions and 13 deletions

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.20 $ Version : $Revision: 1.21 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -104,6 +104,8 @@ LiveModeWindow :: LiveModeWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
// register the signal handler for treeview entries being clicked // register the signal handler for treeview entries being clicked
treeView->signal_button_press_event().connect_notify(sigc::mem_fun(*this, treeView->signal_button_press_event().connect_notify(sigc::mem_fun(*this,
&LiveModeWindow::onEntryClicked)); &LiveModeWindow::onEntryClicked));
treeView->signal_row_activated().connect(sigc::mem_fun(*this,
&LiveModeWindow::onDoubleClick));
// Add the TreeView, inside a ScrolledWindow, with the button underneath: // Add the TreeView, inside a ScrolledWindow, with the button underneath:
scrolledWindow.add(*treeView); scrolledWindow.add(*treeView);
@ -279,7 +281,7 @@ LiveModeWindow :: onOutputPlay(void) throw ()
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Event handler for an entry being clicked in the list * Event handler for an entry being clicked in the list.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
void void
LiveModeWindow :: onEntryClicked (GdkEventButton * event) throw () LiveModeWindow :: onEntryClicked (GdkEventButton * event) throw ()
@ -309,3 +311,15 @@ LiveModeWindow :: onEntryClicked (GdkEventButton * event) throw ()
} }
} }
/*------------------------------------------------------------------------------
* Signal handler for the user double-clicking or pressing Enter.
*----------------------------------------------------------------------------*/
void
LiveModeWindow :: onDoubleClick(const Gtk::TreeModel::Path & path,
const Gtk::TreeViewColumn * column)
throw ()
{
onOutputPlay();
}

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.14 $ Version : $Revision: 1.15 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LiveModeWindow.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LiveModeWindow.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -74,7 +74,7 @@ using namespace LiveSupport::Widgets;
* playlists. * playlists.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.14 $ * @version $Revision: 1.15 $
*/ */
class LiveModeWindow : public WhiteWindow, public LocalizedObject class LiveModeWindow : public WhiteWindow, public LocalizedObject
{ {
@ -87,7 +87,7 @@ class LiveModeWindow : public WhiteWindow, public LocalizedObject
* Lists one clip per row. * Lists one clip per row.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.14 $ * @version $Revision: 1.15 $
*/ */
class ModelColumns : public PlayableTreeModelColumnRecord class ModelColumns : public PlayableTreeModelColumnRecord
{ {
@ -166,6 +166,17 @@ class LiveModeWindow : public WhiteWindow, public LocalizedObject
void void
onEntryClicked(GdkEventButton * event) throw (); onEntryClicked(GdkEventButton * event) throw ();
/**
* Signal handler for the user double-clicking, or pressing Enter
* on one of the entries.
*
* @param event the button event recieved
*/
void
onDoubleClick(const Gtk::TreeModel::Path & path,
const Gtk::TreeViewColumn * column)
throw ();
/** /**
* Signal handler for the "rows reordered" event. * Signal handler for the "rows reordered" event.
*/ */

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.28 $ Version : $Revision: 1.29 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/ScratchpadWindow.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/ScratchpadWindow.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -119,6 +119,8 @@ ScratchpadWindow :: ScratchpadWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
// register the signal handler for treeview entries being clicked // register the signal handler for treeview entries being clicked
treeView->signal_button_press_event().connect_notify(sigc::mem_fun(*this, treeView->signal_button_press_event().connect_notify(sigc::mem_fun(*this,
&ScratchpadWindow::onEntryClicked)); &ScratchpadWindow::onEntryClicked));
treeView->signal_row_activated().connect(sigc::mem_fun(*this,
&ScratchpadWindow::onDoubleClick));
// Add the TreeView, inside a ScrolledWindow, with the button underneath: // Add the TreeView, inside a ScrolledWindow, with the button underneath:
scrolledWindow.add(*treeView); scrolledWindow.add(*treeView);
@ -577,3 +579,19 @@ ScratchpadWindow :: onAddToLiveMode(void) throw ()
gLiveSupport->addToLiveMode(playable); gLiveSupport->addToLiveMode(playable);
} }
/*------------------------------------------------------------------------------
* Signal handler for the user double-clicking or pressing Enter.
*----------------------------------------------------------------------------*/
void
ScratchpadWindow :: onDoubleClick(const Gtk::TreeModel::Path & path,
const Gtk::TreeViewColumn * column)
throw ()
{
Gtk::TreeIter iter = treeModel->get_iter(path);
if (iter) {
currentRow = *iter;
onAddToLiveMode();
}
}

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.11 $ Version : $Revision: 1.12 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/ScratchpadWindow.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/ScratchpadWindow.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -73,7 +73,7 @@ using namespace LiveSupport::Widgets;
* playlists. * playlists.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.11 $ * @version $Revision: 1.12 $
*/ */
class ScratchpadWindow : public WhiteWindow, class ScratchpadWindow : public WhiteWindow,
public LocalizedObject public LocalizedObject
@ -87,7 +87,7 @@ class ScratchpadWindow : public WhiteWindow,
* Lists one clip per row. * Lists one clip per row.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.11 $ * @version $Revision: 1.12 $
*/ */
class ModelColumns : public PlayableTreeModelColumnRecord class ModelColumns : public PlayableTreeModelColumnRecord
{ {
@ -223,6 +223,17 @@ class ScratchpadWindow : public WhiteWindow,
virtual void virtual void
onEntryClicked(GdkEventButton * event) throw (); onEntryClicked(GdkEventButton * event) throw ();
/**
* Signal handler for the user double-clicking, or pressing Enter
* on one of the entries.
*
* @param event the button event recieved
*/
void
onDoubleClick(const Gtk::TreeModel::Path & path,
const Gtk::TreeViewColumn * column)
throw ();
/** /**
* Signal handler for the "up" menu item selected from * Signal handler for the "up" menu item selected from
* the entry context menu. * the entry context menu.

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.21 $ Version : $Revision: 1.22 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SearchWindow.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SearchWindow.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -247,6 +247,8 @@ SearchWindow :: constructSearchResultsView(void) throw ()
// register the signal handler for treeview entries being clicked // register the signal handler for treeview entries being clicked
searchResults->signal_button_press_event().connect_notify(sigc::mem_fun( searchResults->signal_button_press_event().connect_notify(sigc::mem_fun(
*this, &SearchWindow::onEntryClicked)); *this, &SearchWindow::onEntryClicked));
searchResults->signal_row_activated().connect(sigc::mem_fun(
*this, &SearchWindow::onDoubleClick));
// create the right-click entry context menu // create the right-click entry context menu
contextMenu = Gtk::manage(new Gtk::Menu()); contextMenu = Gtk::manage(new Gtk::Menu());
@ -452,3 +454,16 @@ SearchWindow :: onAddToLiveMode(void) throw ()
} }
} }
/*------------------------------------------------------------------------------
* Signal handler for the user double-clicking or pressing Enter.
*----------------------------------------------------------------------------*/
void
SearchWindow :: onDoubleClick(const Gtk::TreeModel::Path & path,
const Gtk::TreeViewColumn * column)
throw ()
{
onAddToScratchpad();
}

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.14 $ Version : $Revision: 1.15 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SearchWindow.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SearchWindow.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -73,7 +73,7 @@ using namespace LiveSupport::Widgets;
* The Search/Browse window. * The Search/Browse window.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.14 $ * @version $Revision: 1.15 $
*/ */
class SearchWindow : public WhiteWindow, public LocalizedObject class SearchWindow : public WhiteWindow, public LocalizedObject
{ {
@ -164,6 +164,17 @@ class SearchWindow : public WhiteWindow, public LocalizedObject
void void
onEntryClicked(GdkEventButton * event) throw (); onEntryClicked(GdkEventButton * event) throw ();
/**
* Signal handler for the user double-clicking, or pressing Enter
* on one of the entries.
*
* @param event the button event recieved
*/
void
onDoubleClick(const Gtk::TreeModel::Path & path,
const Gtk::TreeViewColumn * column)
throw ();
/** /**
* Add a playable to the scratchpad. * Add a playable to the scratchpad.
*/ */
@ -181,7 +192,7 @@ class SearchWindow : public WhiteWindow, public LocalizedObject
* Lists one clip per row. * Lists one clip per row.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.14 $ * @version $Revision: 1.15 $
*/ */
class ModelColumns : public PlayableTreeModelColumnRecord class ModelColumns : public PlayableTreeModelColumnRecord
{ {