summaryrefslogtreecommitdiffstats
path: root/chalk/plugins/viewplugins/scripting/chalkcore/krs_script_progress.h
blob: b2ae7e44c30f01f4b228371517029bad2814584f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
 *  Copyright (c) 2005 Cyrille Berger <[email protected]>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU Library General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#ifndef KROSS_KRITACOREKRS_SCRIPTPROGRESS_H
#define KROSS_KRITACOREKRS_SCRIPTPROGRESS_H

#include <api/class.h>

class KisScriptProgress;

namespace Kross {

namespace ChalkCore {

/**
 * ScriptProgress is used to manage the progress bar of the status bar in chalk
 * 
 * For example (in ruby) :
 * @code
 * script = Krosschalkcore::get("ChalkScript")
 * script.setProgressTotalSteps(1000)
 * script.setProgressStage("progressive", 0)
 * for i in 1..900
 *   script.incProgress()
 * end
 * script.setProgressStage("brutal", 1000)
 * @endcode
 */
class ScriptProgress : public Kross::Api::Class<ScriptProgress> {
    public:
        ScriptProgress(KisScriptProgress* Script);
        ~ScriptProgress();
    private:
        /**
         * This function set the number of steps that the script will require.
         * It takes one argument :
         * - maximum value of the progress
         */
        Kross::Api::Object::Ptr setProgressTotalSteps(Kross::Api::List::Ptr);
        /**
         * This function set the value of progress.
         * It takes one argument :
         * - value of the progress
         */
        Kross::Api::Object::Ptr setProgress(Kross::Api::List::Ptr);
        /**
         * This function increment of one step the position of the progress.
         */
        Kross::Api::Object::Ptr incProgress(Kross::Api::List::Ptr);
        /**
         * This function set the value of the progress and display the text 
         */
        Kross::Api::Object::Ptr setProgressStage(Kross::Api::List::Ptr);
    private:
        KisScriptProgress* m_script;
};

}

}

#endif