Chris@190: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
Chris@190: 
Chris@190: /*
Chris@190:     Sonic Visualiser
Chris@190:     An audio file viewer and annotation editor.
Chris@190:     Centre for Digital Music, Queen Mary, University of London.
Chris@190:     This file copyright 2007 QMUL.
Chris@190:     
Chris@190:     This program is free software; you can redistribute it and/or
Chris@190:     modify it under the terms of the GNU General Public License as
Chris@190:     published by the Free Software Foundation; either version 2 of the
Chris@190:     License, or (at your option) any later version.  See the file
Chris@190:     COPYING included with this distribution for more information.
Chris@190: */
Chris@190: 
Chris@190: #include "NotifyingTabBar.h"
Chris@190: 
Chris@190: #include <iostream>
Chris@190: 
Chris@190: NotifyingTabBar::NotifyingTabBar(QWidget *parent) :
Chris@190:     QTabBar(parent)
Chris@190: {
Chris@190: }
Chris@190: 
Chris@190: NotifyingTabBar::~NotifyingTabBar()
Chris@190: {
Chris@190: }
Chris@190: 
Chris@190: void
Chris@190: NotifyingTabBar::mousePressEvent(QMouseEvent *e)
Chris@190: {
Chris@190:     int i = currentIndex();
Chris@190:     QTabBar::mousePressEvent(e);
Chris@190:     if (currentIndex() == i) {
Chris@190:         emit activeTabClicked();
Chris@190:     }
Chris@190: }
Chris@190: 
Chris@190: void
Chris@190: NotifyingTabBar::enterEvent(QEvent *e)
Chris@190: {
Chris@190:     QTabBar::enterEvent(e);
Chris@190:     emit mouseEntered();
Chris@190: }
Chris@190: 
Chris@190: void
Chris@190: NotifyingTabBar::leaveEvent(QEvent *e)
Chris@190: {
Chris@190:     QTabBar::enterEvent(e);
Chris@190:     emit mouseLeft();
Chris@190: }
Chris@190: