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 #include "mmsgui/theme/mmsthemebase.h" 00034 00035 MMSALIGNMENT getAlignmentFromString(string inputstr) { 00036 MMSALIGNMENT alignment; 00037 00038 alignment = MMSALIGNMENT_NOTSET; 00039 00040 if (inputstr == "center") 00041 alignment = MMSALIGNMENT_CENTER; 00042 else if (inputstr == "left") 00043 alignment = MMSALIGNMENT_LEFT; 00044 else if (inputstr == "right") 00045 alignment = MMSALIGNMENT_RIGHT; 00046 else if (inputstr == "justify") 00047 alignment = MMSALIGNMENT_JUSTIFY; 00048 else if (inputstr == "top-center") 00049 alignment = MMSALIGNMENT_TOP_CENTER; 00050 else if (inputstr == "top-left") 00051 alignment = MMSALIGNMENT_TOP_LEFT; 00052 else if (inputstr == "top-right") 00053 alignment = MMSALIGNMENT_TOP_RIGHT; 00054 else if (inputstr == "top-justify") 00055 alignment = MMSALIGNMENT_TOP_JUSTIFY; 00056 else if (inputstr == "bottom-center") 00057 alignment = MMSALIGNMENT_BOTTOM_CENTER; 00058 else if (inputstr == "bottom-left") 00059 alignment = MMSALIGNMENT_BOTTOM_LEFT; 00060 else if (inputstr == "bottom-right") 00061 alignment = MMSALIGNMENT_BOTTOM_RIGHT; 00062 else if (inputstr == "bottom-justify") 00063 alignment = MMSALIGNMENT_BOTTOM_JUSTIFY; 00064 00065 return alignment; 00066 } 00067 00068 MMSALIGNMENT swapAlignmentHorizontal(MMSALIGNMENT alignment) { 00069 switch (alignment) { 00070 case MMSALIGNMENT_LEFT: 00071 return MMSALIGNMENT_RIGHT; 00072 case MMSALIGNMENT_RIGHT: 00073 return MMSALIGNMENT_LEFT; 00074 case MMSALIGNMENT_TOP_LEFT: 00075 return MMSALIGNMENT_TOP_RIGHT; 00076 case MMSALIGNMENT_TOP_RIGHT: 00077 return MMSALIGNMENT_TOP_LEFT; 00078 case MMSALIGNMENT_BOTTOM_LEFT: 00079 return MMSALIGNMENT_BOTTOM_RIGHT; 00080 case MMSALIGNMENT_BOTTOM_RIGHT: 00081 return MMSALIGNMENT_BOTTOM_LEFT; 00082 default: 00083 return alignment; 00084 } 00085 } 00086 00087 MMSDIRECTION getDirectionFromString(string inputstr) { 00088 MMSDIRECTION direction; 00089 00090 direction = MMSDIRECTION_NOTSET; 00091 00092 if (inputstr == "left") 00093 direction = MMSDIRECTION_LEFT; 00094 else if (inputstr == "right") 00095 direction = MMSDIRECTION_RIGHT; 00096 else if (inputstr == "up") 00097 direction = MMSDIRECTION_UP; 00098 else if (inputstr == "down") 00099 direction = MMSDIRECTION_DOWN; 00100 else if (inputstr == "up-left") 00101 direction = MMSDIRECTION_UP_LEFT; 00102 else if (inputstr == "up-right") 00103 direction = MMSDIRECTION_UP_RIGHT; 00104 else if (inputstr == "down-left") 00105 direction = MMSDIRECTION_DOWN_LEFT; 00106 else if (inputstr == "down-right") 00107 direction = MMSDIRECTION_DOWN_RIGHT; 00108 00109 return direction; 00110 } 00111 00112 00113 00114 MMSPOSITION getPositionFromString(string inputstr) { 00115 MMSPOSITION position; 00116 00117 position = MMSPOSITION_NOTSET; 00118 00119 if (inputstr == "left") 00120 position = MMSPOSITION_LEFT; 00121 else if (inputstr == "right") 00122 position = MMSPOSITION_RIGHT; 00123 else if (inputstr == "top") 00124 position = MMSPOSITION_TOP; 00125 else if (inputstr == "bottom") 00126 position = MMSPOSITION_BOTTOM; 00127 else if (inputstr == "top-left") 00128 position = MMSPOSITION_TOP_LEFT; 00129 else if (inputstr == "top-right") 00130 position = MMSPOSITION_TOP_RIGHT; 00131 else if (inputstr == "bottom-left") 00132 position = MMSPOSITION_BOTTOM_LEFT; 00133 else if (inputstr == "bottom-right") 00134 position = MMSPOSITION_BOTTOM_RIGHT; 00135 00136 return position; 00137 } 00138 00139