// -*- C++ -*- generated by wxGlade 0.6.3 on Thu Feb 19 10:54:56 2009
#ifndef MAINFRAME_H
#define MAINFRAME_H
#include <string>

#include "wx/wx.h"
#include "wx/image.h"
// begin wxGlade: ::dependencies
#include "wx/splitter.h"
#include "wx/treectrl.h"
#include "wx/statline.h"
#include "wx/notebook.h"
#include "wx/toolbook.h"
#include "wx/imaglist.h"
// end wxGlade


#include "DeMPQ.h"
#include "MPQParseObject.h"
#include "NotebookPanels.h"
#include "MPQDBCFieldObject.h"

// begin wxGlade: ::extracode
// end wxGlade


class CMainFrame: public wxFrame {
public:
    // begin wxGlade: CMainFrame::ids
    // end wxGlade

    CMainFrame(wxWindow* parent, int id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE);
	virtual ~CMainFrame();

private:
    // begin wxGlade: CMainFrame::methods
    void set_properties();
    void do_layout();
    // end wxGlade
	void InitFrame();
	void InitImageList();
	void DestroyImageList();
	void InitMenuBar();
	void InitToolBar();
	void InitStatusBar();
	void InitTreeCtrl(wxPanel* parent);
	void InitNotebook(wxPanel* parent);

	int InitObjects();

protected:
    // begin wxGlade: CMainFrame::attributes
    wxMenuBar* MainMenBar;
    wxStatusBar* MainStatusBar;
    wxToolBar* MainToolBar;
    wxStaticLine* static_line_1;
    wxTreeCtrl* m_ctrlTree;
    wxPanel* window_1_pane_1;
	wxToolbook* m_ctrlNotebook;
    wxPanel* window_1_pane_2;
    wxSplitterWindow* window_1;
    // end wxGlade
	wxComboBox* m_ctrlToolComboBox;
	wxImageList *m_imageList;

    DECLARE_EVENT_TABLE();

public:
	virtual void OnMenuFileExit(wxCommandEvent &event); // wxGlade: <event_handler>
	virtual void OnMenuHelpAbout(wxCommandEvent &event); // wxGlade: <event_handler>
	virtual void OnToolBarOpen(wxCommandEvent &event); // wxGlade: <event_handler>
	virtual void OnToolBarReload(wxCommandEvent &event); // wxGlade: <event_handler>
    virtual void OnTreeSelectChanged(wxTreeEvent &event); // wxGlade: <event_handler>
	virtual void OnTreeRightClick(wxTreeEvent &event); // wxGlade: <event_handler>
	virtual void OnTreeItemMenu(wxTreeEvent &event); // wxGlade: <event_handler>
	virtual void OnTreeItemActivated(wxTreeEvent &event); // wxGlade: <event_handler>
    virtual void OnNotebookPageChanged(wxToolbookEvent &event); // wxGlade: <event_handler>
	virtual void OnButtonInfoExport(wxCommandEvent &event); // wxGlade: <event_handler>
    virtual void OnNotebookPageChanging(wxToolbookEvent &event); // wxGlade: <event_handler>	

	virtual void OnMenuHelpTest(wxCommandEvent &event); // wxGlade: <event_handler>
	virtual void OnMenuViewTreeStyle(wxCommandEvent &event); // wxGlade: <event_handler>

	virtual void OnMenuParserDBC(wxCommandEvent &event); // wxGlade: <event_handler>
	virtual void OnMenuParserBLP(wxCommandEvent &event); // wxGlade: <event_handler>

	virtual void OnMenuSettingLoadDBCConfig(wxCommandEvent &event); // wxGlade: <event_handler>
public:
	void TreeRefresh(const wxString& rootfile);
	void TreeUpdateOver(unsigned int count);
	void TreeAppend(const MPQData::TFileData& data, unsigned int count);
	void NoteDataReadBegin(const wxString& file);
	void NoteDataReadEnd();
	void NoteDataRead(const char* data, size_t size);
private:
	int ScanMPQArchData(const wxString& arch, const wxString& filter);
	void DisplayItemInfo(unsigned int id);
	void DisplayItemData(unsigned int id);
	void DisplayItemData(const MPQData::TFileData* data);
	void DisplayItemMenu(unsigned int id, const wxPoint& pos);
	void ExportItemData(unsigned int id);
	int ParseItemData(unsigned int id);
private:
	int ExtractFileToCache(const std::string& file, std::string& cache);
	int ParseMPQDBCFile(const std::string& mpqfile, const std::string &cachefile, bool remove);
	int LoadMPQDBCConfigFile(const std::string& file, bool relaod);
	int ParseMPQBLPFile(const std::string& mpqfile, const std::string &cachefile, bool remove);
	int ParseMPQWaveFile(const std::string& mpqfile, const std::string &cachefile, bool remove);
private:
	unsigned int _uiLastSelectedItemID;
private:
	CDeMPQObject _objDeMPQ;
	CMPQTreeObject _objMPQTree;
	CMPQDataObject _objMPQData;
	CNotebookPanelManager _objNotebookPanelManager;
	CMPQDBCFieldManager _objMPQDBCFieldManager;
}; // wxGlade: end class


#endif // MAINFRAME_H
