~ubuntu-branches/ubuntu/wily/muse/wily-proposed

« back to all changes in this revision

Viewing changes to muse/widgets/popupmenu.h

  • Committer: Package Import Robot
  • Author(s): Alessio Treglia
  • Date: 2011-12-03 17:12:54 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20111203171254-28b1j4lpb46r5jtl
Tags: 2.0~rc1-1
* New upstream RC release.
* Refresh patches, remove those patches not needed anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
//  (C) Copyright 1999-2010 Werner Schweer (ws@seh.de)
7
7
//
8
8
//  PopupMenu sub-class of QMenu created by Tim.
 
9
//  (C) Copyright 2010-2011 Tim E. Real (terminator356 A T sourceforge D O T net)
 
10
//
 
11
//  This program is free software; you can redistribute it and/or
 
12
//  modify it under the terms of the GNU General Public License
 
13
//  as published by the Free Software Foundation; version 2 of
 
14
//  the License, or (at your option) any later version.
 
15
//
 
16
//  This program is distributed in the hope that it will be useful,
 
17
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
//  GNU General Public License for more details.
 
20
//
 
21
//  You should have received a copy of the GNU General Public License
 
22
//  along with this program; if not, write to the Free Software
 
23
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
24
//
9
25
//=========================================================
10
26
 
11
27
#ifndef __POPUPMENU_H__
12
28
#define __POPUPMENU_H__
13
29
 
 
30
// Just in case Qt ever adds these features natively, we would need to turn our features off!
 
31
//#define POPUP_MENU_DISABLE_STAY_OPEN    
 
32
//#define POPUP_MENU_DISABLE_AUTO_SCROLL
 
33
 
14
34
#include <QMenu>
 
35
#ifndef POPUP_MENU_DISABLE_AUTO_SCROLL  
 
36
  #include <QTimer>
 
37
#endif
 
38
 
15
39
//#include <QMouseEvent>
16
40
//#include <QColumnView>
17
41
 
19
43
class QMouseEvent;
20
44
class QVariant;
21
45
class QAction;
 
46
class QEvent;
 
47
//class QTimer;
22
48
//class QStandardItemModel;
23
49
 
 
50
namespace MusEGui {
 
51
 
24
52
class PopupMenu : public QMenu
25
53
{
26
54
  Q_OBJECT
27
55
  
 
56
    bool _stayOpen;
 
57
    #ifndef POPUP_MENU_DISABLE_AUTO_SCROLL  
 
58
    QTimer* timer;
 
59
    #endif
 
60
    int moveDelta;
 
61
    void init();
 
62
    
 
63
  private slots:
 
64
    #ifndef POPUP_MENU_DISABLE_AUTO_SCROLL  
 
65
    void popHovered(QAction*);
 
66
    void timerHandler();
 
67
    #endif
 
68
  
28
69
  protected:
29
70
    void mouseReleaseEvent(QMouseEvent *);
 
71
    bool event(QEvent*);   
30
72
  
31
73
  public:
32
 
    PopupMenu(QWidget* parent=0);
 
74
    //PopupMenu();
 
75
    PopupMenu(bool stayOpen);
 
76
    PopupMenu(QWidget* parent=0, bool stayOpen = false);
 
77
    PopupMenu(const QString& title, QWidget* parent = 0, bool stayOpen = false);
33
78
    ~PopupMenu();
34
79
    void clear();
35
 
    QAction* findActionFromData(QVariant);
 
80
    QAction* findActionFromData(const QVariant&) const;
 
81
    bool stayOpen() const { return _stayOpen; }
 
82
    void clearAllChecks() const;
36
83
};
37
84
 
38
85
 
54
101
};
55
102
*/
56
103
 
 
104
} // namespace MusEGui
57
105
 
58
106
#endif
59
107