You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdelibs/tdeui/tests/tdepopuptest.cpp

41 lines
842 B

#include <kapplication.h>
#include <tqwidget.h>
#include <tqcursor.h>
#include "tdepopupmenu.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, "tdepopupmenutest");
DemoWidget w;
app.setMainWidget(&w);
w.setFont(TQFont("helvetica", 12, TQFont::Bold), true);
w.show();
return app.exec();
}