spriteeditor.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 // spriteeditor.h: the SpriteEditor class
00021 
00022 #ifndef SPRITEEDITOR_H
00023 #define SPRITEEDITOR_H
00024 
00025 #include <gtkmm/button.h>
00026 #include <gtkmm/checkbutton.h>
00027 #include <gtkmm/comboboxtext.h>
00028 #include <gtkmm/dialog.h>
00029 #include <gtkmm/entry.h>
00030 #include <gtkmm/label.h>
00031 #include <gtkmm/image.h>
00032 #include <gtkmm/progressbar.h>
00033 #include <gtkmm/window.h>
00034 
00035 #include "sprite.h"
00036 
00041 class SpriteEditor: public Gtk::Window {
00042         public:
00044                 SpriteEditor();
00045                 
00047                 void clear();
00048                 
00052                 void set_sprite_data(const Sprite &spr);
00053                 
00057                 Sprite get_sprite_data() const { return m_Sprite; }
00058                 
00059         private:
00061                 void construct();
00062                 
00064                 void update_progress_label();
00065                 
00067                 void on_save();
00068                 
00070                 void on_export();
00071                 
00073                 void on_close();
00074                 
00076                 void on_preview_animation();
00077                 
00079                 void on_loop_cb_toggled();
00080                 
00082                 void on_anim_cb_changed();
00083                 
00085                 void on_amend_button_clicked();
00086                 
00088                 void on_new_animation_button_clicked();
00089                 
00091                 void on_delete_animation_button_clicked();
00092                 
00094                 void on_add_frame_button_clicked();
00095                 
00097                 void on_delete_frame_button_clicked();
00098                 
00100                 void on_prev_frame_button_clicked();
00101                 
00103                 void on_next_frame_button_clicked();
00104                 
00105                 // labels
00106                 Gtk::Label *m_AnimLabel;
00107                 Gtk::Label *m_FrameLabel;
00108                 Gtk::Label *m_TimeLabel;
00109                 Gtk::Label *m_SfxLabel;
00110                 
00111                 // check buttons
00112                 Gtk::CheckButton *m_LoopCB;
00113                 
00114                 // entries
00115                 Gtk::Entry *m_TimeEntry;
00116                 Gtk::Entry *m_SfxEntry;
00117                 
00118                 // image for viewing frames
00119                 Gtk::Image *m_Image;
00120                 
00121                 // buttons
00122                 Gtk::Button *m_SaveButton;
00123                 Gtk::Button *m_ExportButton;
00124                 Gtk::Button *m_CloseButton;
00125                 Gtk::Button *m_PreviewButton;
00126                 Gtk::Button *m_NewAnimButton;
00127                 Gtk::Button *m_DeleteAnimButton;
00128                 Gtk::Button *m_AddFrameButton;
00129                 Gtk::Button *m_DeleteFrameButton;
00130                 Gtk::Button *m_PrevFrameButton;
00131                 Gtk::Button *m_NextFrameButton;
00132                 Gtk::Button *m_AmendButton;
00133                 
00134                 // combo box
00135                 Gtk::ComboBoxText *m_AnimCB;
00136                 
00138                 Glib::ustring m_SpritePath;
00139                 
00141                 Sprite m_Sprite;
00142                 
00144                 int m_CurFrame;
00145 };
00146 
00151 class AnimPlayer: public Gtk::Dialog {
00152         public:
00156                 AnimPlayer(const Animation &anim);
00157                 
00158         private:
00160                 void construct();
00161                 
00162                 // timeout for new frame
00163                 bool on_timeout();
00164                 
00165                 // play button click handler
00166                 void on_play_clicked();
00167                 
00168                 // stop button click handler
00169                 void on_stop_clicked();
00170                 
00171                 // image for viewing a frame
00172                 Gtk::Image *m_FrameImg;
00173                 
00174                 // labels
00175                 Gtk::Label *m_AnimLabel;
00176                 
00177                 // progress bar
00178                 Gtk::ProgressBar *m_ProgBar;
00179                 
00180                 // buttons for control
00181                 Gtk::Button *m_PlayButton;
00182                 Gtk::Button *m_StopButton;
00183                 
00184                 // connection to timer slot
00185                 sigc::connection m_TimerSlot;
00186                 
00188                 int m_CurFrame;
00189                 
00191                 Animation m_Animation;
00192 };
00193 
00194 #endif

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