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.
spOSMroute/gui/gui_window.c

93 lines
2.5 KiB

/* $Id: gui_window.c,v 1.1 2013/02/17 00:52:20 steffen Exp $ */
/***************************************************************************
* gui_window.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"
/*
* reset all window data, do not allocate anything
*/
void gui_window_new (GUIWindow *win, int w, int h, char *title) {
int i;
for (i = 0; i < GUI_MAX_ITEM; i++) {
win->items[i]->item = NULL;
win->items[i]->type = GUI_NONE;
}
strncpy (win->title, title, GUI_TEXTLEN);
win->screen = NULL;
win->screen_changed = 1;
win->h = h;
win->w = w;
win->focus = NULL;
d_printf ("guiwindow_new %p width:%d height:%d", win, w, h);
};
/*
* closes the window, but does not free the memory.
*/
void gui_window_close (GUIWindow *win) {
int i;
for (i = 0; i < GUI_WIN_BUTTONS; i++) {
win->buttons[i].caption[0] = '\0';
win->buttons[i].id = 0;
win->buttons[i].callback_clicked = NULL;
win->buttons[i].callback_draw = NULL;
}
for (i = 0; i < GUI_WIN_LABELS; i++) {
win->labels[i].text[0] = '\0';
win->labels[i].textcol = &color[COLOR_white][2];
win->labels[i].id = 0;
}
for (i = 0; i < GUI_WIN_ENTRYS; i++) {
win->entrys[i].text[0] = '\0';
win->entrys[i].callback_enter = NULL;
win->entrys[i].callback_changed = NULL;
win->entrys[i].id = 0;
}
for (i = 0; i < GUI_WIN_CHECKBOXES; i++) {
win->checkboxes[i].text[0] = '\0';
win->checkboxes[i].callback_changed = NULL;
win->checkboxes[i].id = 0;
}
win->title[0] = 0;
gfx_img_free (win->screen);
win->screen = NULL;
win->screen_changed = 1;
win->h = 0;
win->w = 0;
};