Mailinglist Archive: yast-commit (819 mails)

< Previous Next >
[yast-commit] r54991 - in /trunk: qt-graph/examples/SimpleCreate.cc qt-graph/examples/SimpleLoad.cc ycp-ui-bindings/examples/Graph1.ycp ycp-ui-bindings/examples/Graph2.ycp
  • From: aschnell@xxxxxxxxxxxxxxxx
  • Date: Mon, 26 Jan 2009 11:37:54 -0000
  • Message-id: <E1LRPms-0007qQ-Dc@xxxxxxxxxxxxxxxx>
Author: aschnell
Date: Mon Jan 26 12:37:54 2009
New Revision: 54991

URL: http://svn.opensuse.org/viewcvs/yast?rev=54991&view=rev
Log:
- prepare graph examples for events

Modified:
trunk/qt-graph/examples/SimpleCreate.cc
trunk/qt-graph/examples/SimpleLoad.cc
trunk/ycp-ui-bindings/examples/Graph1.ycp
trunk/ycp-ui-bindings/examples/Graph2.ycp

Modified: trunk/qt-graph/examples/SimpleCreate.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt-graph/examples/SimpleCreate.cc?rev=54991&r1=54990&r2=54991&view=diff
==============================================================================
--- trunk/qt-graph/examples/SimpleCreate.cc (original)
+++ trunk/qt-graph/examples/SimpleCreate.cc Mon Jan 26 12:37:54 2009
@@ -11,8 +11,9 @@
#include "YOptionalWidgetFactory.h"
#include "YDialog.h"
#include "YLayoutBox.h"
-#include "YEvent.h"
#include "YGraph.h"
+#include "YPushButton.h"
+#include "YEvent.h"


int
@@ -34,11 +35,22 @@
gvLayout(gvc, graph, "dot");

YUI::optionalWidgetFactory()->createGraph(vbox, graph);
+ YPushButton* button = YUI::widgetFactory()->createPushButton(vbox,
"&Close");

gvFreeLayout(gvc, graph);
agclose(graph);
gvFreeContext(gvc);

- dialog->waitForEvent();
+ while (true)
+ {
+ YEvent* event = dialog->waitForEvent();
+
+ if (event->eventType() == YEvent::CancelEvent)
+ break;
+
+ if (event->widget() == button)
+ break;
+ }
+
dialog->destroy();
}

Modified: trunk/qt-graph/examples/SimpleLoad.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt-graph/examples/SimpleLoad.cc?rev=54991&r1=54990&r2=54991&view=diff
==============================================================================
--- trunk/qt-graph/examples/SimpleLoad.cc (original)
+++ trunk/qt-graph/examples/SimpleLoad.cc Mon Jan 26 12:37:54 2009
@@ -11,8 +11,9 @@
#include "YOptionalWidgetFactory.h"
#include "YDialog.h"
#include "YLayoutBox.h"
-#include "YEvent.h"
#include "YGraph.h"
+#include "YPushButton.h"
+#include "YEvent.h"


int
@@ -28,7 +29,18 @@
YLayoutBox* vbox = YUI::widgetFactory()->createVBox(dialog);

YUI::optionalWidgetFactory()->createGraph(vbox, argv[1], argv[2]);
+ YPushButton* button = YUI::widgetFactory()->createPushButton(vbox,
"&Close");
+
+ while (true)
+ {
+ YEvent* event = dialog->waitForEvent();
+
+ if (event->eventType() == YEvent::CancelEvent)
+ break;
+
+ if (event->widget() == button)
+ break;
+ }

- dialog->waitForEvent();
dialog->destroy();
}

Modified: trunk/ycp-ui-bindings/examples/Graph1.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ycp-ui-bindings/examples/Graph1.ycp?rev=54991&r1=54990&r2=54991&view=diff
==============================================================================
--- trunk/ycp-ui-bindings/examples/Graph1.ycp (original)
+++ trunk/ycp-ui-bindings/examples/Graph1.ycp Mon Jan 26 12:37:54 2009
@@ -16,10 +16,17 @@
UI::OpenDialog(
`VBox(
`HSpacing(60),
- `Graph("graph.dot", "dot"),
- `PushButton(`opt(`default), "&OK")
+ `Graph(`id(`graph), "graph.dot", "dot"),
+ `PushButton(`id(`close), `opt(`default), "&Close")
)
);
- UI::UserInput();
+
+ while (true)
+ {
+ any widget = UI::UserInput();
+ if (widget == `close || widget == `cancel)
+ break;
+ }
+
UI::CloseDialog();
}

Modified: trunk/ycp-ui-bindings/examples/Graph2.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ycp-ui-bindings/examples/Graph2.ycp?rev=54991&r1=54990&r2=54991&view=diff
==============================================================================
--- trunk/ycp-ui-bindings/examples/Graph2.ycp (original)
+++ trunk/ycp-ui-bindings/examples/Graph2.ycp Mon Jan 26 12:37:54 2009
@@ -1,4 +1,4 @@
-// Graph1.ycp
+// Graph2.ycp
{
if (!UI::HasSpecialWidget(`Graph))
{
@@ -16,10 +16,17 @@
UI::OpenDialog(
`VBox(
`HSpacing(60),
- `Graph("graph.dot", "neato"),
- `PushButton(`opt(`default), "&OK")
+ `Graph(`id(`graph), "graph.dot", "neato"),
+ `PushButton(`id(`close), `opt(`default), "&Close")
)
);
- UI::UserInput();
+
+ while (true)
+ {
+ any widget = UI::UserInput();
+ if (widget == `close || widget == `cancel)
+ break;
+ }
+
UI::CloseDialog();
}

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages