/***************************************************************************

    source::worx xtree
    Copyright © 2024-2025 c.holzheuer
    christoph.holzheuer@gmail.com

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

***************************************************************************/


#ifndef XQCONTEXTMENU_H
#define XQCONTEXTMENU_H

#include <QMenu>
#include <QMap>
#include <xqcommand.h>

/**
 * @brief A specialized QMenu for @see XQCommands
 */

class XQContextMenu : public QMenu
{
  Q_OBJECT

public:

  XQContextMenu(QWidget* parent = nullptr );
  virtual ~XQContextMenu() = default;

  void addAction(const QString& name, XQCommand::CmdType commandType, bool enabled );
  void addAction(const QString& iconKey, const QString& name, XQCommand::CmdType commandType, bool enabled );
  void addAction(const QIcon& icon, const QString& name, XQCommand::CmdType commandType, bool enabled );

  void setActionEnabled(XQCommand::CmdType commandType, bool enabled);

protected:

  QMap<int, QAction*> _actionMap;

};




#endif //;  XQContextMenu_H
