3 * This file is part of Tulip (www.tulip-software.org)
4 *
5 * Authors: David Auber and the Tulip development Team
6 * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7 *
8 * Tulip is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation, either version 3
11 * of the License, or (at your option) any later version.
12 *
13 * Tulip is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 * See the GNU General Public License for more details.
17 *
18 */
19
20#ifndef TLP_PROGRESS
21#define TLP_PROGRESS
22
23#include <tulip/tulipconf.h>
24#include <string>
25
26namespace tlp {
27
28/**
29 * @ingroup Plugins
30 * @brief The ProgressPreviewHandler class handles the way a process handled by a PluginProgress is handled
31 *
32 * When PluginProgress::setPreview() is called, the associated ProgressPreviewHandler will be enabled. Allowing it to implement custom behavior to allow the user to preview the result of the underleying process
33 * Once enabled, the progressStateChanged method will be called back each time PluginProgress::progress is called to allow synchronizing the preview with progression.
68 * @brief PluginProcess subclasses are meant to notify about the progress state of some process (typically a plugin)
69 *
70 * PluginProgress are mainly used alongside with tlp::Plugin instances to give user a visual feedback about the progress of the plugin.
71 * Every plugin in tulip got a pluginProgress member they can call to give progress feedbacks. When running, the plugin should make a call to tlp::PluginProgress::progress() indicating the current state of the compuation.
72 * The tlp::PluginProgress returns a tlp::ProgressState indicating what behavior the underleying system should have (see tlp::ProgressState for details)
83 * @brief Notifies the progression of the process.
84 *
85 * @param step The current step number.
86 * @param max_step The total number of steps.
87 *
88 * * @warning For default previsualisation handling to work, be sure to call PluginProgress::progress in this method (the return value can be ignored)
89 *
90 * @return tlp::ProgressState a value indicating whether the progress has been stopped, cancelled, or will continue.
91 * @see tlp::ProgressState
92 **/
93virtualProgressState progress(int step, int max_step);
94
95 /**
96 * @brief Sets the state flag to cancel, notifying to the process that the user wants to cancel it.
97 * Canceling a process must stop it and revert all the changes performed since its start.
98 *
99 * @return void
100 **/
101virtualvoid cancel()=0;
102
103 /**
104 * @brief Sets the state flag to stop, notifying to the process that the user wants to stop it.
105 * Stopping a process does not revert changes.
106 * @return void
107 **/
108virtualvoid stop()=0;
109
110 /**
111 * @brief The preview mode redraws the graph while applying the algorithm, making it slower.
112 *
113 * @return bool Whether the preview mode is activated.
114 **/
115virtualbool isPreviewMode() const =0;
116
117
118 /**
119 * @brief The preview mode redraws the graph while applying the algorithm, making it slower.
120 *
121 * @param drawPreview Whether the preview should be drawn.