You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.9 KiB
63 lines
1.9 KiB
/* $Id: gui_label.c,v 1.3 2013/02/27 22:21:35 steffen Exp $ */
|
|
/***************************************************************************
|
|
* gui_label.c
|
|
*
|
|
* Copyright (C) 2013 Steffen Pohle
|
|
* steffen@gulpe.de
|
|
***************************************************************************
|
|
* basic windows functions
|
|
***************************************************************************/
|
|
|
|
/*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* main.c 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 General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
|
|
#include "osmroute.h"
|
|
#include "draw.h"
|
|
#include "gui.h"
|
|
#include "system.h"
|
|
|
|
/****************************************************************************
|
|
* label
|
|
*/
|
|
void gui_label_draw (GUIItem *item) {
|
|
GUILabel *label = NULL;
|
|
if (item) label = (GUILabel*) item->data;
|
|
|
|
struct line_style ls;
|
|
|
|
ls.width = 1.0;
|
|
ls.c = ls.borderc = color[COLOR_white][3];
|
|
|
|
gfx_draw_text (currentwin->screen, item->x, item->y, label->text, label->textcol);
|
|
};
|
|
|
|
|
|
GUIItem *gui_label_new (char *text, int x, int y) {
|
|
GUIItem *item = (GUIItem*) ml_malloc (sizeof (GUILabel) + sizeof (GUIItem) + POINTERALIGNMENT);
|
|
GUILabel *label = NULL;
|
|
if (item) label = (GUILabel*) item->data;
|
|
|
|
if (text == NULL) label->text[0] = 0;
|
|
else strncpy (label->text, text, GUI_TEXTLEN);
|
|
item->x = x;
|
|
item->y = y;
|
|
label->textcol = &color[COLOR_white][2];
|
|
item->type = GUI_LABEL;
|
|
|
|
return item;
|
|
};
|
|
|