00001 //$Id: mimaTerm.h,v 1.4 2006/07/01 15:43:33 der_martin Exp $ 00002 /* 00003 * mimasim -- a simulator of a minimal microprocessor system 00004 * Copyright (C) 2006 Martin Grandrath <gr@ndrath.de> 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License as 00008 * published by the Free Software Foundation; either version 2 of the 00009 * License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00019 * 02110-1301, USA. 00020 */ 00021 00022 #ifdef HAVE_CONFIG_H 00023 #include <config.h> 00024 #endif 00025 00026 #include <gtkmm/window.h> 00027 #include <gtkmm/box.h> 00028 #include <gtkmm/frame.h> 00029 #include <gtkmm/entry.h> 00030 #include <gtkmm/scrolledwindow.h> 00031 #include <gtkmm/textview.h> 00032 #include <glibmm.h> 00033 00034 #include <mima.h> // for MimaSim::State 00035 00037 namespace MimaGtk { 00038 00040 class MimaTermOut : public Gtk::Frame 00041 { 00042 protected: 00043 /* 00044 * member widgets 00045 * ============== 00046 */ 00047 Gtk::ScrolledWindow m_scrolledwindow; 00048 Gtk::TextView m_textview; 00049 00050 public: 00051 MimaTermOut(); 00052 ~MimaTermOut(); 00053 00055 void reset(); 00056 00058 void add_char(char c); 00059 }; 00060 00062 class MimaTermIn : public Gtk::Frame 00063 { 00064 protected: 00065 /* 00066 * member widgets 00067 * ============== 00068 */ 00069 Gtk::Entry m_entry; 00070 00071 public: 00072 MimaTermIn(); 00073 ~MimaTermIn(); 00074 00076 char get_char(); 00077 void entry_unset_base(); 00078 }; 00079 00081 00084 class MimaTerm : public Gtk::Window 00085 { 00086 private: 00087 /* 00088 * private attributes 00089 * ================== 00090 */ 00091 int m_address_in, m_address_out; 00092 00093 protected: 00094 /* 00095 * member widgets 00096 * ============== 00097 */ 00098 MimaTermOut m_term_out; 00099 MimaTermIn m_term_in; 00100 Gtk::VBox m_vbox; 00101 00102 public: 00103 MimaTerm(int addr_in = 0, int addr_out = 0); 00104 ~MimaTerm(); 00105 00106 /* 00107 * public members 00108 * ============== 00109 */ 00110 void set_address(int addr_in, int addr_out); 00111 void set_address_in(int addr_in); 00112 void set_address_out(int addr_out); 00113 int get_address_in() { return m_address_in; }; 00114 int get_address_out() { return m_address_out; }; 00115 00116 void hide(); 00117 00118 /* 00119 * signal handlers 00120 * =============== 00121 */ 00123 void on_state_changed(MimaSim::State state); 00124 void on_mima_out(int addr, char c); 00125 char on_mima_in(int addr); 00126 }; 00127 00128 }
1.4.7