mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 21:00:50 +00:00
Fixes for compiling
This commit is contained in:
parent
510fa57207
commit
23dca980a8
@ -177,7 +177,7 @@ PRBool nsButton::OnPaint(nsPaintEvent &aEvent)
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsButton::OnResize(nsRect &aWindowRect)
|
||||
PRBool nsButton::OnResize(nsSizeEvent &aEvent)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint(nsPaintEvent &aEvent);
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
virtual PRBool OnResize(nsSizeEvent &aEvent);
|
||||
|
||||
};
|
||||
|
||||
|
@ -267,7 +267,7 @@ PRBool nsCheckButton::OnPaint(nsPaintEvent &aEvent)
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsCheckButton::OnResize(nsRect &aWindowRect)
|
||||
PRBool nsCheckButton::OnResize(nsSizeEvent &aEvent)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint(nsPaintEvent &aEvent);
|
||||
virtual PRBool OnResize(nsRect &aWindowRect);
|
||||
virtual PRBool OnResize(nsSizeEvent &aEvent);
|
||||
|
||||
// These are needed to Override the auto check behavior
|
||||
void Armed();
|
||||
|
@ -28,16 +28,21 @@
|
||||
|
||||
#include <Xm/Label.h>
|
||||
|
||||
#define DBG 0
|
||||
NS_IMPL_ADDREF(nsLabel)
|
||||
NS_IMPL_RELEASE(nsLabel)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// nsLabel constructor
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsLabel::nsLabel(nsISupports *aOuter) : nsWindow(aOuter)
|
||||
nsLabel::nsLabel() : nsWindow(), nsILabel()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mAlignment = eAlign_Left;
|
||||
}
|
||||
|
||||
|
||||
void nsLabel::Create(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
@ -49,8 +54,6 @@ void nsLabel::Create(nsIWidget *aParent,
|
||||
aParent->AddChild(this);
|
||||
Widget parentWidget = nsnull;
|
||||
|
||||
if (DBG) fprintf(stderr, "aParent 0x%x\n", aParent);
|
||||
|
||||
if (aParent) {
|
||||
parentWidget = (Widget) aParent->GetNativeData(NS_NATIVE_WIDGET);
|
||||
} else if (aAppShell) {
|
||||
@ -60,8 +63,6 @@ void nsLabel::Create(nsIWidget *aParent,
|
||||
InitToolkit(aToolkit, aParent);
|
||||
InitDeviceContext(aContext, parentWidget);
|
||||
|
||||
if (DBG) fprintf(stderr, "Parent 0x%x\n", parentWidget);
|
||||
|
||||
unsigned char alignment = GetNativeAlignment();
|
||||
|
||||
mWidget = ::XtVaCreateManagedWidget("label",
|
||||
@ -76,8 +77,6 @@ void nsLabel::Create(nsIWidget *aParent,
|
||||
XmNalignment, alignment,
|
||||
nsnull);
|
||||
|
||||
if (DBG) fprintf(stderr, "Label 0x%x this 0x%x\n", mWidget, this);
|
||||
|
||||
// save the event callback function
|
||||
mEventCallback = aHandleEventFunction;
|
||||
|
||||
@ -112,7 +111,7 @@ void nsLabel::PreCreateWidget(nsWidgetInitData *aInitData)
|
||||
// Set alignment
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
void nsLabel::SetAlignment(nsLabelAlignment aAlignment)
|
||||
NS_METHOD nsLabel::SetAlignment(nsLabelAlignment aAlignment)
|
||||
{
|
||||
mAlignment = aAlignment;
|
||||
}
|
||||
@ -132,21 +131,24 @@ nsLabel::~nsLabel()
|
||||
// Query interface implementation
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsresult nsLabel::QueryObject(REFNSIID aIID, void** aInstancePtr)
|
||||
nsresult nsLabel::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
static NS_DEFINE_IID(kILabelIID, NS_ILABEL_IID);
|
||||
nsresult result = nsWindow::QueryInterface(aIID, aInstancePtr);
|
||||
|
||||
if (aIID.Equals(kILabelIID)) {
|
||||
AddRef();
|
||||
*aInstancePtr = (void**) &mAggWidget;
|
||||
return NS_OK;
|
||||
static NS_DEFINE_IID(kILabelIID, NS_ILABEL_IID);
|
||||
if (result == NS_NOINTERFACE && aIID.Equals(kILabelIID)) {
|
||||
*aInstancePtr = (void*) ((nsILabel*)this);
|
||||
AddRef();
|
||||
result = NS_OK;
|
||||
}
|
||||
return nsWindow::QueryObject(aIID, aInstancePtr);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// return window styles
|
||||
//
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
unsigned char nsLabel::GetNativeAlignment()
|
||||
@ -166,7 +168,7 @@ unsigned char nsLabel::GetNativeAlignment()
|
||||
// Set this button label
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
void nsLabel::SetLabel(const nsString& aText)
|
||||
NS_METHOD nsLabel::SetLabel(const nsString& aText)
|
||||
{
|
||||
NS_ALLOC_STR_BUF(label, aText, 256);
|
||||
XmString str;
|
||||
@ -182,7 +184,7 @@ void nsLabel::SetLabel(const nsString& aText)
|
||||
// Get this button label
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
void nsLabel::GetLabel(nsString& aBuffer)
|
||||
NS_METHOD nsLabel::GetLabel(nsString& aBuffer)
|
||||
{
|
||||
XmString str;
|
||||
XtVaGetValues(mWidget, XmNlabelString, &str, nsnull);
|
||||
@ -202,6 +204,11 @@ void nsLabel::GetLabel(nsString& aBuffer)
|
||||
// paint message. Don't send the paint out
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRBool nsLabel::OnMove(PRInt32, PRInt32)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsLabel::OnPaint(nsPaintEvent &aEvent)
|
||||
{
|
||||
//printf("** nsLabel::OnPaint **\n");
|
||||
@ -214,30 +221,3 @@ PRBool nsLabel::OnResize(nsSizeEvent &aEvent)
|
||||
}
|
||||
|
||||
|
||||
#define GET_OUTER() ((nsLabel*) ((char*)this - nsLabel::GetOuterOffset()))
|
||||
|
||||
void nsLabel::AggLabel::GetLabel(nsString& aBuffer)
|
||||
{
|
||||
GET_OUTER()->GetLabel(aBuffer);
|
||||
}
|
||||
|
||||
void nsLabel::AggLabel::SetLabel(const nsString& aText)
|
||||
{
|
||||
GET_OUTER()->SetLabel(aText);
|
||||
}
|
||||
|
||||
void nsLabel::AggLabel::SetAlignment(nsLabelAlignment aAlignment)
|
||||
{
|
||||
GET_OUTER()->SetAlignment(aAlignment);
|
||||
}
|
||||
|
||||
//void nsLabel::AggLabel::PreCreateWidget(nsWidgetInitData *aInitData)
|
||||
//{
|
||||
//GET_OUTER()->PreCreateWidget(aInitData);
|
||||
//}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
BASE_IWIDGET_IMPL(nsLabel, AggLabel);
|
||||
|
||||
|
||||
|
@ -26,15 +26,26 @@
|
||||
/**
|
||||
* Native Motif Label wrapper
|
||||
*/
|
||||
|
||||
class nsLabel : public nsWindow
|
||||
class nsLabel : public nsWindow,
|
||||
public nsILabel
|
||||
{
|
||||
|
||||
public:
|
||||
nsLabel(nsISupports *aOuter);
|
||||
|
||||
nsLabel();
|
||||
virtual ~nsLabel();
|
||||
|
||||
NS_IMETHOD QueryObject(const nsIID& aIID, void** aInstancePtr);
|
||||
// nsISupports
|
||||
NS_IMETHOD_(nsrefcnt) AddRef();
|
||||
NS_IMETHOD_(nsrefcnt) Release();
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
||||
|
||||
// nsILabel part
|
||||
NS_IMETHOD SetLabel(const nsString &aText);
|
||||
NS_IMETHOD GetLabel(nsString &aBuffer);
|
||||
NS_IMETHOD SetAlignment(nsLabelAlignment aAlignment);
|
||||
|
||||
virtual void PreCreateWidget(nsWidgetInitData *aInitData);
|
||||
|
||||
void Create(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
@ -51,48 +62,14 @@ public:
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull);
|
||||
|
||||
|
||||
// nsILabel part
|
||||
virtual void SetAlignment(nsLabelAlignment aAlignment);
|
||||
virtual void SetLabel(const nsString& aText);
|
||||
virtual void GetLabel(nsString& aBuffer);
|
||||
virtual PRBool OnPaint(nsPaintEvent & aEvent);
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
|
||||
virtual PRBool OnPaint(nsPaintEvent &aEvent);
|
||||
virtual PRBool OnResize(nsSizeEvent &aEvent);
|
||||
|
||||
virtual void PreCreateWidget(nsWidgetInitData *aInitData);
|
||||
|
||||
protected:
|
||||
unsigned char nsLabel::GetNativeAlignment();
|
||||
nsLabelAlignment mAlignment;
|
||||
|
||||
private:
|
||||
|
||||
// this should not be public
|
||||
static PRInt32 GetOuterOffset() {
|
||||
return offsetof(nsLabel,mAggWidget);
|
||||
}
|
||||
|
||||
|
||||
// Aggregator class and instance variable used to aggregate in the
|
||||
// nsILabel interface to nsLabel w/o using multiple
|
||||
// inheritance.
|
||||
class AggLabel : public nsILabel {
|
||||
public:
|
||||
AggLabel();
|
||||
virtual ~AggLabel();
|
||||
|
||||
AGGREGATE_METHOD_DEF
|
||||
|
||||
// nsILabel
|
||||
virtual void SetLabel(const nsString &aText);
|
||||
virtual void GetLabel(nsString &aBuffer);
|
||||
virtual void SetAlignment(nsLabelAlignment aAlignment);
|
||||
|
||||
};
|
||||
AggLabel mAggWidget;
|
||||
friend class AggLabel;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // nsLabel_h__
|
||||
|
Loading…
x
Reference in New Issue
Block a user