00001 /*************************************************************************** 00002 * Copyright (C) 2005-2007 Stefan Schwarzer, Jens Schneider, * 00003 * Matthias Hardt, Guido Madaus * 00004 * * 00005 * Copyright (C) 2007-2008 BerLinux Solutions GbR * 00006 * Stefan Schwarzer & Guido Madaus * 00007 * * 00008 * Copyright (C) 2009-2013 BerLinux Solutions GmbH * 00009 * * 00010 * Authors: * 00011 * Stefan Schwarzer <stefan.schwarzer@diskohq.org>, * 00012 * Matthias Hardt <matthias.hardt@diskohq.org>, * 00013 * Jens Schneider <jens.schneider@diskohq.org>, * 00014 * Guido Madaus <guido.madaus@diskohq.org>, * 00015 * Patrick Helterhoff <patrick.helterhoff@diskohq.org>, * 00016 * René Bählkow <rene.baehlkow@diskohq.org> * 00017 * * 00018 * This library is free software; you can redistribute it and/or * 00019 * modify it under the terms of the GNU Lesser General Public * 00020 * License version 2.1 as published by the Free Software Foundation. * 00021 * * 00022 * This library is distributed in the hope that it will be useful, * 00023 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00024 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00025 * Lesser General Public License for more details. * 00026 * * 00027 * You should have received a copy of the GNU Lesser General Public * 00028 * License along with this library; if not, write to the * 00029 * Free Software Foundation, Inc., * 00030 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * 00031 **************************************************************************/ 00032 #ifndef MMSCANVASWIDGET_H_ 00033 #define MMSCANVASWIDGET_H_ 00034 00035 #include "mmsgui/mmswidget.h" 00036 00037 00038 //! With this class you get a canvas that can be the base for custom widgets that can integrate into the gui 00039 /*! 00040 \author Stefan Schwarzer 00041 */ 00042 class MMSCanvasWidget : public MMSWidget { 00043 private: 00044 string className; 00045 MMSCanvasWidgetClass *canvasWidgetClass; 00046 MMSCanvasWidgetClass myCanvasWidgetClass; 00047 bool current_fgset; 00048 00049 bool create(MMSWindow *root, string className, MMSTheme *theme); 00050 bool init(); 00051 bool release(); 00052 bool draw(bool *backgroundFilled = NULL); 00053 void handleInput(MMSInputEvent *inputevent); 00054 00055 protected: 00056 typedef map<string, string> ATTRIBUTE_MAP; 00057 string attributes; 00058 ATTRIBUTE_MAP attributemap; 00059 bool enableRefresh(bool enable = true); 00060 bool checkRefreshStatus(); 00061 MMSFontManager *getFontManager(); 00062 MMSImageManager *getImageManager(); 00063 MMSFBSurface *canvasSurface; 00064 string factoryname; 00065 MMSTheme *canvastheme; 00066 00067 void checkInit(); 00068 00069 public: 00070 MMSCanvasWidget(MMSWindow *root, string className, MMSTheme *theme = NULL); 00071 virtual ~MMSCanvasWidget(); 00072 00073 virtual bool drawingFunc(MMSFBSurface *surf, MMSFBRectangle surfaceGeom, bool *backgroundFilled = NULL) = 0; 00074 virtual bool createFunc() { return false; }; 00075 virtual bool initFunc() { return false; }; 00076 virtual bool releaseFunc() { return false; }; 00077 virtual bool copyFunc(MMSWidget *wid) { return false; }; 00078 virtual bool handleInputFunc(MMSInputEvent *inputevent) { return false; }; 00079 00080 MMSWidget *copyWidget(); 00081 00082 void add(MMSWidget *widget); 00083 00084 public: 00085 void setAttributes(string &attr); 00086 void setAttributes(string attr); 00087 00088 00089 00090 /* theme access methods */ 00091 void updateFromThemeClass(MMSCanvasWidgetClass *themeClass); 00092 00093 00094 friend class MMSThemeManager; 00095 friend class MMSDialogManager; 00096 }; 00097 00098 00099 00100 #endif /* MMSCANVASWIDGET_H_ */