00001 // -*- c++ -*- 00002 //------------------------------------------------------------------------------ 00003 // PrefWindow.h 00004 //------------------------------------------------------------------------------ 00005 // $Id: PrefWindow.h,v 1.6 2003/02/07 05:15:10 vlg Exp $ 00006 //------------------------------------------------------------------------------ 00007 // Copyright (c) 2001,2002 by Vladislav Grinchenko 00008 // 00009 // This program is free software; you can redistribute it and/or 00010 // modify it under the terms of the GNU General Public License 00011 // as published by the Free Software Foundation; either version 00012 // 2 of the License, or (at your option) any later version. 00013 //------------------------------------------------------------------------------ 00014 // Created: 01/04/2002 00015 //------------------------------------------------------------------------------ 00016 #ifndef PREF_WINDOW_H 00017 #define PREF_WINDOW_H 00018 00019 #include <libgnomeuimm/file-entry.h> 00020 #include <gtkmm/entry.h> 00021 #include <gtkmm/main.h> 00022 00023 #include "MyPropertyBox.h" 00024 #include "MergeMapPref.h" 00025 00026 class Config; 00027 00028 class PrefWindow : public MyPropertyBox 00029 { 00030 public: 00031 PrefWindow (Config& config_); 00032 ~PrefWindow(); 00033 00034 bool run (); 00035 00036 virtual void apply_impl (); 00037 virtual void close_impl (); 00038 00039 void changed_cb (); 00040 void ok_cb (); 00041 void apply_cb (); 00042 void cancel_cb (); 00043 00044 const char* get_project_name () const; 00045 const char* get_project_path () const; 00046 00047 const char* get_A_prefix () const; 00048 const char* get_B_prefix () const; 00049 const char* get_A_dir () const; 00050 const char* get_B_dir () const; 00051 00052 private: 00053 void stop (); 00054 void dump () const; 00055 00056 private: 00057 Gnome::UI::FileEntry* m_path_entry; 00058 00059 Gtk::Entry* m_proj_name; 00060 Gtk::Entry* m_A_prefix; 00061 Gtk::Entry* m_B_prefix; 00062 Gtk::Entry* m_A_dir; 00063 Gtk::Entry* m_B_dir; 00064 00065 Config& m_config; 00066 MergeMapPref m_merge_map_pref; 00067 bool m_ignore_callbacks; 00068 bool m_changed; 00069 }; 00070 00071 inline 00072 00073 PrefWindow::~PrefWindow () 00074 { 00075 trace("PrefWindow::~PrefWindow"); 00076 /* no-op */ 00077 } 00078 00079 inline const char* 00080 00081 PrefWindow::get_project_name () const 00082 { 00083 return m_proj_name->get_text ().c_str (); 00084 } 00085 00086 inline const char* 00087 00088 PrefWindow::get_project_path () const 00089 { 00090 return m_path_entry->get_full_path (false).c_str (); 00091 } 00092 00093 inline const char* 00094 00095 PrefWindow::get_A_prefix () const 00096 { 00097 return m_A_prefix->get_text ().c_str (); 00098 } 00099 00100 inline const char* 00101 00102 PrefWindow::get_B_prefix () const 00103 { 00104 return m_B_prefix->get_text ().c_str (); 00105 } 00106 00107 inline const char* 00108 00109 PrefWindow::get_A_dir () const 00110 { 00111 return m_A_dir->get_text ().c_str (); 00112 } 00113 00114 inline const char* 00115 00116 PrefWindow::get_B_dir () const 00117 { 00118 return m_B_dir->get_text ().c_str (); 00119 } 00120 00121 #if 0 00122 inline void 00123 PrefWindow:: 00124 help_impl (gint page_num_) 00125 { 00126 trace("PrefWindow::help_impl"); 00127 DL((ASSA::APP,"No help is available at this time\n")); 00128 } 00129 #endif 00130 00131 inline void 00132 00133 PrefWindow::stop () 00134 { 00135 trace("PrefWindow::stop"); 00136 hide (); 00137 Gtk::Main::quit (); 00138 } 00139 00140 #if 0 00141 inline gint 00142 PrefWindow:: 00143 delete_event_impl (GdkEventAny*) 00144 { 00145 trace("PrefWindow::delete_event_impl"); 00146 stop (); 00147 return false; // allow destroy 00148 } 00149 #endif 00150 00151 inline void 00152 00153 PrefWindow::changed_cb () 00154 { 00155 trace("PrefWindow::changed_cb"); 00156 if (!m_ignore_callbacks) { 00157 changed (); 00158 } 00159 } 00160 00161 inline void 00162 00163 PrefWindow::close_impl () 00164 { 00165 trace("PrefWindow::close_impl"); 00166 stop (); 00167 } 00168 00169 #endif /* PREF_WINDOW_H */