/* bitmap_gui.coh ** ** Made by yann koeth ** Wed Mar 31 14:48:57 2010 */ AddBitmap(id, dialog, name, flags); class BitmapGUI : GeUserArea { private: var bitmap; public: BitmapGUI(id, dialog, name); GetUserWidth(); GetUserHeight(); Draw(x1, y1, x2, y2); } BitmapGUI::BitmapGUI(id, dialog, name) { bitmap = new(BaseBitmap, 1, 1); var file = new(Filename); file->SetFullString(name); if (bitmap->Load(file) == FALSE) // test absolute path { file = GeGetRootFilename(); file->RemoveLast(); file->AddLast(name); if (bitmap->Load(file) == FALSE) // test relative path TextDialog(name + " can't be loaded.", DLG_OK | DLG_ICONEXCLAMATION); } super(id, dialog); } BitmapGUI::GetUserWidth() { return bitmap->GetWidth(); } BitmapGUI::GetUserHeight() { return bitmap->GetHeight(); } BitmapGUI::Draw(x1, y1, x2, y2) { DrawBitmap(bitmap, 0, 0, GetUserWidth() - 1, GetUserHeight() - 1, x1, y1, x2, y2, BMP_NORMALSCALED); return TRUE; } AddBitmap(id, dialog, name, flags) { dialog->AddUserArea(id, flags, 0, 0); new(BitmapGUI, id, dialog, name); return TRUE; }