added accessors to additional style contexts

git-svn-id: svn://10.0.0.236/trunk@45971 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
peterl%netscape.com
1999-09-03 23:41:20 +00:00
parent 80ac4d30c5
commit 1622ba5d47
6 changed files with 104 additions and 0 deletions

View File

@@ -728,6 +728,40 @@ nsProgressMeterFrame::Redraw(nsIPresContext* aPresContext)
Invalidate(rect, PR_TRUE);
}
NS_IMETHODIMP
nsProgressMeterFrame::GetAdditionalStyleContext(PRInt32 aIndex,
nsIStyleContext** aStyleContext) const
{
NS_PRECONDITION(nsnull != aStyleContext, "null OUT parameter pointer");
if (aIndex < 0) {
return NS_ERROR_INVALID_ARG;
}
*aStyleContext = nsnull;
switch (aIndex) {
case NS_PROGRESS_METER_STRIPE_CONTEXT_INDEX:
*aStyleContext = mBarStyle;
NS_ADDREF(*aStyleContext);
break;
}
return NS_OK;
}
NS_IMETHODIMP
nsProgressMeterFrame::SetAdditionalStyleContext(PRInt32 aIndex,
nsIStyleContext* aStyleContext)
{
if (aIndex < 0) {
return NS_ERROR_INVALID_ARG;
}
switch (aIndex) {
case NS_PROGRESS_METER_STRIPE_CONTEXT_INDEX:
mBarStyle = aStyleContext;
break;
}
return NS_OK;
}
//
// RefreshStyleContext
//

View File

@@ -51,6 +51,8 @@
class nsIPresContext;
class nsIStyleContext;
#define NS_PROGRESS_METER_STRIPE_CONTEXT_INDEX 1
class nsProgressMeterFrame : public nsLeafFrame
{
public:
@@ -77,6 +79,10 @@ public:
nsIAtom* aAttribute,
PRInt32 aHint);
NS_IMETHOD GetAdditionalStyleContext(PRInt32 aIndex,
nsIStyleContext** aStyleContext) const;
NS_IMETHOD SetAdditionalStyleContext(PRInt32 aIndex,
nsIStyleContext* aStyleContext);
NS_IMETHOD ReResolveStyleContext ( nsIPresContext* aPresContext,
nsIStyleContext* aParentContext,
PRInt32 aParentChange,

View File

@@ -1172,6 +1172,20 @@ nsTitledButtonFrame :: CheckStateToString ( CheckState inState, nsString& outSta
} // CheckStateToString
NS_IMETHODIMP
nsTitledButtonFrame::GetAdditionalStyleContext(PRInt32 aIndex,
nsIStyleContext** aStyleContext) const
{
return mRenderer.GetStyleContext(aIndex, aStyleContext);
}
NS_IMETHODIMP
nsTitledButtonFrame::SetAdditionalStyleContext(PRInt32 aIndex,
nsIStyleContext* aStyleContext)
{
return mRenderer.SetStyleContext(aIndex, aStyleContext);
}
//
// ReResolveStyleContext
//

View File

@@ -51,6 +51,10 @@ public:
nsIAtom* aAttribute,
PRInt32 aHint);
NS_IMETHOD GetAdditionalStyleContext(PRInt32 aIndex,
nsIStyleContext** aStyleContext) const;
NS_IMETHOD SetAdditionalStyleContext(PRInt32 aIndex,
nsIStyleContext* aStyleContext);
NS_IMETHOD ReResolveStyleContext ( nsIPresContext* aPresContext,
nsIStyleContext* aParentContext,
PRInt32 aParentChange,

View File

@@ -164,6 +164,46 @@ nsToolboxFrame :: RefreshStyleContext(nsIPresContext* aPresContext,
} // RefreshStyleContext
NS_IMETHODIMP
nsToolboxFrame::GetAdditionalStyleContext(PRInt32 aIndex,
nsIStyleContext** aStyleContext) const
{
NS_PRECONDITION(nsnull != aStyleContext, "null OUT parameter pointer");
if (aIndex < 0) {
return NS_ERROR_INVALID_ARG;
}
*aStyleContext = nsnull;
switch (aIndex) {
case NS_TOOLBOX_GRIPPY_NORMAL_CONTEXT_INDEX:
*aStyleContext = mGrippyNormalStyle;
NS_ADDREF(*aStyleContext);
break;
case NS_TOOLBOX_GRIPPY_ROLLOVER_CONTEXT_INDEX:
*aStyleContext = mGrippyRolloverStyle;
NS_ADDREF(*aStyleContext);
break;
}
return NS_OK;
}
NS_IMETHODIMP
nsToolboxFrame::SetAdditionalStyleContext(PRInt32 aIndex,
nsIStyleContext* aStyleContext)
{
if (aIndex < 0) {
return NS_ERROR_INVALID_ARG;
}
switch (aIndex) {
case NS_TOOLBOX_GRIPPY_NORMAL_CONTEXT_INDEX:
mGrippyNormalStyle = aStyleContext;
break;
case NS_TOOLBOX_GRIPPY_ROLLOVER_CONTEXT_INDEX:
mGrippyRolloverStyle = aStyleContext;
break;
}
return NS_OK;
}
//
// ReResolveStyleContext
//

View File

@@ -47,6 +47,8 @@
#include "nsCOMPtr.h"
#include "nsBoxFrame.h"
#define NS_TOOLBOX_GRIPPY_NORMAL_CONTEXT_INDEX 0
#define NS_TOOLBOX_GRIPPY_ROLLOVER_CONTEXT_INDEX 1
class nsToolboxFrame : public nsBoxFrame
{
@@ -75,6 +77,10 @@ public:
nsIStyleContext* aContext,
nsIFrame* aPrevInFlow);
NS_IMETHOD GetAdditionalStyleContext(PRInt32 aIndex,
nsIStyleContext** aStyleContext) const;
NS_IMETHOD SetAdditionalStyleContext(PRInt32 aIndex,
nsIStyleContext* aStyleContext);
NS_IMETHOD ReResolveStyleContext ( nsIPresContext* aPresContext,
nsIStyleContext* aParentContext,
PRInt32 aParentChange,