CVoiceDataPacket::CVoiceDataPacket( CPlayer* pPlayer, const unsigned char * pbSrcBuffer, unsigned short usLength ) { m_pBuffer = NULL; m_usDataBufferSize = 0; m_usActualDataLength = 0; SetSourceElement ( pPlayer ); SetData(pbSrcBuffer, usLength); }
// Clears the element references. void ElementInfo::Reset() { hover_element = NULL; SetSourceElement(NULL); }
void ElementInfo::ProcessEvent(Core::Event& event) { Core::ElementDocument::ProcessEvent(event); // Only process events if we're visible if (IsVisible()) { if (event == "click") { Core::Element* target_element = event.GetTargetElement(); // Deal with clicks on our own elements differently. if (target_element->GetOwnerDocument() == this) { // If it's a pane title, then we need to toggle the visibility of its sibling (the contents pane underneath it). if (target_element->GetTagName() == "h2") { Core::Element* panel = target_element->GetNextSibling(); if (panel->IsVisible()) panel->SetProperty("display", "none"); else panel->SetProperty("display", "block"); event.StopPropagation(); } else if (event.GetTargetElement()->GetId() == "close_button") { if (IsVisible()) SetProperty("visibility", "hidden"); } // Check if the id is in the form "a %d" or "c %d" - these are the ancestor or child labels. else { int element_index; if (sscanf(target_element->GetId().CString(), "a %d", &element_index) == 1) { Core::Element* new_source_element = source_element; for (int i = 0; i < element_index; i++) { if (new_source_element != NULL) new_source_element = new_source_element->GetParentNode(); } SetSourceElement(new_source_element); } else if (sscanf(target_element->GetId().CString(), "c %d", &element_index) == 1) { if (source_element != NULL) SetSourceElement(source_element->GetChild(element_index)); } event.StopPropagation(); } } // Otherwise we just want to focus on the clicked element (unless it's on a debug element) else if (target_element->GetOwnerDocument() != NULL && !IsDebuggerElement(target_element)) { Core::Element* new_source_element = target_element; if (new_source_element != source_element) { SetSourceElement(new_source_element); event.StopPropagation(); } } } else if (event == "mouseover") { Core::Element* target_element = event.GetTargetElement(); // Deal with clicks on our own elements differently. Core::ElementDocument* owner_document = target_element->GetOwnerDocument(); if (owner_document == this) { // Check if the id is in the form "a %d" or "c %d" - these are the ancestor or child labels. int element_index; if (sscanf(target_element->GetId().CString(), "a %d", &element_index) == 1) { hover_element = source_element; for (int i = 0; i < element_index; i++) { if (hover_element != NULL) hover_element = hover_element->GetParentNode(); } } else if (sscanf(target_element->GetId().CString(), "c %d", &element_index) == 1) { if (source_element != NULL) hover_element = source_element->GetChild(element_index); } } // Otherwise we just want to focus on the clicked element (unless it's on a debug element) else if (owner_document != NULL && owner_document->GetId().Find("rkt-debug-") != 0) { hover_element = target_element; } } } }