iw5-mod/src/launcher/launcher.cpp

43 lines
912 B
C++
Raw Normal View History

2018-12-23 13:17:08 +01:00
#include <std_include.hpp>
#include "launcher.hpp"
2019-01-05 11:44:45 +01:00
#include "html_frame.hpp"
2018-12-23 13:17:08 +01:00
2019-01-05 11:44:45 +01:00
launcher::launcher()
2018-12-23 13:17:08 +01:00
{
2018-12-23 18:25:22 +01:00
this->window_.set_callback(std::bind(&launcher::handler, this, std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3));
2019-01-05 11:44:45 +01:00
this->window_.create("Open-IW5", 615, 300);
this->html_frame_.load_url("https://google.com");
2018-12-23 13:17:08 +01:00
}
2018-12-23 18:25:22 +01:00
launcher::mode launcher::run() const
2018-12-23 13:17:08 +01:00
{
this->window_.run();
2018-12-23 18:25:22 +01:00
return this->mode_;
}
LRESULT launcher::handler(const UINT message, const WPARAM w_param, const LPARAM l_param)
{
2019-01-05 11:44:45 +01:00
if (message == WM_SIZE)
2018-12-23 18:25:22 +01:00
{
2019-01-05 11:44:45 +01:00
this->html_frame_.resize(LOWORD(l_param), HIWORD(l_param));
return 0;
2018-12-23 18:25:22 +01:00
}
2019-01-05 11:44:45 +01:00
if (message == WM_CREATE)
2018-12-23 18:25:22 +01:00
{
2019-01-05 11:44:45 +01:00
this->html_frame_.initialize(this->window_);
return 0;
2018-12-23 18:25:22 +01:00
}
return DefWindowProc(this->window_, message, w_param, l_param);
}
void launcher::select_mode(const mode mode)
{
this->mode_ = mode;
this->window_.close();
}