/* ********************************************************************* This source file is a part of the standard library of Scol For the latest info, see http://www.scolring.org Copyright (c) 2013 Stephane Bisaro aka Iri, based on a work of Marc BARILLEY. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to http://www.gnu.org/copyleft/lesser.txt ********************************************************************* */ /* * Standard functions for combobox * See http://redmine.scolring.org/projects/tutorials/wiki/Scol_usage * for more informations */ /*! \file combo.pkg * \author Scol team * \version 0.1 * \copyright GNU Lesser General Public License 2.0 or later * \brief Scol 2D Library - ComboBox API * * \details This API provides an high level method to easily include a * combo box. * See too : http://www.scolring.org/files/doc_html/combo.html * **/ /*! \brief Fill a combo box from a list of string items * * \ingroup _2dos_combo * Prototype: fun [ObjBox [S r1]] ObjBox * * \param ObjBox : a combo box already created * \param [S r1] : a list of item * * \return ObjBox : the filled combo box or nil if error **/ fun lib2d_comboSets (combo, lStr)= if combo == nil then nil else if lStr == nil then combo else let lStr -> [str next] in lib2d_comboSets (_ADDcombo combo (_GETcomboCount combo) str) next;; fun lib2d_combogets (n, combo)= if n < 0 then nil else let (_SELcombo combo n; _GETcombo combo) -> [_ str] in str :: lib2d_combogets n-1 combo;; /*! \brief Returns the list of all predefined choices in a combo box * * \ingroup _2dos_combo * Prototype: fun [ObjBox] [S r1] * * \param ObjBox : a combo box already created * * \return [S r1] : the list or nil if error **/ fun lib2d_comboGets (combo)= if combo == nil then nil else lib2d_combogets (_GETcomboCount combo)-1 combo;;