GraphicsWidgets.C 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /*
  2. * Copyright (C) 2008 Emweb bvba
  3. *
  4. * See the LICENSE file for terms of use.
  5. */
  6. #include "DeferredWidget.h"
  7. #include "GraphicsWidgets.h"
  8. #include "TopicTemplate.h"
  9. #include <Wt/WAbstractItemModel>
  10. #include <Wt/WImage>
  11. #include <Wt/WStandardItem>
  12. #include <Wt/WStandardItemModel>
  13. GraphicsWidgets::GraphicsWidgets()
  14. : TopicWidget()
  15. {
  16. addText(tr("graphics-intro"), this);
  17. }
  18. void GraphicsWidgets::populateSubMenu(Wt::WMenu *menu)
  19. {
  20. menu->setInternalBasePath("/graphics-charts");
  21. menu->addItem("2D painting", painting2d())->setPathComponent("");
  22. menu->addItem("Paintbrush",
  23. deferCreate(boost::bind
  24. (&GraphicsWidgets::paintbrush, this)));
  25. menu->addItem("Category chart",
  26. deferCreate(boost::bind
  27. (&GraphicsWidgets::categoryChart, this)));
  28. menu->addItem("Scatter plot",
  29. deferCreate(boost::bind
  30. (&GraphicsWidgets::scatterPlot, this)));
  31. menu->addItem("Axis slider widget",
  32. deferCreate(boost::bind
  33. (&GraphicsWidgets::axisSliderWidget, this)));
  34. menu->addItem("Pie chart",
  35. deferCreate(boost::bind
  36. (&GraphicsWidgets::pieChart, this)));
  37. menu->addItem("Maps",
  38. deferCreate(boost::bind
  39. (&GraphicsWidgets::googleMap, this)));
  40. menu->addItem("3D painting",
  41. deferCreate(boost::bind
  42. (&GraphicsWidgets::painting3d, this)));
  43. menu->addItem("3D numerical chart",
  44. deferCreate(boost::bind
  45. (&GraphicsWidgets::numCharts3d, this)));
  46. menu->addItem("3D category chart",
  47. deferCreate(boost::bind
  48. (&GraphicsWidgets::catCharts3d, this)));
  49. }
  50. #include "examples/PaintingEvent.cpp"
  51. #include "examples/PaintingShapes.cpp"
  52. #include "examples/PaintingTransformations.cpp"
  53. #include "examples/PaintingClipping.cpp"
  54. #include "examples/PaintingStyle.cpp"
  55. #include "examples/PaintingImages.cpp"
  56. #include "examples/PaintingInteractive.cpp"
  57. Wt::WWidget *GraphicsWidgets::painting2d()
  58. {
  59. Wt::WTemplate *result = new TopicTemplate("graphics-Painting2D");
  60. result->bindWidget("PaintingEvent", PaintingEvent());
  61. result->bindWidget("PaintingShapes", PaintingShapes());
  62. result->bindWidget("PaintingTransformations", PaintingTransformations());
  63. result->bindWidget("PaintingClipping", PaintingClipping());
  64. result->bindWidget("PaintingStyle", PaintingStyle());
  65. result->bindWidget("PaintingImages", PaintingImages());
  66. result->bindWidget("PaintingInteractive", PaintingInteractive());
  67. return result;
  68. }
  69. #include "examples/Paintbrush.cpp"
  70. Wt::WWidget *GraphicsWidgets::paintbrush()
  71. {
  72. Wt::WTemplate *result = new TopicTemplate("graphics-Paintbrush");
  73. result->bindWidget("Paintbrush", Paintbrush());
  74. return result;
  75. }
  76. #include "examples/CategoryChart.cpp"
  77. Wt::WWidget *GraphicsWidgets::categoryChart()
  78. {
  79. Wt::WTemplate *result = new TopicTemplate("graphics-CategoryChart");
  80. result->bindWidget("CategoryChart", CategoryChart());
  81. return result;
  82. }
  83. #include "examples/ScatterPlotData.cpp"
  84. #include "examples/ScatterPlotCurve.cpp"
  85. #include "examples/ScatterPlotInteractive.cpp"
  86. Wt::WWidget *GraphicsWidgets::scatterPlot()
  87. {
  88. Wt::WTemplate *result = new TopicTemplate("graphics-ScatterPlot");
  89. result->bindWidget("ScatterPlotData", ScatterPlotData());
  90. result->bindWidget("ScatterPlotCurve", ScatterPlotCurve());
  91. result->bindWidget("ScatterPlotInteractive", ScatterPlotInteractive());
  92. return result;
  93. }
  94. #include "examples/AxisSliderWidget.cpp"
  95. #include "examples/AxisSliderWidgetDifferentDataSeries.cpp"
  96. Wt::WWidget *GraphicsWidgets::axisSliderWidget()
  97. {
  98. Wt::WTemplate *result = new TopicTemplate("graphics-AxisSliderWidget");
  99. result->bindWidget("AxisSliderWidget", AxisSliderWidget());
  100. result->bindWidget("AxisSliderWidgetDifferentDataSeries", AxisSliderWidgetDifferentDataSeries());
  101. return result;
  102. }
  103. #include "examples/PieChart.cpp"
  104. Wt::WWidget *GraphicsWidgets::pieChart()
  105. {
  106. Wt::WTemplate *result = new TopicTemplate("graphics-PieChart");
  107. result->bindWidget("PieChart", PieChart());
  108. return result;
  109. }
  110. #include "examples/GoogleMap.cpp"
  111. Wt::WWidget *GraphicsWidgets::googleMap()
  112. {
  113. Wt::WTemplate *result = new TopicTemplate("graphics-GoogleMap");
  114. result->bindWidget("GoogleMap", GoogleMap());
  115. // Show the XML-template as text
  116. result->bindString("GoogleMap-controls",
  117. reindent(tr("graphics-GoogleMap-controls")),
  118. Wt::PlainText);
  119. return result;
  120. }
  121. #include "examples/Painting3D.cpp"
  122. Wt::WWidget *GraphicsWidgets::painting3d()
  123. {
  124. Wt::WTemplate *result = new TopicTemplate("graphics-Painting3D");
  125. result->bindWidget("Painting3D", Painting3D());
  126. return result;
  127. }
  128. #include "examples/NumericalCharts3D.cpp"
  129. Wt::WWidget *GraphicsWidgets::numCharts3d()
  130. {
  131. Wt::WTemplate *result = new TopicTemplate("graphics-NumCharts3D");
  132. result->bindWidget("NumericalCharts3D", NumChart3d());
  133. return result;
  134. }
  135. #include "examples/CategoryCharts3D.cpp"
  136. Wt::WWidget *GraphicsWidgets::catCharts3d()
  137. {
  138. Wt::WTemplate *result = new TopicTemplate("graphics-CatCharts3D");
  139. result->bindWidget("CategoryCharts3D", CatChart3d());
  140. return result;
  141. }