本文整理汇总了C++中WindowPtr::create方法的典型用法代码示例。如果您正苦于以下问题:C++ WindowPtr::create方法的具体用法?C++ WindowPtr::create怎么用?C++ WindowPtr::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WindowPtr
的用法示例。
在下文中一共展示了WindowPtr::create方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
void GUI::create() {
if(window) {
window->setFocus();
return;
}
Config::setConfig("Dialog", true);
/*
auto setBoolCfg = [&] (string setting, CheckBoxPtr enable) {
if(enable) {
Config::setConfig(setting, enable);
}
setBoolCfg("", eUserFilter);
setCfg("", eHubFilter);
setCfg("", eSearchFilter);
setCfg("", eProtoFilter);
setCfg("", eFileLogging);
*/
Application::init();
{
Window::Seed seed(_T(PLUGIN_NAME));
seed.location.size.x = 1200;
seed.location.size.y = 800;
window = new Window();
window->create(seed);
auto iconPath = Util::toT(Config::getInstallPath() + "DevPlugin.ico");
try {
window->setSmallIcon(new dwt::Icon(iconPath, dwt::Point(16, 16)));
window->setLargeIcon(new dwt::Icon(iconPath, dwt::Point(32, 32)));
} catch(const dwt::DWTException&) { }
window->onClosing([]() -> bool {
window = nullptr;
Application::uninit();
if(!unloading) { Config::setConfig("Dialog", false); }
return true;
});
window->onDestroy([this] { clear(); });
}
auto grid = window->addChild(Grid::Seed(3, 1));
grid->column(0).mode = GridInfo::FILL;
grid->row(0).mode = GridInfo::FILL;
grid->row(0).align = GridInfo::STRETCH;
grid->setSpacing(8);
{
Table::Seed seed;
seed.style |= WS_BORDER | LVS_SHOWSELALWAYS;
seed.lvStyle = LVS_EX_DOUBLEBUFFER | LVS_EX_HEADERDRAGDROP | LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP;
table = grid->addChild(seed);
std::vector<Column> columns;
columns.emplace_back(_T("#"), 50);
columns.emplace_back(_T("Dir"), 50);
columns.emplace_back(_T("Protocol"), 60);
columns.emplace_back(_T("IP"), 100);
columns.emplace_back(_T("Port"), 50);
columns.emplace_back(_T("Peer info"), 200);
columns.emplace_back(_T("Message"));
table->setColumns(columns);
table->onSized([this](const SizedEvent& e) { table->setColumnWidth(6, e.size.x - 50 - 50 - 60 - 100 - 50 - 200 - 20); });
table->onContextMenu([this](const ScreenCoordinate& pt) -> bool {
auto menu = window->addChild(Menu::Seed());
auto hasSel = table->hasSelected();
menu->appendItem(_T("Copy selected messages"), [=] { copy(); }, nullptr, hasSel);
menu->appendItem(_T("Remove selected messages"), [=] { remove(); }, nullptr, hasSel);
menu->appendSeparator();
menu->appendItem(_T("Select all"), [] { table->selectAll(); }, nullptr, !table->empty());
menu->appendSeparator();
menu->appendItem(_T("Open protocol documentation"), [=] { openDoc(); }, nullptr, hasSel);
menu->open(pt.x() == -1 || pt.y() == -1 ? table->getContextMenuPos() : pt);
return true;
});
table->onCustomDraw([this](NMLVCUSTOMDRAW& data) { return GUI::handleCustomDraw(data); });
}
{
auto cur = grid->addChild(Grid::Seed(1, 5));
cur->setSpacing(30);
auto hubMessagesW = cur->addChild(CheckBox::Seed(_T("Add hub messages")));
hubMessagesW->setChecked(true);
hubMessagesW->onClicked([this, hubMessagesW] { hubMessages = hubMessagesW->getChecked(); });
auto userMessagesW = cur->addChild(CheckBox::Seed(_T("Add user messages")));
userMessagesW->setChecked(true);
userMessagesW->onClicked([this, userMessagesW] { userMessages = userMessagesW->getChecked(); });
{
//.........这里部分代码省略.........