00001
00002
00003
00004 #ifndef __GDOCAPP_H
00005 #define __GDOCAPP_H
00006
00007 #include <stdio.h>
00008
00009 #include "Lgi.h"
00010 #include "GXml.h"
00011 #include "GMru.h"
00012
00014
00015
00016
00017 #define IDM_SAVE 15002
00018 #define IDM_CLOSE 15003
00019 #define IDM_EXIT 15004
00020
00021
00022
00023
00026 template<typename OptionsFmt>
00027 class GDocApp :
00028 public GWindow,
00029 public GMru
00030 {
00031 private:
00032 class GDocAppPrivate *d;
00033 OptionsFmt *Options;
00034
00035 void _Close();
00036
00037 protected:
00039 bool _LoadMenu(char *Resource = 0, char *Tags = 0);
00041 bool _Create();
00043 bool _Destroy();
00045 bool _OpenFile(char *File, bool ReadOnly);
00047 bool _SaveFile(char *File);
00048
00049 bool _DoSerialize(bool Write);
00050 bool _SerializeFile(bool Write);
00051
00052
00053 GSubMenu *_FileMenu;
00054
00056 char *_LangOptsName;
00057
00058 public:
00060 GDocApp
00061 (
00063 char *appname = 0,
00065 char *icon = 0,
00067 char *optsname = 0
00068
00069 );
00070 ~GDocApp();
00071
00073 void SetCurFile(char *f);
00075 char *GetCurFile();
00077 bool SetDirty(bool Dirty);
00079 bool GetDirty();
00081 OptionsFmt *GetOptions();
00083 char *GetAppName();
00085 char *GetOptionsFileName();
00086
00088 virtual void Empty() {}
00090 virtual bool SerializeOptions(OptionsFmt *Options, bool Write) { return false; }
00092 virtual void OnDirty(bool NewValue) {}
00093
00100 bool SetLanguage(char *LangId);
00101
00102
00103 void OnReceiveFiles(GArray<char*> &Files);
00104 bool OnRequestClose(bool OsShuttingDown);
00105 int OnCommand(int Cmd, int Event, OsView Window);
00106 int OnEvent(GMessage *m);
00107 };
00108
00109 #endif