00001
00011 #ifndef MAINWINDOW_H
00012 #define MAINWINDOW_H
00013
00014 #include <basic.h>
00015 #include "MemoryDrawEnv.h"
00016 #include "MainMenu.h"
00017 #include "ScribbleDoc.h"
00018
00020
00023 class MainWindow {
00024
00025 private:
00026
00027 enum State { STATE_NORMAL, STATE_SELECTED };
00028
00029 static const int scrlbar_width = 18;
00030 const LINK* bsfile;
00031 W wid;
00032 RECT wrect, cliprect;
00033 TC* title;
00034 PAT bgpat;
00035 MainMenu menu;
00036 MemoryDrawEnv mdenv;
00037 bool cont;
00038 ScribbleDoc doc;
00039 State state;
00040
00041 std::auto_ptr<SelectionStroke> sel_stroke;
00042 std::auto_ptr<ScribbleDoc::DrawingStrokePtrList> sel_slist;
00043
00045 void selectMenu(WEVENT* ev, W mitem);
00046
00048 void draw();
00049
00051 void redisp(WEVENT* ev);
00052
00054 void onKeyDown(WEVENT* ev);
00055
00057 void onMouseButtonDown(WEVENT* ev);
00058
00060 void onRightMouseButtonDown(WEVENT* ev);
00061
00063 void onSelectedMouseEvent(WEVENT* ev, bool left);
00064
00066 void onScroll(WEVENT* ev);
00067
00069 void onIdle(WEVENT* ev);
00070
00072 void cancelSelection();
00073
00074 public:
00075
00077 MainWindow();
00078
00080 virtual ~MainWindow(){
00081 gdsp_ptr(-1);
00082 display(false);
00083 }
00084
00086
00090 void openDocument(const LINK* link);
00091
00093
00097 W getWindowID() const {
00098 return wid;
00099 }
00100
00102
00106 void display(bool state = true);
00107
00109
00113 void run();
00114
00116
00119 void terminate(){
00120 cont = false;
00121 }
00122
00123 };
00124
00125 #endif // MAINWINDOW_H