From: Bo Staahle (c960355++at++student.dtu.dk)
Date: 01/26/2000 02:01:04
Thanks to Svend Tang-Petersen SGI we now have a button to push (se
attachment).
Now we would like to get a reaction when pressing that button. Like
quiting when user pushes button.
Does anybody have a simple example on how to do that?
BTW: Please don't refer to the Performer source, since we already tried
to figure out that works. :-(
-- Bo Sixten Staahle mailto:c960355++at++student.dtu.dk, mailto:Bo.Sixten.Staahle++at++uni-c.dk
#include <Performer/pfutil.h> #include <Performer/pf.h> #include <Performer/pfui.h> #include <Performer/pfdu.h> //#include <Performer/pfui/pfiXformer.h> #include <Performer/pfutil/pfuProcessManager.h> #include <Performer/pf/pfPipeWindow.h> #include <Performer/pf/pfChannel.h>
/* X Window includes */ #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/keysym.h>
#include <iostream.h>
static void controlPanel(pfuWidget *w){
switch(pfuGetWidgetId(w)) { case 1: cout<<"QUIT pressed"<<endl; break;
default: break; } }
int main(){ pfInit(); pfuInit(); pfConfig(); // pfiInit();
pfPipe* p = pfGetPipe(0); pfPipeWindow *pw = new pfPipeWindow(p);
pfuInitGUI(pw);
pfuEnableGUI(1);
pw->setWinType(PFPWIN_TYPE_X); pw->setName("IRIS Performer"); pw->setOriginSize(0,0,500,500); pw->open();
pfChannel *chan1 = pfuGetGUIChan(); pw->addChan(chan1);
cout<<chan1<<endl;
float a, b, c, d; chan1->getViewport(&a, &b, &c, &d); cout<<a<<","<<b<<","<<c<<","<<d<<endl; pfuGUIViewport(a, b, c, d); pfuPanel* panel = pfuNewPanel(); pfuWidget* wid = pfuNewWidget(panel, PFUGUI_BUTTON, 1); pfuWidgetDim(wid, 50, 50, 100, 100); pfuWidgetLabel(wid, "Quit"); pfuWidgetActionFunc(wid, controlPanel); pfuEnableWidget(wid);
pfuEnablePanel(panel);
pfuResetGUI();
pfuRedrawGUI();
while(1) {
pfSync(); pfFrame(); } }
This archive was generated by hypermail 2b29 : Wed Jan 26 2000 - 02:00:42 PST