~ubuntu-branches/ubuntu/raring/muse/raring-proposed

« back to all changes in this revision

Viewing changes to muse/widgets/popupmenu.h

  • Committer: Package Import Robot
  • Author(s): Alessio Treglia
  • Date: 2012-11-22 01:16:59 UTC
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: package-import@ubuntu.com-20121122011659-a2fwbf33ceqe1s0t
Tags: upstream-2.1~rc1
ImportĀ upstreamĀ versionĀ 2.1~rc1

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
class QVariant;
45
45
class QAction;
46
46
class QEvent;
47
 
//class QTimer;
48
 
//class QStandardItemModel;
49
47
 
50
48
namespace MusEGui {
51
49
 
 
50
/** offers a QMenu-like menu, which stays open once the user
 
51
 *  clicked a checkable action. */
52
52
class PopupMenu : public QMenu
53
53
{
54
 
  Q_OBJECT
 
54
Q_OBJECT
55
55
  
56
56
    bool _stayOpen;
57
57
    #ifndef POPUP_MENU_DISABLE_AUTO_SCROLL  
58
58
    QTimer* timer;
59
59
    #endif
60
60
    int moveDelta;
 
61
    PopupMenu* _cur_menu; // For auto-breakup.
 
62
    int _cur_menu_count;
 
63
    int _cur_item_width;
 
64
    int _cur_col_count;
 
65
 
61
66
    void init();
 
67
    // Auto-breakup a too-wide menu.
 
68
    PopupMenu* getMenu();
62
69
    
63
70
  private slots:
64
71
    #ifndef POPUP_MENU_DISABLE_AUTO_SCROLL  
71
78
    bool event(QEvent*);   
72
79
  
73
80
  public:
74
 
    //PopupMenu();
75
81
    PopupMenu(bool stayOpen);
76
82
    PopupMenu(QWidget* parent=0, bool stayOpen = false);
77
83
    PopupMenu(const QString& title, QWidget* parent = 0, bool stayOpen = false);
78
 
    ///void clear();
 
84
    //void clear();
79
85
    QAction* findActionFromData(const QVariant&) const;
80
86
    bool stayOpen() const { return _stayOpen; }
81
87
    void clearAllChecks() const;
 
88
 
 
89
    // Need to catch these to auto-breakup a too-big menu.
 
90
    QAction* addAction(const QString& text);
 
91
    QAction* addAction(const QIcon& icon, const QString& text);
 
92
    QAction* addAction(const QString& text, const QObject* receiver, const char* member, const QKeySequence& shortcut = 0);
 
93
    QAction* addAction(const QIcon& icon, const QString& text, const QObject* receiver, const char* member, const QKeySequence& shortcut = 0);
 
94
    void     addAction(QAction* action);
82
95
};
83
96
 
84
97