diff options
author | Aki <please@ignore.pl> | 2022-04-01 21:23:39 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-04-01 21:23:39 +0200 |
commit | 3c487c5cd69c53d6fea948643c0a76df03516605 (patch) | |
tree | 72730c7b8b26a5ef8fc9a987ec4c16129efd5aac /StarsEx/ModInfoDlg.cpp | |
parent | 8f353abd0bfe18baddd8a8250ab7c4f2d1c83a6e (diff) | |
download | starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.zip starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.tar.gz starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.tar.bz2 |
Moved Stars45 to StarsEx
Diffstat (limited to 'StarsEx/ModInfoDlg.cpp')
-rw-r--r-- | StarsEx/ModInfoDlg.cpp | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/StarsEx/ModInfoDlg.cpp b/StarsEx/ModInfoDlg.cpp new file mode 100644 index 0000000..cebdc54 --- /dev/null +++ b/StarsEx/ModInfoDlg.cpp @@ -0,0 +1,113 @@ +/* Starshatter: The Open Source Project + Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors + Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors + Copyright (c) 1997-2006, Destroyer Studios LLC. + + AUTHOR: John DiCamillo + + + OVERVIEW + ======== + Mod Config Dialog Active Window class +*/ + +#include "ModInfoDlg.h" +#include "BaseScreen.h" +#include "ModConfig.h" +#include "ModInfo.h" + +#include "Game.h" +#include "DataLoader.h" +#include "Button.h" +#include "ListBox.h" +#include "ImageBox.h" +#include "Video.h" +#include "Keyboard.h" +#include "Mouse.h" +#include "ParseUtil.h" + +// +--------------------------------------------------------------------+ +// DECLARE MAPPING FUNCTIONS: + +DEF_MAP_CLIENT(ModInfoDlg, OnAccept); + +// +--------------------------------------------------------------------+ + +ModInfoDlg::ModInfoDlg(Screen* s, FormDef& def, BaseScreen* mgr) +: FormWindow(s, 0, 0, s->Width(), s->Height()), manager(mgr), +btn_accept(0), mod_info(0) +{ + Init(def); +} + +ModInfoDlg::~ModInfoDlg() +{ +} + +// +--------------------------------------------------------------------+ + +void +ModInfoDlg::RegisterControls() +{ + btn_accept = (Button*) FindControl( 1); + + if (btn_accept) + REGISTER_CLIENT(EID_CLICK, btn_accept, ModInfoDlg, OnAccept); + + lbl_name = FindControl(101); + lbl_desc = FindControl(102); + lbl_copy = FindControl(103); + + img_logo = (ImageBox*) FindControl(200); + + if (img_logo) { + img_logo->GetPicture(bmp_default); + img_logo->SetBlendMode(Video::BLEND_SOLID); + } +} + +// +--------------------------------------------------------------------+ + +void +ModInfoDlg::Show() +{ + FormWindow::Show(); +} + +// +--------------------------------------------------------------------+ + +void +ModInfoDlg::ExecFrame() +{ + if (Keyboard::KeyDown(VK_RETURN)) { + if (btn_accept && btn_accept->IsEnabled()) + OnAccept(0); + } +} + +// +--------------------------------------------------------------------+ + +void +ModInfoDlg::SetModInfo(ModInfo* info) +{ + mod_info = info; + + if (mod_info) { + if (lbl_name) lbl_name->SetText(mod_info->Name()); + if (lbl_desc) lbl_desc->SetText(mod_info->Description()); + if (lbl_copy) lbl_copy->SetText(mod_info->Copyright()); + + if (img_logo && mod_info->LogoImage() && mod_info->LogoImage()->Width() > 32) + img_logo->SetPicture(*mod_info->LogoImage()); + else if (img_logo) + img_logo->SetPicture(bmp_default); + } +} + +// +--------------------------------------------------------------------+ + +void +ModInfoDlg::OnAccept(AWEvent* event) +{ + manager->ShowModDlg(); +} |