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.
41 lines
832 B
41 lines
832 B
15 years ago
|
#include <kapplication.h>
|
||
15 years ago
|
#include <tqwidget.h>
|
||
|
#include <tqcursor.h>
|
||
15 years ago
|
#include "kpopupmenu.h"
|
||
|
|
||
15 years ago
|
class DemoWidget : public TQWidget {
|
||
15 years ago
|
private:
|
||
|
KPopupMenu *menu;
|
||
|
|
||
15 years ago
|
void mousePressEvent(TQMouseEvent *)
|
||
15 years ago
|
{
|
||
15 years ago
|
menu->popup(TQCursor::pos());
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
void paintEvent(TQPaintEvent *)
|
||
15 years ago
|
{
|
||
|
drawText(32, 32, "Press a Mouse Button!");
|
||
|
}
|
||
|
|
||
|
public:
|
||
15 years ago
|
DemoWidget() : TQWidget()
|
||
15 years ago
|
{
|
||
|
menu = new KPopupMenu("Popup Menu:");
|
||
|
menu->insertItem("Item1");
|
||
|
menu->insertItem("Item2");
|
||
|
menu->insertSeparator();
|
||
14 years ago
|
menu->insertItem("Quit", tqApp, TQT_SLOT(quit()));
|
||
15 years ago
|
}
|
||
|
};
|
||
|
|
||
|
int main(int argc, char **argv)
|
||
|
{
|
||
|
KApplication app(argc, argv, "kpopupmenutest");
|
||
|
DemoWidget w;
|
||
|
app.setMainWidget(&w);
|
||
15 years ago
|
w.setFont(TQFont("helvetica", 12, TQFont::Bold), true);
|
||
15 years ago
|
w.show();
|
||
|
return app.exec();
|
||
|
}
|
||
|
|