1 /* 2 File: EditControl.h 3 Description: Edit control (in menu page) 4 Program: BlockOut 5 Author: Jean-Luc PONS 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 2 of the License, or 10 (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 */ 17 18 #ifndef EDITCONTROLH 19 #define EDITCONTROLH 20 21 class EditControl { 22 23 public: 24 EditControl(); 25 26 // Set display length 27 void SetDisplayLength(int length); 28 29 // Set edit control mode (keys can be NULL) 30 void SetMode(char *text,BOOL edit,BYTE *keys); 31 32 // Get the mode 33 BOOL GetMode(); 34 35 // Process keys (Return 1 on RETURN, 2 on ESCAPE, 0 otherwise) 36 int Process(BYTE *keys,float fTime); 37 38 // Render 39 void Render(Menu *m,int x,int y); 40 41 // Return the text 42 char *GetText(); 43 44 private: 45 46 void InsertChar(char c,int pos); 47 void DeleteChar(int pos); 48 49 BOOL editMode; 50 char editText[256]; 51 BOOL editCursor; 52 float startEditTime; 53 int editPos; 54 int startPos; 55 int displayLgth; 56 57 }; 58 59 #endif /* EDITCONTROLH */ 60