本文整理汇总了C++中rocket::core::Event::GetType方法的典型用法代码示例。如果您正苦于以下问题:C++ Event::GetType方法的具体用法?C++ Event::GetType怎么用?C++ Event::GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rocket::core::Event
的用法示例。
在下文中一共展示了Event::GetType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessEvent
void UI_ScriptDocument::ProcessEvent( Rocket::Core::Event &event )
{
if( event.GetType() == "afterLoad" && event.GetTargetElement() == this ) {
if( module ) {
owner = event.GetParameter<void *>( "owner", NULL );
as->finishBuilding( module );
as->setModuleUserData( module, owner );
}
isLoading = false;
// handle postponed onload events (HOWTO handle these in cached documents?)
for( PostponedList::iterator it = onloads.begin(); it != onloads.end(); ++it ) {
Rocket::Core::Event *load = *it;
this->DispatchEvent( load->GetType(), *(load->GetParameters()), true );
load->RemoveReference();
}
// and clear the events
onloads.clear();
return;
}
if( event.GetType() == "beforeUnload" && event.GetTargetElement() == this ) {
if( module ) {
// FIXME: destroy script event listeners here somehow!
// destroy the AS module by name to prevent crashes in case multiple document instances share the same module pointer
as->buildReset( GetSourceURL().CString() );
module = NULL;
}
return;
}
if( isLoading ) {
Rocket::Core::Event *instanced = Rocket::Core::Factory::InstanceEvent( event.GetTargetElement(),
event.GetType(), *event.GetParameters(), true );
onloads.push_back( instanced );
event.StopPropagation();
return;
}
Rocket::Core::ElementDocument::ProcessEvent( event );
}
示例2: ProcessEvent
void ProcessEvent(Rocket::Core::Event& event)
{
if(event.GetType() == "rowadd")
{
Rocket::Controls::ElementDataGrid *dataGrid = dynamic_cast<Rocket::Controls::ElementDataGrid*>(event.GetCurrentElement());
for(int i = 0, len = dataGrid->GetNumRows();i < len; ++i)
{
Rocket::Controls::ElementDataGridRow *row = dataGrid->GetRow(i);
//Remove to make sure we did not add it twice
row->RemoveEventListener("click", this);
row->RemoveEventListener("dblclick", this);
row->AddEventListener("click", this);
row->AddEventListener("dblclick", this);
}
}
else if(event.GetType() == "click")
{
this->SetSelectedRow(event.GetCurrentElement());
}
else if(event.GetType() == "dblclick")
{
this->SetSelectedRow(event.GetCurrentElement());
}
/*
else if(event.GetType() == "keydown")
{
Rocket::Controls::ElementDataGrid *dataGrid = dynamic_cast<Rocket::Controls::ElementDataGrid*>(event.GetCurrentElement());
if(dataGrid->GetNumRows() == 0)
return;
if(pclSelectedRow == NULL)
{
event.GetParameter<int>("key_identifier",
this->SetSelectedRow(dataGrid->GetRow(0));
}
}*/
}
示例3: ExecuteForButtonId
void InteractMenu::ExecuteForButtonId(Rocket::Core::Event& event, std::function<bool (Rocket::Core::Event&, const std::string&, Interactions::Interaction*)> callback)
{
if (!_done)
{
string id = event.GetCurrentElement()->GetId().CString();
string event_type = event.GetType().CString();
for (unsigned int i = 0 ; i < _listeners.size() ; ++i)
{
if (id == _listeners[i]->name && (callback(event, event_type, _listeners[i])))
break ;
}
}
}
示例4: ProcessEvent
void RocketMenuPlugin::ProcessEvent(Rocket::Core::Event& event) {
Rocket::Core::Element *element = event.GetCurrentElement();
if (event.GetType() == "click") {
if (element->GetTagName() == "ftr") {
SetNextItemValue(element->GetParentNode()->GetParentNode());
event.StopPropagation();
} else if (element->GetTagName() == "hdr") {
SetPreviousItemValue(element->GetParentNode()->GetParentNode());
event.StopPropagation();
} else {
DoItemAction(ItemActionEnter, element);
}
} else if (event.GetType() == "mousemove") {
if (element->GetTagName() == "div") {
HighlightItem(element);
} else if (element->GetTagName() == "key1") {
Rocket::Core::Element *menu_item = element->GetParentNode()->GetParentNode();
SetActiveKeySlot(menu_item, 0);
} else if (element->GetTagName() == "key2") {
Rocket::Core::Element *menu_item = element->GetParentNode()->GetParentNode();
SetActiveKeySlot(menu_item, 1);
}
} else if (event.GetType() == "change") {
if (m_delegate != NULL && element->GetOwnerDocument()->IsVisible()) {
Rocket::Core::Element *menu_item = element->GetParentNode()->GetParentNode();
RangeData *data = GetRangeData(menu_item);
const Rocket::Core::Dictionary *p = event.GetParameters();
float v = p->Get("value")->Get<float>();
float new_value = data->min + v*(data->max - data->min);
if (fabs(new_value-data->value) > 0.001f) {
data->value = new_value;
m_delegate->DidChangeRangeValue(menu_item, data->value);
}
}
}
}
示例5: processEvent
void UI::processEvent(const Rocket::Core::Event& event) {
Rocket::Core::String type = event.GetType();
event_count_++;
//if (event == "resize") {
// if (renderer_content_ != NULL && renderer_content_->HasChildNodes()) {
// renderer_content_->GetLastChild()->ScrollIntoView();
// }
// return;
//}
if (type == "mouseover" || type == "dragstart") {
mouse_over_count_++;
} else if (type == "mouseout" || type == "dragend") {
mouse_over_count_--;
} else if (type == "change") {
// An input element changed:
Element* target = event.GetTargetElement();
if (target != NULL) {
// All our "changable" elements need to have a type attribute (we
// need to put them there). Make sure this one has one and that
// it is of type string.
if (target->GetAttribute("type") == NULL ||
target->GetAttribute("type")->GetType() != Variant::Type::STRING) {
std::wstringstream ss;
ss << L"UI::processEvent() - ERROR: the current target element";
ss << L" either does not have an attribute named type or that";
ss << L" attribute is not of type string";
throw wruntime_error(ss.str());
}
String elem_type = target->GetAttribute("type")->Get<String>();
// Do the same for the value element (which stores the setting string)
if (target->GetAttribute("value") == NULL ||
target->GetAttribute("value")->GetType() != Variant::Type::STRING) {
std::wstringstream ss;
ss << L"UI::processEvent() - ERROR: the current target element";
ss << L" either does not have an attribute named value or that";
ss << L" attribute is not of type string";
throw wruntime_error(ss.str());
}
String val_str = target->GetAttribute("value")->Get<String>();
// Now handle the different types of elements
if (elem_type == "checkbox") { // Handle checkbox
bool old_value = false;
GET_SETTING(val_str.CString(), bool, old_value);
// Set the internal setting (in the setting manager)
bool value = false;
if (target->GetAttribute("checked")) {
value = true;
}
SET_SETTING(val_str.CString(), bool, value);
// Handle special cases (that need to do something immediately)
if (val_str == "fullscreen") {
if (old_value != value) {
Renderer::requestReloadRenderer();
return;
}
}
// Handle special cases that require the app to do something after
// the variable has been set.
if (val_str == "render_ui") {
setVisibility(value, renderer_doc_);
}
} else if (elem_type == "selectbox") {