зеркало из https://github.com/mozilla/gecko-dev.git
Minor cleanups. Also, setting a halfway reasonable color on this widget (it can be changed with the greatest of ease later). NOT PART OF BUILD.
This commit is contained in:
Родитель
ee3e1ed4e7
Коммит
dd359fd27b
|
@ -16,15 +16,16 @@
|
|||
* Reserved.
|
||||
*/
|
||||
|
||||
#include <Xm/Text.h>
|
||||
|
||||
#include "nsTextWidget.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "xlibrgb.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXtEventHandler.h"
|
||||
|
||||
#include <Xm/Text.h>
|
||||
|
||||
#define DBG 0
|
||||
|
||||
extern int mIsPasswordCallBacksInstalled;
|
||||
|
@ -42,6 +43,10 @@ nsTextWidget::nsTextWidget() : nsTextHelper(),
|
|||
mMakeReadOnly(PR_FALSE),
|
||||
mMakePassword(PR_FALSE)
|
||||
{
|
||||
mBackground = NS_RGB(127, 127, 127);
|
||||
mForeground = NS_RGB(255, 255, 255);
|
||||
mBackgroundPixel = xlib_rgb_xpixel_from_rgb(mBackground);
|
||||
mForegroundPixel = xlib_rgb_xpixel_from_rgb(mForeground);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
@ -55,13 +60,14 @@ nsTextWidget::~nsTextWidget()
|
|||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsTextWidget::Create(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsIToolkit *aToolkit,
|
||||
nsWidgetInitData *aInitData)
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsIToolkit *aToolkit,
|
||||
nsWidgetInitData *aInitData)
|
||||
{
|
||||
printf("nsTextWidget::Create called\n");
|
||||
aParent->AddChild(this);
|
||||
Widget parentWidget = nsnull;
|
||||
|
||||
|
@ -76,17 +82,19 @@ NS_METHOD nsTextWidget::Create(nsIWidget *aParent,
|
|||
InitToolkit(aToolkit, aParent);
|
||||
InitDeviceContext(aContext, parentWidget);
|
||||
|
||||
mWidget = ::XtVaCreateManagedWidget("button",
|
||||
xmTextWidgetClass,
|
||||
parentWidget,
|
||||
XmNwidth, aRect.width,
|
||||
XmNheight, aRect.height,
|
||||
XmNrecomputeSize, False,
|
||||
XmNhighlightOnEnter, False,
|
||||
XmNeditable, mMakeReadOnly?False:True,
|
||||
XmNx, aRect.x,
|
||||
XmNy, aRect.y,
|
||||
nsnull);
|
||||
mWidget = ::XtVaCreateManagedWidget("nsTextWidget",
|
||||
xmTextWidgetClass,
|
||||
parentWidget,
|
||||
XmNwidth, aRect.width,
|
||||
XmNheight, aRect.height,
|
||||
XmNrecomputeSize, False,
|
||||
XmNbackground, mBackgroundPixel,
|
||||
XmNforeground, mForegroundPixel,
|
||||
XmNhighlightOnEnter, False,
|
||||
XmNeditable, mMakeReadOnly?False:True,
|
||||
XmNx, aRect.x,
|
||||
XmNy, aRect.y,
|
||||
nsnull);
|
||||
|
||||
// save the event callback function
|
||||
mEventCallback = aHandleEventFunction;
|
||||
|
@ -138,37 +146,6 @@ nsresult nsTextWidget::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsTextWidget::Create(nsNativeWidget aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
nsIToolkit *aToolkit,
|
||||
nsWidgetInitData *aInitData)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// paint, resizes message - ignore
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
PRBool nsTextWidget::OnPaint(nsPaintEvent & aEvent)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------
|
||||
PRBool nsTextWidget::OnResize(nsSizeEvent &aEvent)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
NS_METHOD nsTextWidget::SetPassword(PRBool aIsPassword)
|
||||
{
|
||||
|
|
|
@ -52,19 +52,12 @@ public:
|
|||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull);
|
||||
|
||||
NS_IMETHOD Create(nsNativeWidget aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext = nsnull,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull);
|
||||
|
||||
|
||||
virtual PRBool OnPaint(nsPaintEvent & aEvent);
|
||||
virtual PRBool OnResize(nsSizeEvent &aEvent);
|
||||
NS_IMETHOD SetPassword(PRBool aIsPassword);
|
||||
|
||||
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY) { return PR_FALSE; }
|
||||
virtual PRBool OnPaint(nsPaintEvent & aEvent) { return PR_FALSE; }
|
||||
virtual PRBool OnResize(nsSizeEvent &aEvent) { return PR_FALSE; }
|
||||
|
||||
protected:
|
||||
PRBool mIsPasswordCallBacksInstalled;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче