00001 00011 #ifndef MAINWINDOW_H 00012 #define MAINWINDOW_H 00013 00014 #include <basic.h> 00015 #include <list> 00016 #include "MemoryDrawEnv.h" 00017 #include "HiraganaMenu.h" 00018 #include "HiraganaMenu2.h" 00019 #include "KatakanaMenu.h" 00020 #include "KatakanaMenu2.h" 00021 #include "AlphabetMenu.h" 00022 #include "SymbolMenu.h" 00023 #include "Stroke.h" 00024 #include "jstroke.h" 00025 00027 00030 class MainWindow { 00031 00032 private: 00033 00034 enum CharacterType { 00035 CT_ALPHABET, CT_KATAKANA, CT_SYMBOL, CT_HIRAGANA, CT_CONTROL 00036 }; 00037 00038 WID wid; 00039 TC* title; 00040 PAT bgpat; 00041 bool cont; 00042 MemoryDrawEnv mdenv; 00043 RECT wcrect, bdpos; 00044 mutable RECT wrect; 00045 00046 TC tcs_kanji[3], tcs_hira[3], tcs_kata[3], tcs_hira2[3], tcs_kata2[3], tcs_alpha[3], tcs_symbol[3]; 00047 PAID cid_kanji, cid_hira, cid_kata, cid_hira2, cid_kata2, cid_alpha, cid_symbol; 00048 PARTS par_kanji, par_hira, par_kata, par_hira2, par_kata2, par_alpha, par_symbol; 00049 00050 TC tcs_backspace[3], tcs_enter[3], tcs_delete[3]; 00051 PAID cid_backspace, cid_enter, cid_delete; 00052 PARTS par_backspace, par_enter, par_delete; 00053 00054 const static int dsize = 128; 00055 const static UH wsize_h = dsize+12+64+8+32, wsize_v = dsize+8; 00056 00057 typedef std::list<DrawingStroke> DrawingStrokeList; 00058 typedef DrawingStrokeList::iterator DrawingStrokeIterator; 00059 typedef DrawingStrokeList::const_iterator DrawingStrokeConstIterator; 00060 00061 DrawingStrokeList slist; 00062 00063 HiraganaMenu hiramenu; 00064 HiraganaMenu2 hiramenu2; 00065 KatakanaMenu katamenu; 00066 KatakanaMenu2 katamenu2; 00067 AlphabetMenu alphamenu; 00068 SymbolMenu symbolmenu; 00069 00071 void draw(); 00072 00074 void redisp(WEVENT* ev); 00075 00077 void onMouseButtonDown(WEVENT* ev); 00078 00080 void onIdle(WEVENT* ev); 00081 00083 void onKanji(WEVENT* ev); 00084 00086 void execKanjiMenu(WEVENT *ev, const ListMem* top_picks); 00087 00089 void clearStroke(); 00090 00092 void sendKey(WEVENT *ev, TC tc, CharacterType type); 00093 00095 void sendCharacter(WEVENT *ev, TC tc, CharacterType type); 00096 00097 public: 00098 00100 MainWindow(); 00101 00103 virtual ~MainWindow(){ 00104 gdsp_ptr(-1); 00105 display(false); 00106 } 00107 00109 00113 W getWindowID() const { 00114 return wid; 00115 } 00116 00118 00123 void display(bool state = true); 00124 00126 00130 void run(); 00131 00133 00136 void terminate(){ 00137 cont = false; 00138 } 00139 00141 00145 void setRect(const RECT& r); 00146 00148 00152 RECT getRect() const; 00153 00154 }; 00155 00156 #endif // MAINWINDOW_H