Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends
nsSVGAngle Class Reference
Inheritance diagram for nsSVGAngle:
Inheritance graph
[legend]
Collaboration diagram for nsSVGAngle:
Collaboration graph
[legend]

List of all members.

Public Types

enum  modificationType { mod_other = 0, mod_context, mod_die }

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIDOMSVGANGLE
NS_IMETHOD 
SetValueString (const nsAString &aValue)
NS_IMETHOD GetValueString (nsAString &aValue)
NS_IMETHOD WillModifySVGObservable (nsISVGValue *observable, modificationType aModType)
NS_IMETHOD DidModifySVGObservable (nsISVGValue *observable, modificationType aModType)
void newValueSpecifiedUnits (in unsigned short unitType, in float valueInSpecifiedUnits)
void convertToSpecifiedUnits (in unsigned short unitType)
NS_IMETHOD AddObserver (nsISVGValueObserver *observer)
NS_IMETHOD RemoveObserver (nsISVGValueObserver *observer)
NS_IMETHOD BeginBatchUpdate ()
NS_IMETHOD EndBatchUpdate ()
typedef NS_STDCALL_FUNCPROTO (nsresult, SVGObserverNotifyFunction, nsISVGValueObserver, DidModifySVGObservable,(nsISVGValue *, nsISVGValue::modificationType))

Public Attributes

const unsigned short SVG_ANGLETYPE_UNKNOWN = 0
const unsigned short SVG_ANGLETYPE_UNSPECIFIED = 1
const unsigned short SVG_ANGLETYPE_DEG = 2
const unsigned short SVG_ANGLETYPE_RAD = 3
const unsigned short SVG_ANGLETYPE_GRAD = 4
readonly attribute unsigned short unitType
attribute float value
attribute float valueInSpecifiedUnits
attribute DOMString valueAsString

Protected Member Functions

 nsSVGAngle (float value, PRUint16 unit)
 nsSVGAngle ()
virtual ~nsSVGAngle ()
void GetUnitString (nsAString &unit)
PRUint16 GetUnitTypeForString (const char *unitStr)
PRBool IsValidUnitType (PRUint16 unit)
void WillModify (modificationType aModType=mod_other)
void DidModify (modificationType aModType=mod_other)
void ReleaseObservers ()
void NotifyObservers (SVGObserverNotifyFunction f, modificationType aModType)
PRInt32 GetModifyNestCount ()

Protected Attributes

float mValueInSpecifiedUnits
PRUint8 mSpecifiedUnitType: 3
PRPackedBool mIsAuto: 1

Friends

nsresult NS_NewSVGAngle (nsIDOMSVGAngle **result, float value, PRUint16 unit)
nsresult NS_NewSVGAngle (nsIDOMSVGAngle **result, const nsAString &value)
class nsSVGValueAutoNotifier

Detailed Description

Definition at line 57 of file nsSVGAngle.cpp.


Member Enumeration Documentation

Enumerator:
mod_other 
mod_context 
mod_die 

Definition at line 68 of file nsISVGValue.h.


Constructor & Destructor Documentation

nsSVGAngle::nsSVGAngle ( float  value,
PRUint16  unit 
) [protected]

Definition at line 138 of file nsSVGAngle.cpp.

Here is the call graph for this function:

nsSVGAngle::nsSVGAngle ( ) [protected]

Definition at line 147 of file nsSVGAngle.cpp.

{
}
nsSVGAngle::~nsSVGAngle ( ) [protected, virtual]

Definition at line 151 of file nsSVGAngle.cpp.

{
}

Member Function Documentation

NS_IMETHODIMP nsSVGValue::AddObserver ( nsISVGValueObserver observer) [virtual, inherited]

Implements nsISVGValue.

Definition at line 97 of file nsSVGValue.cpp.

{
  nsIWeakReference* wr = NS_GetWeakReference(observer);
  if (!wr) return NS_ERROR_FAILURE;
  mObservers.AppendElement((void*)wr);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsSVGValue::BeginBatchUpdate ( ) [virtual, inherited]

Implements nsISVGValue.

Definition at line 119 of file nsSVGValue.cpp.

{
  WillModify();
  return NS_OK;
}

Here is the call graph for this function:

void nsIDOMSVGAngle::convertToSpecifiedUnits ( in unsigned short  unitType) [inherited]
void nsSVGValue::DidModify ( modificationType  aModType = mod_other) [protected, inherited]

Definition at line 86 of file nsSVGValue.cpp.

{
  NS_ASSERTION(mModifyNestCount>0, "unbalanced Will/DidModify calls");
  if (--mModifyNestCount == 0) {
    OnDidModify();
    NotifyObservers(&nsISVGValueObserver::DidModifySVGObservable, aModType);
  }
}

Here is the call graph for this function:

Implements nsISVGValueObserver.

Definition at line 196 of file nsSVGAngle.cpp.

{
  DidModify(aModType);
  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsSVGValue::EndBatchUpdate ( ) [virtual, inherited]

Implements nsISVGValue.

Definition at line 126 of file nsSVGValue.cpp.

{
  DidModify();
  return NS_OK;
}

Here is the call graph for this function:

PRInt32 nsSVGValue::GetModifyNestCount ( ) [inline, protected, inherited]

Definition at line 79 of file nsSVGValue.h.

{ return mModifyNestCount; }
void nsSVGAngle::GetUnitString ( nsAString &  unit) [protected]

Definition at line 375 of file nsSVGAngle.cpp.

{
  nsIAtom* UnitAtom = nsnull;
  
  switch (mSpecifiedUnitType) {
  case SVG_ANGLETYPE_UNSPECIFIED:
    UnitAtom = nsnull;
    break;
  case SVG_ANGLETYPE_DEG:
    UnitAtom = nsSVGAtoms::deg;
    break;
  case SVG_ANGLETYPE_GRAD:
    UnitAtom = nsSVGAtoms::grad;
    break;
  case SVG_ANGLETYPE_RAD:
    UnitAtom = nsSVGAtoms::rad;
    break;
  default:
    NS_ASSERTION(PR_FALSE, "unknown unit");
    break;
  }
  if (!UnitAtom) return;

  UnitAtom->ToString(unit);
}
PRUint16 nsSVGAngle::GetUnitTypeForString ( const char *  unitStr) [protected]

Definition at line 401 of file nsSVGAngle.cpp.

{
  if (!unitStr || *unitStr=='\0') return SVG_ANGLETYPE_UNSPECIFIED;
                   
  nsCOMPtr<nsIAtom> unitAtom = do_GetAtom(unitStr);

  if (unitAtom == nsSVGAtoms::deg)
    return SVG_ANGLETYPE_DEG;
  else if (unitAtom == nsSVGAtoms::grad)
    return SVG_ANGLETYPE_GRAD;
  else if (unitAtom == nsSVGAtoms::rad)
    return SVG_ANGLETYPE_RAD;

  return SVG_ANGLETYPE_UNKNOWN;
}

Here is the call graph for this function:

NS_IMETHODIMP nsSVGAngle::GetValueString ( nsAString &  aValue) [virtual]

Implements nsISVGValue.

Definition at line 179 of file nsSVGAngle.cpp.

{
  return GetValueAsString(aValue);
}

Definition at line 417 of file nsSVGAngle.cpp.

{
  if (unit>0 && unit<=4)
    return PR_TRUE;

  return PR_FALSE;
}

Here is the caller graph for this function:

void nsIDOMSVGAngle::newValueSpecifiedUnits ( in unsigned short  unitType,
in float  valueInSpecifiedUnits 
) [inherited]
void nsSVGValue::NotifyObservers ( SVGObserverNotifyFunction  f,
modificationType  aModType 
) [protected, inherited]

Definition at line 66 of file nsSVGValue.cpp.

{
  PRInt32 count = mObservers.Count();
  for (PRInt32 i = 0; i < count; ++i) {
    nsIWeakReference* wr = NS_STATIC_CAST(nsIWeakReference*,mObservers.ElementAt(i));
    nsCOMPtr<nsISVGValueObserver> observer = do_QueryReferent(wr);
    if (observer)
       (NS_STATIC_CAST(nsISVGValueObserver*,observer)->*f)(this, aModType);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

typedef nsSVGValue::NS_STDCALL_FUNCPROTO ( nsresult  ,
SVGObserverNotifyFunction  ,
nsISVGValueObserver  ,
DidModifySVGObservable  ,
(nsISVGValue *, nsISVGValue::modificationType  
) [inherited]
void nsSVGValue::ReleaseObservers ( ) [protected, inherited]

Definition at line 53 of file nsSVGValue.cpp.

{
  PRInt32 count = mObservers.Count();
  PRInt32 i;
  for (i = 0; i < count; ++i) {
    nsIWeakReference* wr = NS_STATIC_CAST(nsIWeakReference*,mObservers.ElementAt(i));
    NS_RELEASE(wr);
  }
  while (i)
    mObservers.RemoveElementAt(--i);
}

Here is the caller graph for this function:

NS_IMETHODIMP nsSVGValue::RemoveObserver ( nsISVGValueObserver observer) [virtual, inherited]

Implements nsISVGValue.

Definition at line 106 of file nsSVGValue.cpp.

{
  nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(observer);
  if (!wr) return NS_ERROR_FAILURE;
  PRInt32 i = mObservers.IndexOf((void*)wr);
  if (i<0) return NS_ERROR_FAILURE;
  nsIWeakReference* wr2 = NS_STATIC_CAST(nsIWeakReference*,mObservers.ElementAt(i));
  NS_RELEASE(wr2);
  mObservers.RemoveElementAt(i);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Implements nsISVGValue.

Definition at line 173 of file nsSVGAngle.cpp.

{
  return SetValueAsString(aValue);
}
void nsSVGValue::WillModify ( modificationType  aModType = mod_other) [protected, inherited]

Definition at line 79 of file nsSVGValue.cpp.

Here is the call graph for this function:

Implements nsISVGValueObserver.

Definition at line 188 of file nsSVGAngle.cpp.

{
  WillModify(aModType);
  return NS_OK;
}

Here is the call graph for this function:


Friends And Related Function Documentation

nsresult NS_NewSVGAngle ( nsIDOMSVGAngle **  result,
float  value,
PRUint16  unit 
) [friend]

Definition at line 110 of file nsSVGAngle.cpp.

{
  nsSVGAngle *pl = new nsSVGAngle(value, unit);
  NS_ENSURE_TRUE(pl, NS_ERROR_OUT_OF_MEMORY);
  NS_ADDREF(pl);
  *result = pl;
  return NS_OK;
}
nsresult NS_NewSVGAngle ( nsIDOMSVGAngle **  result,
const nsAString &  value 
) [friend]

Definition at line 122 of file nsSVGAngle.cpp.

{
  *result = nsnull;
  nsSVGAngle *pl = new nsSVGAngle();
  NS_ENSURE_TRUE(pl, NS_ERROR_OUT_OF_MEMORY);
  NS_ADDREF(pl);
  if (NS_FAILED(pl->SetValueAsString(value))) {
    NS_RELEASE(pl);
    return NS_ERROR_FAILURE;
  }
  *result = pl;
  return NS_OK;
}  
friend class nsSVGValueAutoNotifier [friend, inherited]

Definition at line 59 of file nsSVGValue.h.


Member Data Documentation

Definition at line 102 of file nsSVGAngle.cpp.

Definition at line 101 of file nsSVGAngle.cpp.

Definition at line 100 of file nsSVGAngle.cpp.

const unsigned short nsIDOMSVGAngle::SVG_ANGLETYPE_DEG = 2 [inherited]

Definition at line 53 of file nsIDOMSVGAngle.idl.

const unsigned short nsIDOMSVGAngle::SVG_ANGLETYPE_GRAD = 4 [inherited]

Definition at line 55 of file nsIDOMSVGAngle.idl.

const unsigned short nsIDOMSVGAngle::SVG_ANGLETYPE_RAD = 3 [inherited]

Definition at line 54 of file nsIDOMSVGAngle.idl.

const unsigned short nsIDOMSVGAngle::SVG_ANGLETYPE_UNKNOWN = 0 [inherited]

Definition at line 51 of file nsIDOMSVGAngle.idl.

const unsigned short nsIDOMSVGAngle::SVG_ANGLETYPE_UNSPECIFIED = 1 [inherited]

Definition at line 52 of file nsIDOMSVGAngle.idl.

readonly attribute unsigned short nsIDOMSVGAngle::unitType [inherited]

Definition at line 57 of file nsIDOMSVGAngle.idl.

attribute float nsIDOMSVGAngle::value [inherited]

Definition at line 58 of file nsIDOMSVGAngle.idl.

Definition at line 62 of file nsIDOMSVGAngle.idl.

Definition at line 60 of file nsIDOMSVGAngle.idl.


The documentation for this class was generated from the following file: