textbuf_type.h

Go to the documentation of this file.
00001 /* $Id$ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD 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, version 2.
00006  * OpenTTD 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.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
00008  */
00009 
00012 #ifndef TEXTBUF_TYPE_H
00013 #define TEXTBUF_TYPE_H
00014 
00016 struct Textbuf {
00017   char *buf;                
00018   uint16 max_bytes;         
00019   uint16 max_chars;         
00020   uint16 bytes;             
00021   uint16 chars;             
00022   uint16 pixels;            
00023   bool caret;               
00024   uint16 caretpos;          
00025   uint16 caretxoffs;        
00026 
00027   void Initialize(char *buf, uint16 max_bytes);
00028   void Initialize(char *buf, uint16 max_bytes, uint16 max_chars);
00029 
00030   void DeleteAll();
00031   bool DeleteChar(int delmode);
00032   bool InsertChar(uint32 key);
00033   bool InsertClipboard();
00034   bool MovePos(int navmode);
00035 
00036   bool HandleCaret();
00037   void UpdateSize();
00038 
00039 private:
00040   void DelChar(bool backspace);
00041 };
00042 
00043 #endif /* TEXTBUF_TYPE_H */