Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TextEntry.H

00001 /* $Id: TextEntry.H,v 1.1 2001/01/01 00:25:56 rpav Exp $
00002  *
00003  * SFW - Studio FrameWork
00004  * Copyright (C) 2000  Ryan Pavlik
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019  *
00020  */
00021 
00022 /*
00023  * TextEntry.H
00024  *
00025  */ 
00026 
00027 #ifndef TEXTENTRY_H
00028 #define TEXTENTRY_H
00029 
00030 #include <SFW/Object.H>
00031 #include <SFW/Curses/Curses.H>
00032 #include <SFW/Curses/KeyBinder.H>
00033 
00034 namespace SFW {
00035     namespace Curses {
00036         class TextEntry : public Object {
00037             Window    *w;
00038     
00039             string     prompt;
00040             int        r, c;
00041             int        width;
00042             int        entryWidth;
00043 
00044             int        maxLength;
00045             string     text;
00046             int        cx;
00047             int        toffs;
00048 
00049             KeyBinder  binding;
00050 
00051             bool       finished;
00052             bool       abortable;
00053             bool       aborted;
00054 
00055             List           history;
00056             List::iterator histpos;
00057 
00058         public:
00059             TYPE_INFO(SFW::Curses::TextEntry, SFW::Object);
00060             METHOD_PTR(SFW::Curses::TextEntry);
00061 
00062             /* ctor, dtor */
00063             TextEntry(Window *w, string prompt, int r, int c, int width,
00064                       string text = "");
00065             ~TextEntry();
00066 
00067             /* Methods */
00068             void draw(bool noRefresh = false);
00069             void activate();
00070 
00071             string getText();
00072             void   setText(const string &text);
00073             bool   wasAborted();
00074             void   canAbort(bool);
00075             bool   canAbort();
00076 
00077             void   reset();
00078 
00079             /* Commands */
00080             Object* finish_edit(Object*);
00081             Object* abort_edit(Object*);
00082             Object* insert_self(Object*);
00083             Object* cursor_left(Object*);
00084             Object* cursor_right(Object*);
00085             Object* delete_before(Object*);
00086             Object* delete_after(Object*);
00087             Object* delete_to_bol(Object*);
00088             Object* delete_to_eol(Object*);
00089             Object* cursor_bol(Object*);
00090             Object* cursor_eol(Object*);
00091             Object* clear(Object*);
00092             Object* prev_in_history(Object*);
00093             Object* next_in_history(Object*);
00094         };
00095     }
00096 }    
00097 
00098 #endif /* TEXTENTRY_H */

Generated at Tue Jan 2 15:38:34 2001 for SFW by doxygen1.2.4 written by Dimitri van Heesch, © 1997-2000