00001 /*************************************************************************** 00002 * Copyright (C) 2005 by David Saxton * 00003 * david@bluehaze.org * 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 00011 #include "config.h" 00012 #ifndef NO_GPSIM 00013 00014 #ifndef SYMBOLVIEWER_H 00015 #define SYMBOLVIEWER_H 00016 00017 #include <klistview.h> 00018 #include <qguardedptr.h> 00019 00020 class KComboBox; 00021 class RegisterInfo; 00022 class RegisterSet; 00023 class SymbolViewer; 00024 namespace KateMDI { class ToolView; } 00025 00026 00030 class SymbolViewer : public QWidget 00031 { 00032 Q_OBJECT 00033 public: 00034 static SymbolViewer * self( KateMDI::ToolView * parent = 0 ); 00035 static QString toolViewIdentifier() { return "SymbolViewer"; } 00036 ~SymbolViewer(); 00037 00038 enum Radix 00039 { 00040 Binary = 2, 00041 Octal = 8, 00042 Decimal = 10, 00043 Hexadecimal = 16 00044 }; 00045 00046 Radix valueRadix() const { return m_valueRadix; } 00047 00048 KListView * symbolList() const { return m_pSymbolList; } 00053 void saveProperties( KConfig * config ); 00058 void readProperties( KConfig * config ); 00059 00060 void setContext( GpsimProcessor * gpsim ); 00065 QString toDisplayString( unsigned value ) const; 00066 00067 signals: 00068 void valueRadixChanged( SymbolViewer::Radix newRadix ); 00069 00070 public slots: 00071 void selectRadix( int selectIndex ); 00072 00073 protected: 00074 QGuardedPtr<GpsimProcessor> m_pGpsim; 00075 RegisterSet * m_pCurrentContext; 00076 KListView * m_pSymbolList; 00077 Radix m_valueRadix; 00078 00079 private: 00080 SymbolViewer( KateMDI::ToolView * parent ); 00081 static SymbolViewer * m_pSelf; 00082 KComboBox * m_pRadixCombo; 00083 }; 00084 00085 00086 class SymbolViewerItem : public QObject, public KListViewItem 00087 { 00088 Q_OBJECT 00089 public: 00090 SymbolViewerItem( SymbolViewer * symbolViewer, RegisterInfo * registerInfo ); 00091 00092 public slots: 00093 void valueChanged( unsigned newValue ); 00094 void radixChanged(); 00095 00096 protected: 00097 RegisterInfo * m_pRegisterInfo; 00098 SymbolViewer * m_pSymbolViewer; 00099 }; 00100 00101 #endif 00102 00103 #endif
1.5.1