summaryrefslogtreecommitdiffstats
path: root/kommander/widgets/popupmenu.h
blob: 4f1b08d46a41651a32f7780dd930672a07590dde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// C++ Interface: popupmenu
//
// Description: 
//
//
// Author: Andras Mantia <amantia@kdewebdev.org>, (C) 2008
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef POPUPMENU_H
#define POPUPMENU_H

#include <tqlabel.h>
#include <tqmap.h>
#include <kommanderwidget.h>


class TDEPopupMenu;

/**
	@author Andras Mantia <amantia@kdewebdev.org>
*/
class KDE_EXPORT PopupMenu : public TQLabel, public KommanderWidget
{
  TQ_OBJECT
  
  TQ_PROPERTY(TQString populationText READ populationText WRITE setPopulationText DESIGNABLE false)
  TQ_PROPERTY(TQStringList associations READ associatedText WRITE setAssociatedText DESIGNABLE false)
  TQ_PROPERTY(bool KommanderWidget READ isKommanderWidget)
public:
  PopupMenu(TQWidget *parent = 0, const char *name = 0);
  ~PopupMenu();

  virtual bool isKommanderWidget() const;
  virtual TQString currentState() const;
  virtual bool isFunctionSupported(int function);
  virtual TQString handleDCOP(int function, const TQStringList& args);
  virtual TQStringList associatedText() const;
  virtual void setAssociatedText(const TQStringList&);
  virtual TQString populationText() const;
  virtual void setPopulationText(const TQString&);
  TDEPopupMenu *menu() {return m_menu;}

public slots:
  virtual void setWidgetText(const TQString &);
  virtual void populate();
  void popup(int x, int y);

private slots:
  void slotMenuItemActivated(int id);

private:
  TQString insertSubmenu(const TQString& title, const TQString &menuWidget, int index, const TQString& icon);

  TDEPopupMenu *m_menu;
  TQMap<int, TQString> m_associations;
  TQStringList m_params;
};

#endif