edelib 1.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List

AnimateBox.h
1 /*
2 * $Id: String.h 2839 2009-09-28 11:36:20Z karijes $
3 *
4 * Widget with animation support
5 * Copyright (c) 2005-2012 edelib authors
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef __EDELIB_ANIMATEBOX_H__
22 #define __EDELIB_ANIMATEBOX_H__
23
24 #include "edelib-global.h"
25 #include <FL/Fl_Box.H>
26 #include <FL/Fl_Image.H>
27 #include "List.h"
28
29 EDELIB_NS_BEGIN
30
41 class EDELIB_API AnimateBox : public Fl_Box {
42 private:
43 float draw_rate;
44 int flags;
45 list<Fl_Image*> images;
46 list<Fl_Image*>::iterator curr_image;
47
48 public:
50 AnimateBox(int X, int Y, int W, int H, const char* l = 0) : Fl_Box(X, Y, W, H, l), draw_rate(0.2), flags(0)
51 { align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP); }
52
54 ~AnimateBox();
55
57 bool append(Fl_Image *img);
58
60 bool append(const char *path);
61
63 void rate(float r) { draw_rate = r; }
64
66 float rate(void) { return draw_rate; }
67
69 void next_image(void);
70
72 void start_animation(void);
73
75 void stop_animation(void);
76
78 void rollover(void);
79
81 void animate_on_show(void);
82
84 int handle(int e);
85 };
86
87 EDELIB_NS_END
88 #endif