This commit is contained in:
Jerry.Kirk%Nexwarecorp.com 1999-07-14 15:26:18 +00:00
Родитель f85acd993e
Коммит 021d37b23a
7 изменённых файлов: 22 добавлений и 81 удалений

Просмотреть файл

@ -37,9 +37,9 @@ static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID);
NS_IMPL_ADDREF(nsButton)
NS_IMPL_RELEASE(nsButton)
NS_IMPL_ADDREF_INHERITED(nsButton, nsWidget)
NS_IMPL_RELEASE_INHERITED(nsButton, nsWidget)
NS_IMPL_QUERY_INTERFACE_INHERITED(nsButton, nsWidget, nsIButton)
//-------------------------------------------------------------------------
//
// nsButton constructor
@ -60,34 +60,6 @@ nsButton::~nsButton()
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsButton::~nsButton - Not Implemented!\n"));
}
/**
* Implement the standard QueryInterface for NS_IWIDGET_IID and NS_ISUPPORTS_IID
* @modify gpk 8/4/98
* @param aIID The name of the class implementing the method
* @param _classiiddef The name of the #define symbol that defines the IID
* for the class (e.g. NS_ISUPPORTS_IID)
*
*/
nsresult nsButton::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsButton:QueryInterface, mWidget=%p\n", mWidget));
if (NULL == aInstancePtr)
{
return NS_ERROR_NULL_POINTER;
}
static NS_DEFINE_IID(kIButton, NS_IBUTTON_IID);
if (aIID.Equals(kIButton)) {
*aInstancePtr = (void*) ((nsIButton*)this);
NS_ADDREF_THIS();
return NS_OK;
}
return nsWidget::QueryInterface(aIID,aInstancePtr);
}
//-------------------------------------------------------------------------
//
// Set this button label
@ -96,15 +68,15 @@ nsresult nsButton::QueryInterface(const nsIID& aIID, void** aInstancePtr)
NS_METHOD nsButton::SetLabel(const nsString& aText)
{
nsresult res = NS_ERROR_FAILURE;
mLabel = aText;
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsButton:SetLabel, mWidget=%p\n", mWidget));
if( mWidget )
{
PtArg_t arg;
NS_ALLOC_STR_BUF(label, aText, 256);
NS_ALLOC_STR_BUF(label, aText, aText.Length());
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsButton:SetLabel - aText=<%s> mWidget=%p mRefCnt=<%d>\n", label, mWidget, mRefCnt));
PtSetArg( &arg, Pt_ARG_TEXT_STRING, label, 0 );
if( PtSetResources( mWidget, 1, &arg ) == 0 )
@ -123,7 +95,9 @@ NS_METHOD nsButton::SetLabel(const nsString& aText)
//-------------------------------------------------------------------------
NS_METHOD nsButton::GetLabel(nsString& aBuffer)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsButton::GetLabel\n"));
NS_ALLOC_STR_BUF(label, mLabel, mLabel.Length());
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsButton::GetLabel label=<%s> mRefCnt=<%d>\n", label, mRefCnt));
NS_FREE_STR_BUF(label);
aBuffer = mLabel;
return NS_OK;
@ -173,7 +147,7 @@ NS_METHOD nsButton::CreateNative( PtWidget_t* aParent )
PhDim_t dim;
const unsigned short BorderWidth = 2;
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsButton::CreateNative at (%d,%d) for (%d,%d)\n",mBounds.x,mBounds.y, mBounds.width, mBounds.height));
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsButton::CreateNative at (%d,%d) for (%d,%d) with mRefCnt=<%d>\n",mBounds.x,mBounds.y, mBounds.width, mBounds.height, mRefCnt));
NS_PRECONDITION(aParent, "nsButton::CreateNative aParent is NULL");
@ -194,40 +168,10 @@ NS_METHOD nsButton::CreateNative( PtWidget_t* aParent )
RawEventHandler, this );
res = NS_OK;
/* Add an Activate Callback */
// PtAddCallback(mWidget, Pt_CB_ACTIVATE, handle_activate_event, this);
}
NS_POSTCONDITION(mWidget, "nsButton::CreateNative Failed to create Native Button");
return res;
}
#if 0
int nsButton::handle_activate_event (PtWidget_t *aWidget, void *aData, PtCallbackInfo_t *aCbinfo )
{
nsButton *me = (nsButton *) aData;
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsButton::handle_activate_event widget=<%p>\n",me));
if (me)
{
nsGUIEvent event;
event.widget = me;
NS_IF_ADDREF(event.widget);
event.time = 0; //gdk_event_get_time((GdkEvent*)ge);
event.message = NS_MOUSE_LEFT_BUTTON_UP;
event.point.x = 0;
event.point.y = 0;
event.eventStructType = NS_GUI_EVENT;
PRBool result = me->DispatchWindowEvent(&event);
}
return (Pt_CONTINUE);
}
#endif

Просмотреть файл

@ -34,10 +34,8 @@ public:
nsButton();
virtual ~nsButton();
//nsISupports
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
//nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIButton part
NS_IMETHOD SetLabel(const nsString& aText);
@ -52,12 +50,9 @@ public:
virtual PRBool OnResize(nsRect &aWindowRect);
protected:
NS_IMETHOD CreateNative( PtWidget_t* aParent );
static int handle_activate_event (PtWidget_t *aWidget, void *aData, PtCallbackInfo_t *aCbinfo );
nsString mLabel;
};
#endif // nsButton_h__

Просмотреть файл

@ -160,7 +160,7 @@ NS_METHOD nsCheckButton::SetLabel(const nsString& aText)
{
PtArg_t arg;
NS_ALLOC_STR_BUF(label, aText, 256);
NS_ALLOC_STR_BUF(label, aText, aText.Length());
PtSetArg( &arg, Pt_ARG_TEXT_STRING, label, 0 );
if( PtSetResources( mWidget, 1, &arg ) == 0 )

Просмотреть файл

@ -148,7 +148,7 @@ NS_METHOD nsLabel::SetLabel(const nsString& aText)
{
PtArg_t arg;
NS_ALLOC_STR_BUF(label, aText, 256);
NS_ALLOC_STR_BUF(label, aText, aText.Length());
PtSetArg( &arg, Pt_ARG_TEXT_STRING, label, 0 );
if( PtSetResources( mWidget, 1, &arg ) == 0 )

Просмотреть файл

@ -31,13 +31,15 @@ nsLookAndFeel::nsLookAndFeel() : nsILookAndFeel()
nsLookAndFeel::~nsLookAndFeel()
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsLookAndFeel::~nsLookAndFeel - %p destroyed\n", this));
}
NS_IMETHODIMP nsLookAndFeel::GetColor(const nsColorID aID, nscolor &aColor)
{
nsresult res = NS_OK;
// PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsLookAndFeel::GetColor - Not Implemented!\n"));
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsLookAndFeel::GetColor mRefCnt=<%d>\n", mRefCnt));
switch( aID )
{

Просмотреть файл

@ -152,7 +152,7 @@ NS_METHOD nsRadioButton::SetLabel(const nsString& aText)
{
PtArg_t arg;
NS_ALLOC_STR_BUF(label, aText, 256);
NS_ALLOC_STR_BUF(label, aText, aText.Length());
PtSetArg( &arg, Pt_ARG_TEXT_STRING, label, 0 );
if( PtSetResources( mWidget, 1, &arg ) == 0 )

Просмотреть файл

@ -85,9 +85,9 @@ NS_METHOD nsTextHelper::SetText(const nsString &aText, PRUint32& aActualSize)
if (mWidget)
{
NS_ALLOC_STR_BUF(buf, aText, 512);
NS_ALLOC_STR_BUF(buf, aText, aText.Length());
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsTextHelper::SetText to <%s>\n", buf));
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsTextHelper::SetText to <%s> for <%p>\n", buf, mWidget));
PtSetArg(&arg[0], Pt_ARG_TEXT_STRING, buf, 0);
PtSetResources(mWidget, 1, arg);
@ -109,7 +109,7 @@ NS_METHOD nsTextHelper::InsertText(const nsString &aText, PRUint32 aStartPos, P
PRUint32 currentTextLength;
if (mWidget)
{
NS_ALLOC_STR_BUF(buf, aText, 512);
NS_ALLOC_STR_BUF(buf, aText, aText.Length());
ret=PtTextModifyText(mWidget,0,0,aStartPos,buf,aText.Length());
if (!ret)
{
@ -286,5 +286,5 @@ nsTextHelper::nsTextHelper() : nsWidget(), nsITextAreaWidget(), nsITextWidget()
//-------------------------------------------------------------------------
nsTextHelper::~nsTextHelper()
{
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsTextHelper::~nsTextHelper Destructor called\n"));
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsTextHelper::~nsTextHelper Destructor called for <%p>\n", mWidget));
}