Bug 13058: (Fixed Solaris bustage by removing Inherited typedef)

This commit is contained in:
pollmann@netscape.com
1999-09-15 05:31:31 +00:00
parent 76cfdf5e4f
commit f191f05069
27 changed files with 1096 additions and 180 deletions

View File

@@ -45,6 +45,9 @@
#include "nsIFontMetrics.h"
#include "nsILookAndFeel.h"
#include "nsIComponentManager.h"
#include "nsIStatefulFrame.h"
#include "nsISupportsPrimitives.h"
#include "nsIComponentManager.h"
static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID);
static NS_DEFINE_IID(kTextCID, NS_TEXTFIELD_CID);
@@ -67,6 +70,21 @@ nsTextControlFrame::~nsTextControlFrame()
{
}
nsresult
nsTextControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(0 != aInstancePtr, "null ptr");
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
} else if (aIID.Equals(NS_GET_IID(nsIStatefulFrame))) {
*aInstancePtr = (void*)(nsIStatefulFrame*) this;
NS_ADDREF_THIS();
return NS_OK;
}
return nsFormControlFrame::QueryInterface(aIID, aInstancePtr);
}
nscoord
nsTextControlFrame::GetVerticalBorderWidth(float aPixToTwip) const
{
@@ -355,3 +373,49 @@ nsTextControlFrame::GetWrapProperty(nsString &aOutValue)
}
return result;
}
//----------------------------------------------------------------------
// nsIStatefulFrame
//----------------------------------------------------------------------
NS_IMETHODIMP
nsTextControlFrame::GetStateType(nsIStatefulFrame::StateType* aStateType)
{
*aStateType = nsIStatefulFrame::eTextType;
return NS_OK;
}
NS_IMETHODIMP
nsTextControlFrame::SaveState(nsISupports** aState)
{
nsISupportsString* value = nsnull;
nsAutoString string;
nsresult res = GetProperty(nsHTMLAtoms::value, string);
if (NS_SUCCEEDED(res)) {
char* chars = string.ToNewCString();
if (chars) {
res = nsComponentManager::CreateInstance(NS_SUPPORTS_STRING_PROGID, nsnull,
NS_GET_IID(nsISupportsString), (void**)&value);
if (NS_SUCCEEDED(res) && value) {
value->SetData(chars);
}
nsCRT::free(chars);
} else {
res = NS_ERROR_OUT_OF_MEMORY;
}
}
*aState = (nsISupports*)value;
return res;
}
NS_IMETHODIMP
nsTextControlFrame::RestoreState(nsISupports* aState)
{
char* chars = nsnull;
nsresult res = ((nsISupportsString*)aState)->GetData(&chars);
if (NS_SUCCEEDED(res) && chars) {
nsAutoString string(chars);
res = SetProperty(nsHTMLAtoms::value, string);
nsCRT::free(chars);
}
return res;
}