Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

text.h

00001 /*
00002  *  text.h - Text handling routinges
00003  *           This file is part of the FreeLCD package.
00004  *
00005  *  $Id: text_8h-source.html,v 1.1 2003/02/16 22:50:41 unicorn Exp $
00006  *
00007  *  This program is free software; you can redistribute it and/or modify it
00008  *  under the terms of the GNU General Public License as published by the
00009  *  Free Software Foundation; either version 2 of the License, or (at your
00010  *  option) any later version.
00011  * 
00012  *  This program is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with this program; if not, write to the Free Software
00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00020  *  MA  02111-1307  USA
00021  *
00022  *  Copyright (c) 2002, Jeroen van den Berg <unicorn@hippie.nu>
00023  */
00024 
00025 #ifndef _TEXT_H
00026 #define _TEXT_H
00027 
00028 typedef struct
00029 {
00030   int width;                    /* Specified width ...             */
00031   int height;                   /* ... and height of the buffer.   */
00032   int reserved_h;               /* Malloc'ed height.               */
00033   int cursor_x;                 /* X-position of the cursor.       */
00034   int cursor_y;                 /* Y-position.                     */
00035   char *buf;                    /* Pointer to the actual contents. */
00036 }
00037 text_buf;
00038 
00039 
00040 /* Create a new text buffer */
00041 text_buf *text_buf_malloc (int width, int height);
00042 
00043 /* Free a buffer */
00044 void text_buf_free (text_buf * buf);
00045 
00046 /* Print some text at the cursor position */
00047 void text_print (text_buf * buf, const char *text);
00048 
00049 /* Print some text at the cursor position, with word wrapping */
00050 void text_print_wrap (text_buf * buf, const char *text);
00051 
00052 /* Add a centered line */
00053 void
00054 text_add_centered_line (text_buf * buf, const char *text,
00055                         char filler, char left_end, char right_end);
00056 
00057 /* Clip a region from a text buffer and return the region */
00058 text_buf *text_copy_region (const text_buf * buf, int x, int y, int w, int h);
00059 
00060 /* Paste a region inside another region */
00061 void
00062 text_paste_region (text_buf * dest, const text_buf * source, int x, int y);
00063 
00064 /* Crop lines at the outside */
00065 void text_crop (text_buf * buf, int top, int bottom, int left, int right);
00066 
00067 /* Crop all whitespace around text buffer automatically */
00068 void text_autocrop (text_buf * buf);
00069 
00070 #endif /* Multiple include guard */

Generated on Sun Feb 16 23:39:49 2003 for FreeLCD by doxygen1.2.18