Home

qtwindowlistmenu.h

This is the verbatim text of the qtwindowlistmenu.h include file. It is provided only for illustration; the copyright remains with Trolltech.


#ifndef QTWINDOWLISTMENU_H
#define QTWINDOWLISTMENU_H

#include <qmap.h>
#include <qpopupmenu.h>

class QMenuData;
class QWidget;
class QString;
class QWorkspace;

#if defined(Q_WS_WIN)
#  if !defined(QT_QTWINDOWLISTMENU_EXPORT) && !defined(QT_QTWINDOWLISTMENU_IMPORT)
#    define QT_QTWINDOWLISTMENU_EXPORT
#  elif defined(QT_QTWINDOWLISTMENU_IMPORT)
#    if defined(QT_QTWINDOWLISTMENU_EXPORT)
#      undef QT_QTWINDOWLISTMENU_EXPORT
#    endif
#    define QT_QTWINDOWLISTMENU_EXPORT __declspec(dllimport)
#  elif defined(QT_QTWINDOWLISTMENU_EXPORT)
#    undef QT_QTWINDOWLISTMENU_EXPORT
#    define QT_QTWINDOWLISTMENU_EXPORT __declspec(dllexport)
#  endif
#else
#  define QT_QTWINDOWLISTMENU_EXPORT
#endif

class QT_QTWINDOWLISTMENU_EXPORT QtWindowListMenu : public QPopupMenu
{
    Q_OBJECT

    public:
	QtWindowListMenu(QWorkspace *workspace, QWidget *parent = 0, const char *name = 0);
	int addTo(const QString &text, QMenuData *menubar, int idx = -1);
	void removeWindow(QWidget *w, bool windowDestroyed = false);

	virtual bool eventFilter(QObject *obj, QEvent *e);

    public slots:
	void addWindow(QWidget *w);
	virtual void setEnabled(bool b);
	void uncheckAll();
	void windowDestroyed(QObject *obj);
	void closeCurrentWindow();
	void closeAllWindows();

    private:
	QMenuData *m_menubar;
	int m_my_id, m_close_current_id;

	/* A list of window/menuid pairs. If the menuid is -1, we are keeping
	   track of the window, but it's hidden so it's not in the menu. */
	typedef QMap<QWidget*, int> WindowList;
	WindowList m_window_list;
	QWorkspace *m_workspace;

	bool isEmpty();
};

#endif

Copyright © 2003-2004 TrolltechTrademarks
Qt Solutions