/* Monolith label class. * - by Richard W.M. Jones * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: ml_label.c,v 1.2 2002/10/30 21:03:03 rich Exp $ */ #include "config.h" #include #include "ml_widget.h" #include "monolith.h" #include "ml_label.h" static void repaint (void *, ml_session, const char *, io_handle); static struct ml_widget_property properties[]; struct ml_widget_operations label_ops = { repaint: repaint, properties: properties, }; struct ml_label { struct ml_widget_operations *ops; pool pool; /* Pool for allocations. */ const char *text; /* HTML printed for the label. */ }; static struct ml_widget_property properties[] = { { name: "text", offset: ml_offsetof (struct ml_label, text), type: ML_PROP_STRING }, { 0 } }; ml_label new_ml_label (pool pool, const char *text) { ml_label w = pmalloc (pool, sizeof *w); w->ops = &label_ops; w->pool = pool; w->text = text; return w; } static void repaint (void *vw, ml_session session, const char *windowid, io_handle io) { ml_label w = (ml_label) vw; if (w->text) io_fputs (w->text, io); }