textbuf_gui.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_GUI_H
00013 #define TEXTBUF_GUI_H
00014 
00015 #include "window_type.h"
00016 #include "string_type.h"
00017 #include "strings_type.h"
00018 #include "core/enum_type.hpp"
00019 
00021 struct Textbuf {
00022   char *buf;                
00023   uint16 max_bytes;         
00024   uint16 max_chars;         
00025   uint16 bytes;             
00026   uint16 chars;             
00027   uint16 pixels;            
00028   bool caret;               
00029   uint16 caretpos;          
00030   uint16 caretxoffs;        
00031 };
00032 
00033 bool HandleCaret(Textbuf *tb);
00034 
00035 void DeleteTextBufferAll(Textbuf *tb);
00036 bool DeleteTextBufferChar(Textbuf *tb, int delmode);
00037 bool InsertTextBufferChar(Textbuf *tb, uint32 key);
00038 bool InsertTextBufferClipboard(Textbuf *tb);
00039 bool MoveTextBufferPos(Textbuf *tb, int navmode);
00040 void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes);
00041 void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes, uint16 max_chars);
00042 void UpdateTextBufferSize(Textbuf *tb);
00043 
00045 enum QueryStringFlags {
00046   QSF_NONE             =    0,
00047   QSF_ACCEPT_UNCHANGED = 0x01, 
00048   QSF_ENABLE_DEFAULT   = 0x02, 
00049   QSF_LEN_IN_CHARS     = 0x04, 
00050 };
00051 
00052 DECLARE_ENUM_AS_BIT_SET(QueryStringFlags)
00053 
00054 
00055 typedef void QueryCallbackProc(Window*, bool);
00056 
00057 void ShowQueryString(StringID str, StringID caption, uint max_len, Window *parent, CharSetFilter afilter, QueryStringFlags flags);
00058 void ShowQuery(StringID caption, StringID message, Window *w, QueryCallbackProc *callback);
00059 
00061 static const uint OSK_KEYBOARD_ENTRIES = 50;
00062 
00068 extern char _keyboard_opt[2][OSK_KEYBOARD_ENTRIES * 4 + 1];
00069 
00070 #endif /* TEXTBUF_GUI_H */

Generated on Sun May 8 07:30:21 2011 for OpenTTD by  doxygen 1.6.1