PasswordPanel.hh

Go to the documentation of this file.
00001 /*
00002  * Metroid Password Generator
00003  * Copyright (C) 2005,2007-2008 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: PasswordPanel.hh,v 1.5 2008/12/17 00:23:12 jdratlif Exp $
00024 
00025 #ifndef MPG_PASSWORDPANEL_HH_
00026 #define MPG_PASSWORDPANEL_HH_
00027 
00028 namespace mpg {
00029     class Password;
00030     
00031     /// class to display a password in Metroid font and style
00032     class PasswordPanel : public wxPanel {
00033         DECLARE_DYNAMIC_CLASS(PasswordPanel)
00034         DECLARE_EVENT_TABLE()
00035         
00036     private:
00037         wxBitmap alphabet;
00038         const Password *password;
00039         
00040         static const int START_X = 4;
00041         static const int START_Y = 4;
00042         static const int CHARS_PER_ROW = 13;
00043         static const int CHAR_WIDTH = 16;
00044         static const int CHAR_HEIGHT = 16;
00045         
00046         /**
00047          * Gets the upper-left corner position of a letter in the alphabet
00048          * bitmap.
00049          *
00050          * @param letter The letter to find.
00051          *
00052          * @return The (x,y) position of the letter.
00053          */
00054         wxPoint getLetterPos(wxChar letter) const;
00055     
00056         /**
00057          * Called to erase the background on this PasswordPanel.
00058          *
00059          * @param event The triggering wxEraseEvent (unused).
00060          */
00061         void onEraseBackground(wxEraseEvent &event);
00062         
00063         /**
00064          * Called to paint this PasswordPanel.
00065          *
00066          * @param event The triggering wxPaintEvent (unused).
00067          */
00068         void onPaint(wxPaintEvent &event);
00069         
00070     public:
00071         /**
00072          * Creates a new PasswordPanel.
00073          */
00074         PasswordPanel();
00075     
00076         /**
00077          * Sets the password string drawn by this PasswordPanel.
00078          *
00079          * @param password The password.
00080          */
00081         void setPassword(const Password *password);
00082     };
00083     
00084     inline void PasswordPanel::setPassword(const Password *password)
00085         { this->password = password; }
00086     inline void PasswordPanel::onEraseBackground(wxEraseEvent &) {}
00087 }
00088 
00089 #endif
00090 

Generated on Tue Dec 16 20:16:57 2008 for Metroid Password Generator by  doxygen 1.5.4