edelib
2.0.0
|
00001 /* 00002 * $Id: String.h 2839 2009-09-28 11:36:20Z karijes $ 00003 * 00004 * Widget with animation support 00005 * Copyright (c) 2005-2012 edelib authors 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public License 00018 * along with this library. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #ifndef __EDELIB_ANIMATEBOX_H__ 00022 #define __EDELIB_ANIMATEBOX_H__ 00023 00024 #include "edelib-global.h" 00025 #include <FL/Fl_Box.H> 00026 #include <FL/Fl_Image.H> 00027 #include "List.h" 00028 00029 EDELIB_NS_BEGIN 00030 00041 class AnimateBox : public Fl_Box { 00042 private: 00043 float draw_rate; 00044 int flags; 00045 list<Fl_Image*> images; 00046 list<Fl_Image*>::iterator curr_image; 00047 00048 public: 00050 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) 00051 { align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP); } 00052 00054 ~AnimateBox(); 00055 00057 bool append(Fl_Image *img); 00058 00060 bool append(const char *path); 00061 00063 void rate(float r) { draw_rate = r; } 00064 00066 float rate(void) { return draw_rate; } 00067 00069 void next_image(void); 00070 00072 void start_animation(void); 00073 00075 void stop_animation(void); 00076 00078 void rollover(void); 00079 00081 void animate_on_show(void); 00082 00084 int handle(int e); 00085 }; 00086 00087 EDELIB_NS_END 00088 #endif