00001
00015 #ifndef _OPENFILEMENU_H
00016 #define _OPENFILEMENU_H
00017
00018 #include <Menu.H>
00019
00020 namespace xchen
00021 {
00022 void _open_file_cb(ConvertedKeyValue item_id, int x, int y);
00023
00024 class UI :: OpenFileMenu : private UI :: Menu
00025 {
00026 static void _open_file_cb(ConvertedKeyValue file_id, int x, int y);
00027 public:
00028 OpenFileMenu(KeyBoard*, const string& suffix, KeyEventCB=_open_file_cb);
00029 OpenFileMenu(KeyBoard* kb, KeyEventCB cb = _open_file_cb) : Menu(kb), fopen_cb(cb) { }
00030
00031 void RegisterFileSuffix(const string& file_suffix) { fileSuffix.push_back(file_suffix); }
00032 const string& GetFileName(int item_id) { return filenames[item_id]; }
00033 MenuID GenerateMenu();
00034
00035 private:
00036 vector<string> filenames;
00037 vector<string> fileSuffix;
00038 KeyEventCB fopen_cb;
00039
00040 static void new_view_if_necessary();
00041 };
00042
00043 }
00044 #endif