C:/Projets/hexamonkey/gui/hex/hexfilewidget.h
Go to the documentation of this file.
00001 //This file is part of the HexaMonkey project, a multimedia analyser
00002 //Copyright (C) 2013  Sevan Drapeau-Martin, Nicolas Fleury
00003 
00004 //This program is free software; you can redistribute it and/or
00005 //modify it under the terms of the GNU General Public License
00006 //as published by the Free Software Foundation; either version 2
00007 //of the License, or (at your option) any later version.
00008 
00009 //This program is distributed in the hope that it will be useful,
00010 //but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 //GNU General Public License for more details.
00013 
00014 //You should have received a copy of the GNU General Public License
00015 //along with this program; if not, write to the Free Software
00016 //Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00017 
00018 #ifndef WINDOW_H
00019 #define WINDOW_H
00020 
00021 #include <QtGui>
00022 #include <QWidget>
00023 #include <QLineEdit>
00024 #include <QMenu>
00025 
00026 
00027 #include "gui/hex/hexfilemodel.h"
00028 #include "gui/hex/hexfileview.h"
00029 #include "gui/hex/hexfiledelegate.h"
00030 #include "gui/hex/hexfileheader.h"
00031 #include "gui/hex/hexfilesearchwidget.h"
00032 #include "gui/tree/treewidget.h"
00033 #include "gui/tree/treeobjectitem.h"
00034 
00053 class HexFileWidget : public QWidget
00054 {
00055     Q_OBJECT
00056 
00057 public:
00058     HexFileWidget(QWidget *parent=0);
00059 
00060     HexFileView *view;
00061     HexFileHeader *header;
00062     HexFileModel *model;
00063     HexFileSearchWidget *searchWidget;
00064 
00065     unsigned int hexWidth() const;
00066     unsigned int charWidth() const;
00067 
00068 signals:
00069     void selected(qint64);
00070     void focusedIn();
00071     void focusedOut();
00072 
00073 public slots:
00074     void setFile(const QString& path);
00075     void gotoPosition(qint64 position);
00076     void selectPosition(qint64 position);
00077     void highlight(qint64 position, qint64 size);
00078 
00079     void focus(const QModelIndex& index);
00080     void focus(qint64 position);
00081 
00082     void select(const QModelIndex& index);
00083     void select(qint64 position);
00084 
00085     void focusIn();
00086     void focusOut();
00087 
00088     void search(QByteArray pattern, bool next);
00089     void focusSearch();
00090 
00091     void displayMenu(const QPoint &pos);
00092 
00093 protected:
00094     void focusInEvent (QFocusEvent *event);
00095     void focusOutEvent(QFocusEvent *event);
00096     void windowActivationChange(bool oldActive);
00097 
00098 private:
00099     QScrollBar*   scrollBar;
00100 
00101     unsigned int _hexWidth;
00102     unsigned int _charWidth;
00103 };
00104 
00105 #endif