/* sample1 i a simple text-editor which uses the sytem-multiline-entryfield */
/* to edit the text.                                                        */
/* sample1 shows you how to                                                 */
/* - create multithraeded programms                                         */
/* - use menubars                                                           */
/* - use the xfile-class                                                    */
/* - accept drag-events                                                     */
/* - use the system defined filedialog                                      */

#include "resource.h"      //include definitionf for resources

#define MY_MLE     300     //id for the mle-control

#include "xheaders.h"       //include default header-file

#include XApplication_i    //include headers
#include XFrameWindow_i
#include XResourceLibrary_i
#include XMenuBar_i
#include XMultiLineEdit_i
#include XRect_i
#include XResource_i
#include XControlEvent_i
#include XThread_i
#include XString_i


/* the derived framewindow */
class MyAppWindow: public XFrameWindow
{
      friend class MyMLE;
      friend class SearchDialog;
   public:
      MyAppWindow( XResourceLibrary * res, XResource * r );
      ~MyAppWindow();
      BOOL DoCommand( LONG );                //overridden
      BOOL QueryForClose ( void );           //overriden
      BOOL LoadFile( char*);
      BOOL SaveFile(void);
   private:
      XMenuBar * menu;
      XMultiLineEdit * mle;
      BOOL saved;
      BOOL loaded;
      XString path;
      SearchDialog * dlg;
      BOOL loading;
};


class MyThread: public XThread
{
   public:
      void Init( void );                    //overridden
      MyThread ( char * iniFile = NULL);
      XResourceLibrary * resLib;
   private:
      XString iniFile;
      MyAppWindow * appWindow;
};
