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 00033 #ifndef MMSGUITOOLS_H_ 00034 #define MMSGUITOOLS_H_ 00035 00036 #include "mmstools/mmslogger.h" 00037 #include "mmsgui/fb/mmsfb.h" 00038 #include "mmsinput/mmskeymap.h" 00039 00040 typedef enum { 00041 MMSINPUTEVENTTYPE_NONE = 0, 00042 MMSINPUTEVENTTYPE_KEYPRESS, 00043 MMSINPUTEVENTTYPE_KEYRELEASE, 00044 MMSINPUTEVENTTYPE_BUTTONPRESS, 00045 MMSINPUTEVENTTYPE_BUTTONRELEASE, 00046 MMSINPUTEVENTTYPE_AXISMOTION 00047 } MMSINPUTEVENTTYPE; 00048 00049 typedef struct { 00050 MMSINPUTEVENTTYPE type; 00051 MMSKeySymbol key; 00052 short posx; 00053 short posy; 00054 short dx; 00055 short dy; 00056 short absx; 00057 short absy; 00058 } MMSInputEvent; 00059 00060 00061 00062 //! Translate the size given in hint into pixel value. 00063 /*! 00064 \param retpix return value 00065 \param hint size with following formats 00066 <size>px - size in pixel, example "100px" 00067 <size>% - size in percent, example "100%" 00068 <size>px-<size2> - size in pixel minus pixel, example "100px-50" 00069 <size>%-<size2> - size in percent minus pixel, example "100%-50" 00070 <factor>$ - factor which will used in conjunction with secondaxis 00071 result=<factor>*secondaxis 00072 example: "1.333$" 00073 \param maxpixel maximum pixel for calculation and check 00074 \param secondaxis size of the second axis, will only used with hint <factor>$ 00075 \return true if input is correct and retpix is filled 00076 */ 00077 bool getPixelFromSizeHint(int *retpix, string hint, int maxpixel, int secondaxis); 00078 00079 #ifdef __HAVE_DIRECTFB__ 00080 bool loadImage(IDirectFBImageProvider **image, string path, string filename); 00081 #endif 00082 00083 bool loadFont(MMSFBFont **font, string path, string filename, int width, int height); 00084 00085 unsigned int getFrameNum(unsigned int delay_time); 00086 00087 unsigned int getFrameDelay(unsigned int start_ts, unsigned int end_ts); 00088 00089 #endif /*MMSGUITOOLS_H_*/