auxframes.h

Go to the documentation of this file.
00001 /* Eliot                                                                     */
00002 /* Copyright (C) 1999  Antoine Fraboulet                                     */
00003 /*                                                                           */
00004 /* This file is part of Eliot.                                               */
00005 /*                                                                           */
00006 /* Eliot is free software; you can redistribute it and/or modify             */
00007 /* it under the terms of the GNU General Public License as published by      */
00008 /* the Free Software Foundation; either version 2 of the License, or         */
00009 /* (at your option) any later version.                                       */
00010 /*                                                                           */
00011 /* Eliot 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00019 
00020 /**
00021  *  \file   auxframes.h
00022  *  \brief  Window Frames used in Eliot
00023  *  \author Antoine Fraboulet
00024  *  \date   2005
00025  */
00026 
00027 #ifndef _AUXFRAMES_H
00028 #define _AUXFRAMES_H
00029 
00030 #include "wx/frame.h"
00031 #include "wx/listctrl.h"
00032 #include "wx/textctrl.h"
00033 #include "wx/stattext.h"
00034 #include "wx/listbox.h"
00035 #include "wx/button.h"
00036 
00037 #include "searchpanel.h"
00038 #include "gfxboard.h"
00039 #include "gfxresult.h"
00040 
00041 #define MIN_FRAME_ID 0
00042 #define MAX_FRAME_ID 9
00043 
00044 typedef enum {
00045     ID_Frame_Verif   = MIN_FRAME_ID + 0,
00046     ID_Frame_Search  = MIN_FRAME_ID + 1,
00047     ID_Frame_Plus1   = MIN_FRAME_ID + 2,
00048     ID_Frame_Racc    = MIN_FRAME_ID + 3,
00049     ID_Frame_Benj    = MIN_FRAME_ID + 4,
00050     ID_Frame_Bag     = MIN_FRAME_ID + 5,
00051     ID_Frame_Board   = MIN_FRAME_ID + 6,
00052     ID_Frame_Game    = MIN_FRAME_ID + 7,
00053     ID_Frame_Result  = MIN_FRAME_ID + 8
00054 } frames_id_t;
00055 
00056 /**
00057  * Generic AuxFrame :
00058  *       - BoardFrame
00059  *       - BagFrame
00060  *       - SearchFrame
00061  *       - VerifFrame
00062  *       - ResultFrame
00063  * derived to AuxFrameList :
00064  *       - Plus1Frame
00065  *       - BenjFrame
00066  *       - RaccFrame
00067  * derived to AuxFrameText :
00068  *       - GameFrame
00069  *
00070  */
00071 
00072 class AuxFrame: public wxFrame
00073 {
00074 protected:
00075     int         show;
00076     frames_id_t frameid;
00077     wxString    name, classname;
00078     ConfigDB    config;
00079 
00080 public:
00081     AuxFrame (wxFrame*, int, wxString, wxString);
00082     ~AuxFrame();
00083 
00084     typedef enum {
00085         REFRESH,
00086         FORCE_REFRESH
00087     } refresh_t;
00088 
00089     void SwitchDisplay();
00090     void Reload();
00091     virtual void Refresh(refresh_t force = REFRESH) {};
00092 };
00093 
00094 /**
00095  * Generic auxframe that includes a list and a """copy""" button
00096  */
00097 
00098 class AuxFrameList: public AuxFrame
00099 {
00100 protected:
00101     bool      noresult;
00102     string    savedword;
00103     Game      *game;
00104     wxButton  *button;
00105     wxListBox *listbox;
00106     void Waiting();
00107     virtual void refresh() = 0;
00108 public:
00109     AuxFrameList(wxFrame*, int, wxString, wxString, Game*);
00110     void OnCopy(wxCommandEvent& event);
00111     void Refresh(refresh_t force = REFRESH);
00112     DECLARE_EVENT_TABLE()
00113 };
00114 
00115 /**
00116  * Generic auxframe that includes a text area
00117  */
00118 
00119 class AuxFrameText: public AuxFrame
00120 {
00121  protected:
00122     wxTextCtrl *textbox;
00123  public:
00124     AuxFrameText(wxFrame*, int, wxString, wxString, int);
00125 };
00126 
00127 /**
00128  * Frame to display the game board
00129  */
00130 
00131 class BoardFrame: public AuxFrame
00132 {
00133 protected:
00134     GfxBoard *board;
00135 public:
00136     BoardFrame(wxFrame*, Game&);
00137     void Refresh(refresh_t force = REFRESH);
00138 };
00139 
00140 /**
00141  * Frame to display the tiles left in the bag
00142  */
00143 
00144 class BagFrame: public AuxFrame
00145 {
00146 private:
00147     Game& m_game;
00148     wxListCtrl *tiles;
00149 public:
00150     BagFrame(wxFrame*, Game&);
00151     void Refresh(refresh_t force = REFRESH);
00152 };
00153 
00154 /**
00155  * Several research tool in a panel widget within the frame
00156  */
00157 
00158 class SearchFrame: public AuxFrame
00159 {
00160 private:
00161     SearchPanel *panel;
00162 public:
00163     SearchFrame(wxFrame*, Dictionary);
00164     void Refresh(refresh_t force = REFRESH);
00165 };
00166 
00167 /**
00168  * Frame to verify if a word is in the dictionary
00169  */
00170 
00171 class VerifFrame: public AuxFrame
00172 {
00173 protected:
00174     Dictionary dic;
00175     wxTextCtrl *word;
00176     wxStaticText *result;
00177     void verif();
00178 public:
00179     VerifFrame(wxFrame*, Dictionary);
00180     void OnText(wxCommandEvent& event);
00181     void Refresh(refresh_t force = REFRESH);
00182     DECLARE_EVENT_TABLE()
00183 };
00184 
00185 /**
00186  * Displays the list of 7+1 for the current search
00187  */
00188 
00189 class Plus1Frame: public AuxFrameList
00190 {
00191 protected:
00192     virtual void refresh();
00193 public:
00194     Plus1Frame(wxFrame* p, Game* g) : AuxFrameList(p, ID_Frame_Plus1, wxT("Tirage + 1"), FRAMEPLUS1, g) {};
00195 };
00196 
00197 /**
00198  * Displays the list of benjamins for the current selected word
00199  */
00200 
00201 class BenjFrame: public AuxFrameList
00202 {
00203 protected:
00204     virtual void refresh();
00205 public:
00206     BenjFrame(wxFrame* p, Game* g) : AuxFrameList(p, ID_Frame_Benj, wxT("benjamins"), FRAMEBENJ, g) {};
00207 };
00208 
00209 /**
00210  * Displays the list of possible glue letter for the current selected word
00211  */
00212 
00213 class RaccFrame: public AuxFrameList
00214 {
00215 protected:
00216     virtual void refresh();
00217 public:
00218     RaccFrame(wxFrame* p, Game* g) : AuxFrameList(p, ID_Frame_Racc, wxT("raccords"), FRAMERACC, g) {};
00219 };
00220 
00221 /**
00222  * Displays the current game
00223  */
00224 
00225 class GameFrame: public AuxFrameText
00226 {
00227 protected:
00228     Game& m_game;
00229 public:
00230     GameFrame(wxFrame*, Game&);
00231     void Refresh(refresh_t force = REFRESH);
00232 };
00233 
00234 /**
00235  * Displays the list of possible words searched for the given rack and board
00236  */
00237 
00238 class ResultFrame: public AuxFrame
00239 {
00240  protected:
00241     GfxResult *reslist;
00242  public:
00243     ResultFrame(wxFrame*, Game*);
00244     void Search();
00245     int  GetSelected();
00246     void Refresh(refresh_t force = REFRESH);
00247     void OnSize(wxSizeEvent& e);
00248     DECLARE_EVENT_TABLE()
00249 };
00250 
00251 #endif
00252 
00253 /// Local Variables:
00254 /// mode: c++
00255 /// mode: hs-minor
00256 /// c-basic-offset: 4
00257 /// End:

Generated on Thu Dec 29 02:01:15 2005 for Eliot by  doxygen 1.4.5