wx_tiny_shell.h

Go to the documentation of this file.
00001 #ifndef WX_TINY_SHELL_CLASS
00002 #define WX_TINY_SHELL_CLASS
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : wx_tiny_shell                                                     *
00007 *  Author : Aaron Buchanan                                                    *
00008 *  Author : Chris Koeritz                                                     *
00009 *                                                                             *
00010 *  Purpose:                                                                   *
00011 *                                                                             *
00012 *    The tiny shell provides a simple way to create an application.           *
00013 *  It will automatically provide an ini editor, a debugging console and       *
00014 *  some miscellaneous windows support.                                        *
00015 *                                                                             *
00016 *******************************************************************************
00017 * Copyright (c) 1995-$now By Authors.  This program is free software; you can *
00018 * redistribute it and/or modify it under the terms of the GNU General Public  *
00019 * License as published by the Free Software Foundation; either version 2 of   *
00020 * the License or (at your option) any later version.  This is online at:      *
00021 *     http://www.fsf.org/copyleft/gpl.html                                    *
00022 * Please send any updates to: fred@gruntose.com                               *
00023 \*****************************************************************************/
00024 
00025 #include "dll_wx_ext.h"
00026 
00027 #include <basis/portable.h>
00028 #include <opsystem/application_shell.h>
00029 
00030 #include <basis/trap_new.addin>
00031 #undef GetClassInfo
00032 #include <wx/frame.h>
00033 #include <basis/untrap_new.addin>
00034 
00035 // forward.
00036 class debugger;
00037 class log_base;
00038 class outcome;
00039 class wx_debugging_console_panel;
00040 
00041 class WX_EXTENSIONS_CLASS_STYLE wx_tiny_shell
00042 : public wxFrame,
00043   public application_shell
00044 {
00045 public:  
00046   wx_tiny_shell(const istring &window_title, const istring &name_root,
00047                     int file_size = int(1.2 * MEGABYTE),
00048                     const istring &logfile_name = "");
00049     // constructs a wx_tiny_shell window with the "window_title".  the
00050     // "name_root" is used as the base part of the config file's name and
00051     // diagnostic log file's name.  if the "logfile_name" is not empty, then
00052     // it is used for the diagnostic log instead of basing the name on
00053     // "name_root".
00054 
00055   virtual ~wx_tiny_shell();
00056 
00057   IMPLEMENT_CLASS_NAME("wx_tiny_shell");
00058 
00059   // IDs for the controls and the menu commands
00060   enum
00061   {
00062     // menu items
00063     Quit = wxID_EXIT
00064   };
00065 
00066   virtual int execute();
00067     // forwards the application_base responsibility upwards to derived objects.
00068 
00069   outcome log(const istring &to_print);
00070   outcome print(const istring &to_print);
00071     // sends a debugging line into the debugging console and also to the
00072     // log file.
00073 
00074   debugger &debug() const;
00075     // this object is pointed at the "console" to allow debugging information
00076     // to be sent.  it also is valid by the time the execute() function is
00077     // called.  it can be passed around as a valid log_base object before then,
00078     // but items logged to it will be discarded until the wx_tiny_shell
00079     // window is created (just before execute() is invoked).  the initial style
00080     // of delivery for the debugging items is "delayed" (see debugger.h), but
00081     // this can be changed.  however, it is not recommended because that can
00082     // cause misordering of debug messages when other senders are targeting the
00083     // same debugging window.
00084 
00085   wx_debugging_console_panel &panel();
00086     // wx component that holds the logging information.
00087 
00088 protected:
00089     void OnCloseWindow(wxCloseEvent& event);
00090     void OnDebugEvent(wxCommandEvent &event);
00091 
00092     // event handlers (these functions should _not_ be virtual)
00093     void OnQuit(wxCommandEvent& event);
00094 
00095 private:
00096   wx_debugging_console_panel *_panel;   // logging panel
00097   debugger *_debug;  // our debugging message zinger.
00098   log_base *_held_logger;  // tracks the prior logger.
00099   bool _exiting;  // is the application shutting down?
00100   istring *_logfile_name;
00101 
00102   DECLARE_EVENT_TABLE()
00103 };
00104 
00105 #endif 
00106 

Generated on Fri Nov 28 04:29:06 2008 for HOOPLE Libraries by  doxygen 1.5.1