case.h

00001 /***************************************************************************
00002  *   Copyright (C) 2007 by Mike Polan                                      *
00003  *   kanadakid@gmail.com                                                   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
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  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 // case.h: various Case related classes
00021 
00022 #ifndef CASE_H
00023 #define CASE_H
00024 
00025 #include <gdkmm/pixbuf.h>
00026 #include <glibmm/ustring.h>
00027 #include <gtkmm/textbuffer.h>
00028 #include <map>
00029 #include <vector>
00030 
00031 #include "character.h"
00032 
00034 struct _Rect {
00036         int x;
00037         
00039         int y;
00040         
00042         int w;
00043         
00045         int h;
00046 };
00047 typedef struct _Rect Rect;
00048 
00049 
00051 namespace Case {
00052 
00054 enum LawSystem { SINGLE_TRIAL=1, TWO_DAY, THREE_DAY };
00055 
00057 enum BackgroundType { BG_SINGLE_SCREEN=0, BG_DOUBLE_SCREEN };
00058 
00060 struct _Overview {
00062         Glib::ustring name;
00063         
00065         Glib::ustring author;
00066         
00068         LawSystem lawSys;
00069 };
00070 typedef struct _Overview Overview;
00071 
00073 struct _Overrides {
00075         int textboxAlpha;
00076         
00078         Glib::ustring titleScreen;
00079 };
00080 typedef struct _Overrides Overrides;
00081 
00083 struct _Background {
00085         Glib::ustring id;
00086         
00088         BackgroundType type;
00089         
00091         Glib::RefPtr<Gdk::Pixbuf> pixbuf;
00092 };
00093 typedef struct _Background Background;
00094 
00096 struct _Evidence {
00098         Glib::ustring id;
00099         
00101         Glib::ustring name;
00102         
00104         Glib::ustring caption;
00105         
00107         Glib::ustring description;
00108         
00110         Glib::ustring checkID;
00111         
00113         Glib::RefPtr<Gdk::Pixbuf> pixbuf;
00114 };
00115 typedef struct _Evidence Evidence;
00116 
00118 struct _Hotspot {
00120         Rect rect;
00121         
00123         Glib::ustring block;
00124 };
00125 typedef struct _Hotspot Hotspot;
00126 
00128 struct _Location {
00130         Glib::ustring id;
00131         
00133         Glib::ustring name;
00134         
00136         Glib::ustring bg;
00137         
00139         std::vector<Hotspot> hotspots;
00140 };
00141 typedef struct _Location Location;
00142 
00144 struct _Audio {
00146         Glib::ustring id;
00147         
00149         Glib::ustring name;
00150 };
00151 typedef struct _Audio Audio;
00152 
00154 struct _Image {
00156         Glib::ustring id;
00157         
00159         Glib::RefPtr<Gdk::Pixbuf> pixbuf;
00160 };
00161 typedef struct _Image Image;
00162 
00164 struct _TestimonyPiece {
00166         Glib::ustring text;
00167         
00169         Glib::ustring presentId;
00170         
00172         Glib::ustring presentBlock;
00173         
00175         Glib::ustring pressBlock;
00176         
00178         bool hidden;
00179 };
00180 typedef struct _TestimonyPiece TestimonyPiece;
00181 
00183 struct _Testimony {
00185         Glib::ustring id;
00186         
00188         Glib::ustring title;
00189         
00191         Glib::ustring speaker;
00192         
00194         Glib::ustring nextBlock;
00195         
00197         Glib::ustring followLoc;
00198         
00200         Glib::ustring xExamineEndBlock;
00201         
00203         std::vector<TestimonyPiece> pieces;
00204 };
00205 typedef struct _Testimony Testimony;
00206 
00207 }; // namespace Case
00208 
00209 // typedefs for cleaner code
00210 typedef std::map<Glib::ustring, Character> CharacterMap;
00211 typedef std::map<Glib::ustring, Case::Background> BackgroundMap;
00212 typedef std::map<Glib::ustring, Case::Evidence> EvidenceMap;
00213 typedef std::map<Glib::ustring, Case::Location> LocationMap;
00214 typedef std::map<Glib::ustring, Case::Audio> AudioMap;
00215 typedef std::map<Glib::ustring, Case::Image> ImageMap;
00216 typedef std::map<Glib::ustring, Case::Testimony> TestimonyMap;
00217 typedef std::map<Glib::ustring, Glib::RefPtr<Gtk::TextBuffer> > BufferMap;
00218 typedef std::vector<Glib::ustring> StringVector;
00219 typedef std::pair<Glib::ustring, Glib::ustring> StringPair;
00220 
00221 namespace Case {
00222 
00227 class Case {
00228         public:
00230                 Case();
00231                 
00235                 void set_overview(const Overview &overview);
00236                 
00240                 Overview get_overview() const { return m_Overview; }
00241                 
00245                 void set_overrides(const Overrides &ov) { m_Overrides=ov; }
00246                 
00250                 Overrides get_overrides() const { return m_Overrides; }
00251                 
00255                 void set_initial_block_id(const Glib::ustring &id) { m_InitialBlockId=id; }
00256                 
00260                 Glib::ustring get_initial_block_id() const { return m_InitialBlockId; }
00261                 
00265                 void add_character(const Character &character);
00266                 
00270                 void remove_character(const Glib::ustring &name);
00271                 
00275                 void add_image(const Image &image);
00276                 
00280                 void remove_image(const Glib::ustring &id);
00281                 
00285                 void add_testimony(const Testimony &testimony);
00286                 
00290                 void remove_testimony(const Glib::ustring &id);
00291                 
00295                 void add_background(const Background &bg);
00296                 
00300                 void remove_background(const Glib::ustring &id);
00301                 
00305                 void add_evidence(const Evidence &evidence);
00306                 
00310                 void remove_evidence(const Glib::ustring &id);
00311                 
00315                 void add_location(const Location &loc);
00316                 
00320                 void remove_location(const Glib::ustring &id);
00321                 
00325                 void add_audio(const Audio &audio);
00326                 
00330                 StringVector get_character_names();
00331                 
00335                 StringVector get_image_ids();
00336                 
00340                 StringVector get_background_ids();
00341                 
00345                 StringVector get_evidence_ids();
00346                 
00350                 StringVector get_location_ids();
00351                 
00355                 StringVector get_audio_ids();
00356                 
00360                 StringVector get_testimony_ids();
00361                 
00363                 void clear();
00364                 
00366                 void clear_backgrounds() { m_Backgrounds.clear(); }
00367                 
00369                 void clear_images() { m_Images.clear(); }
00370                 
00372                 void clear_characters() { m_Characters.clear(); }
00373                 
00375                 void clear_evidence() { m_Evidence.clear(); }
00376                 
00378                 void clear_locations() { m_Locations.clear(); }
00379                 
00381                 void clear_audio() { m_Audio.clear(); }
00382                 
00384                 void clear_testimonies() { m_Testimonies.clear(); }
00385                 
00389                 CharacterMap get_characters() const { return m_Characters; }
00390                 
00394                 ImageMap get_images() const { return m_Images; }
00395                 
00399                 BackgroundMap get_backgrounds() const { return m_Backgrounds; }
00400                 
00404                 EvidenceMap get_evidence() const { return m_Evidence; }
00405                 
00409                 LocationMap get_locations() const { return m_Locations; }
00410                 
00414                 AudioMap get_audio() const { return m_Audio; }
00415                 
00419                 TestimonyMap get_testimonies() const { return m_Testimonies; }
00420         
00421         private:
00423                 Overrides m_Overrides;
00424                 
00426                 Overview m_Overview;
00427                 
00429                 Glib::ustring m_InitialBlockId;
00430                 
00432                 CharacterMap m_Characters;
00433                 
00435                 ImageMap m_Images;
00436                 
00438                 BackgroundMap m_Backgrounds;
00439                 
00441                 EvidenceMap m_Evidence;
00442                 
00444                 LocationMap m_Locations;
00445                 
00447                 AudioMap m_Audio;
00448                 
00450                 TestimonyMap m_Testimonies;
00451                 
00452 };
00453 
00454 }; // namespace Case
00455 
00456 #endif

Generated on Fri Feb 22 22:34:17 2008 for Phoenix Wright Case Editor API by  doxygen 1.5.3