本文整理汇总了C++中TBWidget::InvokeEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ TBWidget::InvokeEvent方法的具体用法?C++ TBWidget::InvokeEvent怎么用?C++ TBWidget::InvokeEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBWidget
的用法示例。
在下文中一共展示了TBWidget::InvokeEvent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drop_callback
static void drop_callback(GLFWwindow *window, int count, const char **files_utf8)
{
ApplicationBackendGLFW *backend = GetBackend(window);
TBWidget *target = TBWidget::hovered_widget;
if (!target)
target = TBWidget::focused_widget;
if (!target)
target = backend->GetRoot();
if (target)
{
TBWidgetEventFileDrop ev;
for (int i = 0; i < count; i++)
ev.files.Add(new TBStr(files_utf8[i]));
target->InvokeEvent(ev);
}
}
示例2: OnEvent
bool ListViewItemWidget::OnEvent(const TBWidgetEvent &ev)
{
if (ev.type == EVENT_TYPE_WHEEL)
{
return false;
}
if (ev.type == EVENT_TYPE_POINTER_DOWN || ev.type == EVENT_TYPE_RIGHT_POINTER_UP)
{
TBWidget* parent = GetParent();
while (parent)
{
if (parent->IsOfType<TBSelectList>())
{
TBWidgetEvent nev = ev;
nev.ref_id = item_->id;
parent->InvokeEvent(nev);
break;
}
parent = parent->GetParent();
}
return true;
}
// get clicks this way, not sure we want to
if (ev.type == EVENT_TYPE_CLICK && ev.target == expandBox_ && ev.target->GetID() == item_->id)
{
item_->SetExpanded(!item_->GetExpanded());
source_->list_->InvalidateList();
// want to bubble
return false;
}
return TBLayout::OnEvent(ev);
}
示例3: InvokeShortcut
static bool InvokeShortcut(UI* ui, int key, SPECIAL_KEY special_key, MODIFIER_KEYS modifierkeys, bool down)
{
#ifdef __APPLE__
bool shortcut_key = (modifierkeys & TB_SUPER) ? true : false;
#else
bool shortcut_key = (modifierkeys & TB_CTRL) ? true : false;
#endif
if (!down || (!shortcut_key && special_key ==TB_KEY_UNDEFINED))
return false;
bool reverse_key = (modifierkeys & TB_SHIFT) ? true : false;
int upper_key = toupr_ascii(key);
TBID id;
if (upper_key == 'X')
id = TBIDC("cut");
else if (upper_key == 'C' || special_key == TB_KEY_INSERT)
id = TBIDC("copy");
else if (upper_key == 'V' || (special_key == TB_KEY_INSERT && reverse_key))
id = TBIDC("paste");
else if (upper_key == 'A')
id = TBIDC("selectall");
else if (upper_key == 'Z' || upper_key == 'Y')
{
bool undo = upper_key == 'Z';
if (reverse_key)
undo = !undo;
id = undo ? TBIDC("undo") : TBIDC("redo");
}
else if (upper_key == 'N')
id = TBIDC("new");
else if (upper_key == 'O')
id = TBIDC("open");
else if (upper_key == 'S')
id = TBIDC("save");
else if (upper_key == 'W')
id = TBIDC("close");
else if (upper_key == 'F')
id = TBIDC("find");
#ifdef ATOMIC_PLATFORM_OSX
else if (upper_key == 'G' && (modifierkeys & TB_SHIFT))
id = TBIDC("findprev");
else if (upper_key == 'G')
id = TBIDC("findnext");
#else
else if (special_key == TB_KEY_F3 && (modifierkeys & TB_SHIFT))
id = TBIDC("findprev");
else if (special_key == TB_KEY_F3)
id = TBIDC("findnext");
#endif
else if (upper_key == 'P')
id = TBIDC("play");
else if (special_key == TB_KEY_PAGE_UP)
id = TBIDC("prev_doc");
else if (special_key == TB_KEY_PAGE_DOWN)
id = TBIDC("next_doc");
else
return false;
TBWidgetEvent ev(EVENT_TYPE_SHORTCUT);
ev.modifierkeys = modifierkeys;
ev.ref_id = id;
TBWidget* eventWidget = TBWidget::focused_widget;
if (id == TBIDC("save") || id == TBIDC("close")) {
while (eventWidget && !eventWidget->GetDelegate()) {
eventWidget = eventWidget->GetParent();
}
}
if (!eventWidget || !eventWidget->InvokeEvent(ev))
{
VariantMap evData;
evData[UIUnhandledShortcut::P_REFID] = id;
ui->SendEvent(E_UIUNHANDLEDSHORTCUT, evData);
return false;
}
return true;
}