///////////////////////////////////////////////////////////////////////////// // Name: suit.h // Author: David Roundy // Created: 3/2003 // Copyright: (c) 2003 David Roundy // Licence: GPL /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef SUIT_H #define SUIT_H #include #ifndef WX_PRECOMP #include #include #endif enum Suit { clubs=0, diamonds=1, hearts=2, spades=3, notrump=4 }; enum SuitColour { red = 0, black = 1 }; inline Suit String2Suit(wxString str) { str.MakeUpper(); if (str.StartsWith("C")) return clubs; if (str.StartsWith("D")) return diamonds; if (str.StartsWith("H")) return hearts; if (str.StartsWith("S")) return spades; if (str.StartsWith("N")) return notrump; printf("Got a bad suit string '%s'\n", str.c_str()); return notrump; } inline wxString Suit2String(Suit suit) { switch (suit) { case clubs: return "Clubs"; case diamonds: return "Diamonds"; case spades: return "Spades"; case notrump: return "No Trump"; case hearts: return "Hearts"; } return "Error"; } inline wxString Suit2Char(Suit suit) { switch (suit) { case clubs: return "C"; case diamonds: return "D"; case spades: return "S"; case notrump: return "NT"; case hearts: return "H"; } return "Error"; } void DrawSuit(wxDC &dc, Suit m_suit, int usd, int x, int y, int w, int h); void DrawSuitOnBM(wxDC &dc, Suit m_suit, int w, int h); void DrawNumber(wxDC &dc, const wxString &num, bool is_red, bool usd, int x, int y, int w, int h); #endif