Planeshift

pawsstringpromptwindow.h

Go to the documentation of this file.
00001 /*
00002  * pawsstringpromptwindow.h - Author: Ondrej Hurt
00003  *
00004  * Copyright (C) 2003 Atomic Blue ([email protected], http://www.atomicblue.org)
00005  *
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation (version 2 of the License)
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  *
00018  */
00019 
00020 #ifndef PAWS_STRING_PROMPT_WINDOW_HEADER
00021 #define PAWS_STRING_PROMPT_WINDOW_HEADER
00022 
00023 #include <csutil/list.h>
00024 #include <iutil/document.h>
00025 #include "pawspromptwindow.h"
00026 
00027 class pawsButton;
00028 
00037 class iOnStringEnteredAction
00038 {
00039 public:
00046     virtual void OnStringEntered(const char* name, int param,const char* value) = 0;
00047 
00049     virtual ~iOnStringEnteredAction() {};
00050 };
00051 
00055 class pawsStringPromptWindow : public pawsPromptWindow
00056 {
00057 public:
00059     pawsStringPromptWindow();
00060     pawsStringPromptWindow(const pawsStringPromptWindow &origin);
00069     bool OnButtonReleased(int mouseButton, int keyModifier, pawsWidget* widget);
00070 
00079     virtual bool OnKeyDown(utf32_char keyCode, utf32_char keyChar, int modifiers);
00080 
00087     virtual bool OnChange(pawsWidget* widget);
00088 
00104     static pawsStringPromptWindow* Create(
00105         const csString &label,
00106         const csString &string, bool multiline, int width, int height,
00107         iOnStringEnteredAction* action,const char* name,int param = 0,
00108         bool modal = false, int maxlen = 0);
00109 
00110 protected:
00123     void Initialize(const csString &label, const csString &string, bool multiline, int width,
00124                     int height, iOnStringEnteredAction* action, const char* name, int param = 0, int maxlen = 0);
00125 
00131     void CloseWindow(const csString &text);
00132 
00136     void CloseWindow();
00137 
00141     bool multiLine;
00145     iOnStringEnteredAction* action;
00149     csString name;
00153     int param;
00154 };
00155 
00156 CREATE_PAWS_FACTORY(pawsStringPromptWindow);
00157 
00160 #endif
00161