00001 /* 00002 * Metroid Password Generator 00003 * Copyright (C) 2005 emuWorks 00004 * http://games.technoplaza.net/ 00005 * 00006 * This file is part of Metroid Password Generator. 00007 * 00008 * Metroid Password Generator is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * Metroid Password Generator is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with Metroid Password Generator; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 // $Id: PasswordTextCtrl.hh,v 1.3 2005/09/30 10:01:46 technoplaza Exp $ 00024 00025 #ifndef _PASSWORDTEXTCTRL_HH_ 00026 #define _PASSWORDTEXTCTRL_HH_ 00027 00028 namespace mpg { 00029 /// Custom text control used to enter Metroid passwords 00030 class PasswordTextCtrl : public wxTextCtrl { 00031 DECLARE_DYNAMIC_CLASS(PasswordTextCtrl) 00032 DECLARE_EVENT_TABLE() 00033 00034 private: 00035 /** 00036 * Called when a char is typed into this PasswordTextCtrl. 00037 * 00038 * @param event The triggering wxKeyEvent. 00039 */ 00040 void onChar(wxKeyEvent &event); 00041 00042 /** 00043 * Called when a key is pressed in this PasswordTextCtrl. 00044 * 00045 * @param event The triggering wxKeyEvent. 00046 */ 00047 void onKeyDown(wxKeyEvent &event); 00048 00049 public: 00050 /** 00051 * Gets the password text, sans spaces. 00052 * 00053 * @return The password text. 00054 */ 00055 wxString GetValue() const; 00056 00057 /** 00058 * Sets the password text, inserting the segment separators. 00059 * 00060 * @param value The password text. 00061 */ 00062 virtual void SetValue(const wxString &value); 00063 00064 /** 00065 * Pastes the contents of the Clipboard onto this PasswordTextCtrl. 00066 */ 00067 virtual void Paste(); 00068 00069 /** 00070 * Replaces a section of this PasswordTextCtrl with a new value. 00071 * 00072 * @param from The position to start replacing at. 00073 * @param to The position to replace up to (but not including). 00074 * @param value The string to replace with. 00075 */ 00076 virtual void Replace(long from, long to, const wxString &value); 00077 }; 00078 } 00079 00080 #endif 00081