summaryrefslogtreecommitdiffstats
path: root/tdeui/tests/tdepopuptest.cpp
blob: 89c932f46056f6cc7b9a0669e253e760332f6b9f (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
#include <kapplication.h>
#include <tqwidget.h>
#include <tqcursor.h>
#include "kpopupmenu.h"

class DemoWidget : public TQWidget {
private:
    TDEPopupMenu *menu;
    
void mousePressEvent(TQMouseEvent *)
{
    menu->popup(TQCursor::pos());
}

void paintEvent(TQPaintEvent *)
{
    drawText(32, 32, "Press a Mouse Button!");
}

public:
    DemoWidget() : TQWidget()
    {
        menu = new TDEPopupMenu("Popup Menu:");
        menu->insertItem("Item1");
        menu->insertItem("Item2");
        menu->insertSeparator();
        menu->insertItem("Quit", tqApp, TQT_SLOT(quit()));
    }       
};

int main(int argc, char **argv)
{
    TDEApplication app(argc, argv, "kpopupmenutest");
    DemoWidget w;
    app.setMainWidget(&w);
    w.setFont(TQFont("helvetica", 12, TQFont::Bold), true);
    w.show();
    return app.exec();
}