Added method "DoneAddingContent" to notify the select that all the chiild are there

it also caches this state so it can be asked whether they have been added
Added method: IsDoneAddingContent(PRBool * aIsDone)
r=vidur, bug 17965
This commit is contained in:
rods%netscape.com 1999-11-11 22:13:20 +00:00
Родитель 5ea1ca4cf6
Коммит 717706a90f
2 изменённых файлов: 54 добавлений и 0 удалений

Просмотреть файл

@ -181,11 +181,14 @@ public:
// nsISelectElement
NS_IMETHOD AddOption(nsIContent* aContent);
NS_IMETHOD RemoveOption(nsIContent* aContent);
NS_IMETHOD DoneAddingContent();
NS_IMETHOD IsDoneAddingContent(PRBool * aIsDone);
protected:
nsGenericHTMLContainerElement mInner;
nsIForm* mForm;
nsOptionList* mOptions;
PRBool mIsDoneAddingContent;
};
@ -214,6 +217,7 @@ nsHTMLSelectElement::nsHTMLSelectElement(nsIAtom* aTag)
mInner.Init(this, aTag);
mOptions = nsnull;
mForm = nsnull;
mIsDoneAddingContent = PR_FALSE;
}
nsHTMLSelectElement::~nsHTMLSelectElement()
@ -702,6 +706,29 @@ nsHTMLSelectElement::RemoveOption(nsIContent* aContent)
return result;
}
NS_IMETHODIMP
nsHTMLSelectElement::IsDoneAddingContent(PRBool * aIsDone)
{
*aIsDone = mIsDoneAddingContent;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLSelectElement::DoneAddingContent()
{
mIsDoneAddingContent = PR_TRUE;
nsIFormControlFrame* fcFrame = nsnull;
nsresult result = nsGenericHTMLElement::GetPrimaryFrame(this, fcFrame);
if (NS_SUCCEEDED(result) && (nsnull != fcFrame)) {
nsISelectControlFrame* selectFrame = nsnull;
result = fcFrame->QueryInterface(nsISelectControlFrame::GetIID(),(void **) &selectFrame);
if (NS_SUCCEEDED(result) && (nsnull != selectFrame)) {
result = selectFrame->DoneAddingContent();
}
}
return result;
}
NS_IMETHODIMP
nsHTMLSelectElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,

Просмотреть файл

@ -181,11 +181,14 @@ public:
// nsISelectElement
NS_IMETHOD AddOption(nsIContent* aContent);
NS_IMETHOD RemoveOption(nsIContent* aContent);
NS_IMETHOD DoneAddingContent();
NS_IMETHOD IsDoneAddingContent(PRBool * aIsDone);
protected:
nsGenericHTMLContainerElement mInner;
nsIForm* mForm;
nsOptionList* mOptions;
PRBool mIsDoneAddingContent;
};
@ -214,6 +217,7 @@ nsHTMLSelectElement::nsHTMLSelectElement(nsIAtom* aTag)
mInner.Init(this, aTag);
mOptions = nsnull;
mForm = nsnull;
mIsDoneAddingContent = PR_FALSE;
}
nsHTMLSelectElement::~nsHTMLSelectElement()
@ -702,6 +706,29 @@ nsHTMLSelectElement::RemoveOption(nsIContent* aContent)
return result;
}
NS_IMETHODIMP
nsHTMLSelectElement::IsDoneAddingContent(PRBool * aIsDone)
{
*aIsDone = mIsDoneAddingContent;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLSelectElement::DoneAddingContent()
{
mIsDoneAddingContent = PR_TRUE;
nsIFormControlFrame* fcFrame = nsnull;
nsresult result = nsGenericHTMLElement::GetPrimaryFrame(this, fcFrame);
if (NS_SUCCEEDED(result) && (nsnull != fcFrame)) {
nsISelectControlFrame* selectFrame = nsnull;
result = fcFrame->QueryInterface(nsISelectControlFrame::GetIID(),(void **) &selectFrame);
if (NS_SUCCEEDED(result) && (nsnull != selectFrame)) {
result = selectFrame->DoneAddingContent();
}
}
return result;
}
NS_IMETHODIMP
nsHTMLSelectElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,