wxPGProperty* wxPropertyGridInterface::ReplaceProperty( wxPGPropArg id, wxPGProperty* property ) { wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullProperty) wxPGProperty* replaced = p; wxCHECK_MSG( replaced && property, wxNullProperty, wxT("NULL property") ); wxCHECK_MSG( !replaced->IsCategory(), wxNullProperty, wxT("cannot replace this type of property") ); wxCHECK_MSG( !m_pState->IsInNonCatMode(), wxNullProperty, wxT("cannot replace properties in alphabetic mode") ); // Get address to the slot wxPGProperty* parent = replaced->GetParent(); int ind = replaced->GetIndexInParent(); wxPropertyGridPageState* state = replaced->GetParentState(); DeleteProperty(replaced); // Must use generic Delete state->DoInsert(parent,ind,property); return property; }
/* * Called after the window associated with a frame has been switched * to a new top-level parent. */ void xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin) { DeleteProperty(oldWin, xa_native_window_id()); xprSetNativeProperty(pFrame); }
void QCSXCAD::Delete() { CSPrimitives* prim = CSTree->GetCurrentPrimitive(); if (prim!=NULL) { if (QMessageBox::question(this,tr("Delete Primitive"),tr("Delete current Primitive (ID: %1)?").arg(prim->GetID()),QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes) { CSTree->DeletePrimItem(prim); DeletePrimitive(prim); setModified(); } return; } CSProperties* prop = CSTree->GetCurrentProperty(); if (prop!=NULL) { size_t qtyPrim=prop->GetQtyPrimitives(); if (qtyPrim>0) { if (QMessageBox::question(this,tr("Delete Property"),tr("\"%1\" contains Primitive(s)!!\n Delete anyway?").arg(prop->GetName().c_str()),QMessageBox::Yes,QMessageBox::No)!=QMessageBox::Yes) return; } else if (QMessageBox::question(this,tr("Delete Property"),tr("Delete current Property?"),QMessageBox::Yes,QMessageBox::No)!=QMessageBox::Yes) return; CSTree->DeletePropItem(prop); DeleteProperty(prop); setModified(); } }
/* * Called after the window associated with a frame has been switched * to a new top-level parent. */ static void xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin) { DeleteProperty(serverClient, oldWin, xa_native_window_id()); TA_SERVER(); xprSetNativeProperty(pFrame); }
BOOL ModuleRoot::DeleteProperty(JavascriptString *propertyNameString, PropertyOperationFlags flags) { PropertyRecord const *propertyRecord = nullptr; if (JavascriptOperators::ShouldTryDeleteProperty(this, propertyNameString, &propertyRecord)) { Assert(propertyRecord); return DeleteProperty(propertyRecord->GetPropertyId(), flags); } return TRUE; }
NS_IMETHODIMP nsMathMLmtrFrame::AttributeChanged(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRInt32 aModType) { // Attributes specific to <mtr>: // groupalign : Not yet supported. // rowalign : Fully specified in mathml.css, and so HasAttributeDependentStyle() will // pick it up and nsCSSFrameConstructor will issue a PostRestyleEvent(). // columnalign : Need an explicit re-style call. if (aAttribute == nsGkAtoms::rowalign_) { // unset any -moz attribute that we may have set earlier, and re-sync mContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::MOZrowalign, PR_FALSE); MapRowAttributesIntoCSS(nsTableFrame::GetTableFrame(this), this); // That's all - see comment above. return NS_OK; } if (aAttribute != nsGkAtoms::columnalign_) return NS_OK; // Clear any cached columnalign's nsValueList for this row DeleteProperty(aAttribute); // Clear any internal -moz attribute that we may have set earlier // in our cells and re-sync their columnalign attribute nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this); nsIFrame* cellFrame = GetFirstChild(nsnull); for ( ; cellFrame; cellFrame = cellFrame->GetNextSibling()) { if (IS_TABLE_CELL(cellFrame->GetType())) { cellFrame->GetContent()-> UnsetAttr(kNameSpaceID_None, nsGkAtoms::MOZcolumnalign, PR_FALSE); MapColAttributesIntoCSS(tableFrame, this, cellFrame); } } // Explicitly request a re-resolve and reflow in our subtree to pick up any changes PresContext()->PresShell()->FrameConstructor()-> PostRestyleEvent(mContent, eReStyle_Self, nsChangeHint_ReflowFrame); return NS_OK; }
NS_IMETHODIMP nsSVGGradientFrame::AttributeChanged(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRInt32 aModType) { if (aNameSpaceID == kNameSpaceID_None && (aAttribute == nsGkAtoms::gradientUnits || aAttribute == nsGkAtoms::gradientTransform || aAttribute == nsGkAtoms::spreadMethod)) { nsSVGEffects::InvalidateRenderingObservers(this); } else if (aNameSpaceID == kNameSpaceID_XLink && aAttribute == nsGkAtoms::href) { // Blow away our reference, if any DeleteProperty(nsGkAtoms::href); mNoHRefURI = PR_FALSE; // And update whoever references us nsSVGEffects::InvalidateRenderingObservers(this); } return nsSVGGradientFrameBase::AttributeChanged(aNameSpaceID, aAttribute, aModType); }
bool TTracker::HandleScriptingMessage(BMessage* message) { if (message->what != B_GET_PROPERTY && message->what != B_SET_PROPERTY && message->what != B_CREATE_PROPERTY && message->what != B_COUNT_PROPERTIES && message->what != B_DELETE_PROPERTY && message->what != B_EXECUTE_PROPERTY) return false; // dispatch scripting messages BMessage reply(B_REPLY); const char* property = 0; bool handled = false; int32 index = 0; int32 form = 0; BMessage specifier; status_t result = message->GetCurrentSpecifier(&index, &specifier, &form, &property); if (result != B_OK || index == -1) return false; ASSERT(property); switch (message->what) { case B_CREATE_PROPERTY: handled = CreateProperty(message, &specifier, form, property, &reply); break; case B_GET_PROPERTY: handled = GetProperty(&specifier, form, property, &reply); break; case B_SET_PROPERTY: handled = SetProperty(message, &specifier, form, property, &reply); break; case B_COUNT_PROPERTIES: handled = CountProperty(&specifier, form, property, &reply); break; case B_DELETE_PROPERTY: handled = DeleteProperty(&specifier, form, property, &reply); break; case B_EXECUTE_PROPERTY: handled = ExecuteProperty(&specifier, form, property, &reply); break; } if (handled) { // done handling message, send a reply message->SendReply(&reply); } return handled; }
bool wxXmlNode::DeleteAttribute(const wxString& name) { return DeleteProperty(name); }
CMagicCabsineUniversalProperty_feature_texture_spectral_DFT::~CMagicCabsineUniversalProperty_feature_texture_spectral_DFT() { DeleteProperty(); }
void rPropertyCollection::SetBool(const rString& key, bool val){ DeleteProperty(key); m_properties[key] = new rProperty(val); }
void rPropertyCollection::SetFloat(const rString& key, float val){ DeleteProperty(key); m_properties[key] = new rProperty(val); }
void rPropertyCollection::SetTexture(const rString& key, rTexture2D* val){ DeleteProperty(key); m_properties[key] = new rProperty(val); }
void WordDOMDocumentTagger::ClearRestrictions() { DeleteProperty(c_sWSRestrictionLevel); DeleteProperty(c_sWSPassword); }
nsresult HTMLLabelElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor) { if (mHandlingEvent || (!NS_IS_MOUSE_LEFT_CLICK(aVisitor.mEvent) && aVisitor.mEvent->message != NS_MOUSE_BUTTON_DOWN) || aVisitor.mEventStatus == nsEventStatus_eConsumeNoDefault || !aVisitor.mPresContext || // Don't handle the event if it's already been handled by another label aVisitor.mEvent->mFlags.mMultipleActionsPrevented) { return NS_OK; } // Strong ref because event dispatch is going to happen. nsRefPtr<Element> content = GetLabeledElement(); if (content && !EventTargetIn(aVisitor.mEvent, content, this)) { mHandlingEvent = true; switch (aVisitor.mEvent->message) { case NS_MOUSE_BUTTON_DOWN: NS_ASSERTION(aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT, "wrong event struct for event"); if (static_cast<nsMouseEvent*>(aVisitor.mEvent)->button == nsMouseEvent::eLeftButton) { // We reset the mouse-down point on every event because there is // no guarantee we will reach the NS_MOUSE_CLICK code below. nsIntPoint *curPoint = new nsIntPoint(aVisitor.mEvent->refPoint); SetProperty(nsGkAtoms::labelMouseDownPtProperty, static_cast<void *>(curPoint), DestroyMouseDownPoint); } break; case NS_MOUSE_CLICK: if (NS_IS_MOUSE_LEFT_CLICK(aVisitor.mEvent)) { const nsMouseEvent* event = static_cast<const nsMouseEvent*>(aVisitor.mEvent); nsIntPoint *mouseDownPoint = static_cast<nsIntPoint *> (GetProperty(nsGkAtoms::labelMouseDownPtProperty)); bool dragSelect = false; if (mouseDownPoint) { nsIntPoint dragDistance = *mouseDownPoint; DeleteProperty(nsGkAtoms::labelMouseDownPtProperty); dragDistance -= aVisitor.mEvent->refPoint; const int CLICK_DISTANCE = 2; dragSelect = dragDistance.x > CLICK_DISTANCE || dragDistance.x < -CLICK_DISTANCE || dragDistance.y > CLICK_DISTANCE || dragDistance.y < -CLICK_DISTANCE; } // Don't click the for-content if we did drag-select text or if we // have a kbd modifier (which adjusts a selection), or if it's a // double click (we already forwarded the first click event). if (dragSelect || event->clickCount > 1 || event->IsShift() || event->IsControl() || event->IsAlt() || event->IsMeta()) { break; } nsIFocusManager* fm = nsFocusManager::GetFocusManager(); if (fm) { // Use FLAG_BYMOVEFOCUS here so that the label is scrolled to. // Also, within nsHTMLInputElement::PostHandleEvent, inputs will // be selected only when focused via a key or when the navigation // flag is used and we want to select the text on label clicks as // well. nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(content); fm->SetFocus(elem, nsIFocusManager::FLAG_BYMOVEFOCUS); } // Dispatch a new click event to |content| // (For compatibility with IE, we do only left click. If // we wanted to interpret the HTML spec very narrowly, we // would do nothing. If we wanted to do something // sensible, we might send more events through like // this.) See bug 7554, bug 49897, and bug 96813. nsEventStatus status = aVisitor.mEventStatus; // Ok to use aVisitor.mEvent as parameter because DispatchClickEvent // will actually create a new event. widget::EventFlags eventFlags; eventFlags.Clear(); eventFlags.mMultipleActionsPrevented = true; DispatchClickEvent(aVisitor.mPresContext, static_cast<nsInputEvent*>(aVisitor.mEvent), content, false, &eventFlags, &status); // Do we care about the status this returned? I don't think we do... // Don't run another <label> off of this click aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true; } break; } mHandlingEvent = false; } return NS_OK; }
nsresult HTMLLabelElement::PostHandleEvent(EventChainPostVisitor& aVisitor) { WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent(); if (mHandlingEvent || (!(mouseEvent && mouseEvent->IsLeftClickEvent()) && aVisitor.mEvent->mMessage != eMouseDown) || aVisitor.mEventStatus == nsEventStatus_eConsumeNoDefault || !aVisitor.mPresContext || // Don't handle the event if it's already been handled by another label aVisitor.mEvent->mFlags.mMultipleActionsPrevented) { return NS_OK; } nsCOMPtr<nsIContent> target = do_QueryInterface(aVisitor.mEvent->target); if (InInteractiveHTMLContent(target, this)) { return NS_OK; } // Strong ref because event dispatch is going to happen. RefPtr<Element> content = GetLabeledElement(); if (content) { mHandlingEvent = true; switch (aVisitor.mEvent->mMessage) { case eMouseDown: if (mouseEvent->button == WidgetMouseEvent::eLeftButton) { // We reset the mouse-down point on every event because there is // no guarantee we will reach the eMouseClick code below. LayoutDeviceIntPoint* curPoint = new LayoutDeviceIntPoint(mouseEvent->refPoint); SetProperty(nsGkAtoms::labelMouseDownPtProperty, static_cast<void*>(curPoint), nsINode::DeleteProperty<LayoutDeviceIntPoint>); } break; case eMouseClick: if (mouseEvent->IsLeftClickEvent()) { LayoutDeviceIntPoint* mouseDownPoint = static_cast<LayoutDeviceIntPoint*>( GetProperty(nsGkAtoms::labelMouseDownPtProperty)); bool dragSelect = false; if (mouseDownPoint) { LayoutDeviceIntPoint dragDistance = *mouseDownPoint; DeleteProperty(nsGkAtoms::labelMouseDownPtProperty); dragDistance -= mouseEvent->refPoint; const int CLICK_DISTANCE = 2; dragSelect = dragDistance.x > CLICK_DISTANCE || dragDistance.x < -CLICK_DISTANCE || dragDistance.y > CLICK_DISTANCE || dragDistance.y < -CLICK_DISTANCE; } // Don't click the for-content if we did drag-select text or if we // have a kbd modifier (which adjusts a selection). if (dragSelect || mouseEvent->IsShift() || mouseEvent->IsControl() || mouseEvent->IsAlt() || mouseEvent->IsMeta()) { break; } // Only set focus on the first click of multiple clicks to prevent // to prevent immediate de-focus. if (mouseEvent->clickCount <= 1) { nsIFocusManager* fm = nsFocusManager::GetFocusManager(); if (fm) { // Use FLAG_BYMOVEFOCUS here so that the label is scrolled to. // Also, within HTMLInputElement::PostHandleEvent, inputs will // be selected only when focused via a key or when the navigation // flag is used and we want to select the text on label clicks as // well. // If the label has been clicked by the user, we also want to // pass FLAG_BYMOUSE so that we get correct focus ring behavior, // but we don't want to pass FLAG_BYMOUSE if this click event was // caused by the user pressing an accesskey. nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(content); bool byMouse = (mouseEvent->inputSource != nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD); bool byTouch = (mouseEvent->inputSource == nsIDOMMouseEvent::MOZ_SOURCE_TOUCH); fm->SetFocus(elem, nsIFocusManager::FLAG_BYMOVEFOCUS | (byMouse ? nsIFocusManager::FLAG_BYMOUSE : 0) | (byTouch ? nsIFocusManager::FLAG_BYTOUCH : 0)); } } // Dispatch a new click event to |content| // (For compatibility with IE, we do only left click. If // we wanted to interpret the HTML spec very narrowly, we // would do nothing. If we wanted to do something // sensible, we might send more events through like // this.) See bug 7554, bug 49897, and bug 96813. nsEventStatus status = aVisitor.mEventStatus; // Ok to use aVisitor.mEvent as parameter because DispatchClickEvent // will actually create a new event. EventFlags eventFlags; eventFlags.mMultipleActionsPrevented = true; DispatchClickEvent(aVisitor.mPresContext, mouseEvent, content, false, &eventFlags, &status); // Do we care about the status this returned? I don't think we do... // Don't run another <label> off of this click mouseEvent->mFlags.mMultipleActionsPrevented = true; } break; default: break; } mHandlingEvent = false; } return NS_OK; }
void rPropertyCollection::SetColor(const rString& key, const rColor& val) { DeleteProperty(key); m_properties[key] = new rProperty(val); }