1 /*$
2  Copyright (C) 2016-2020 Azel.
3 
4  This file is part of AzPainterB.
5 
6  AzPainterB is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  AzPainterB is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 $*/
19 
20 #ifndef MLIB_PROGRESSBAR_H
21 #define MLIB_PROGRESSBAR_H
22 
23 #include "mWidgetDef.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #define M_PROGRESSBAR(p)  ((mProgressBar *)(p))
30 
31 typedef struct
32 {
33 	uint32_t style;
34 	int min,max,pos,
35 		textlen,
36 		sub_step,sub_max,sub_toppos,
37 		sub_curcnt,sub_curstep,sub_nextcnt;
38 	char *text;
39 }mProgressBarData;
40 
41 typedef struct _mProgressBar
42 {
43 	mWidget wg;
44 	mProgressBarData pb;
45 }mProgressBar;
46 
47 
48 enum MPROGRESSBAR_STYLE
49 {
50 	MPROGRESSBAR_S_FRAME = 1<<0,
51 	MPROGRESSBAR_S_TEXT  = 1<<1,
52 	MPROGRESSBAR_S_TEXT_PERS = 1<<2,
53 };
54 
55 
56 void mProgressBarDestroyHandle(mWidget *p);
57 void mProgressBarCalcHintHandle(mWidget *p);
58 void mProgressBarDrawHandle(mWidget *p,mPixbuf *pixbuf);
59 
60 mProgressBar *mProgressBarNew(int size,mWidget *parent,uint32_t style);
61 mProgressBar *mProgressBarCreate(mWidget *parent,int id,uint32_t style,
62 	uint32_t fLayout,uint32_t marginB4);
63 
64 void mProgressBarSetStatus(mProgressBar *p,int min,int max,int pos);
65 void mProgressBarSetText(mProgressBar *p,const char *text);
66 mBool mProgressBarSetPos(mProgressBar *p,int pos);
67 void mProgressBarIncPos(mProgressBar *p);
68 mBool mProgressBarAddPos(mProgressBar *p,int add);
69 
70 void mProgressBarBeginSubStep(mProgressBar *p,int stepnum,int max);
71 void mProgressBarBeginSubStep_onestep(mProgressBar *p,int stepnum,int max);
72 mBool mProgressBarIncSubStep(mProgressBar *p);
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif
79