From 09046f288147e262ffc7cadbd0ec04eb38271e9d Mon Sep 17 00:00:00 2001 From: "amardare%qnx.com" Date: Wed, 31 Mar 2004 22:39:01 +0000 Subject: [PATCH] Changes for qnx ( photon ) platform only - they should not affect runtime/building other platforms. More menu related changes ( menus not being rolled up when switching consoles or window lose focus or Alt key pressed ). Removed unused files. git-svn-id: svn://10.0.0.236/trunk@154417 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/photon/nsAppShell.cpp | 4 - mozilla/widget/src/photon/nsButton.cpp | 176 ----------- mozilla/widget/src/photon/nsButton.h | 77 ----- mozilla/widget/src/photon/nsCheckButton.cpp | 294 ------------------ mozilla/widget/src/photon/nsCheckButton.h | 85 ----- mozilla/widget/src/photon/nsDragService.cpp | 1 - mozilla/widget/src/photon/nsLabel.cpp | 225 -------------- mozilla/widget/src/photon/nsLabel.h | 80 ----- mozilla/widget/src/photon/nsLookAndFeel.cpp | 1 - mozilla/widget/src/photon/nsPhWidgetLog.h | 45 --- mozilla/widget/src/photon/nsSound.cpp | 1 - mozilla/widget/src/photon/nsTextHelper.cpp | 272 ---------------- mozilla/widget/src/photon/nsTextHelper.h | 79 ----- mozilla/widget/src/photon/nsTextWidget.cpp | 166 ---------- mozilla/widget/src/photon/nsTextWidget.h | 69 ---- mozilla/widget/src/photon/nsToolkit.cpp | 2 - mozilla/widget/src/photon/nsWidget.cpp | 2 +- mozilla/widget/src/photon/nsWidgetFactory.cpp | 4 - mozilla/widget/src/photon/nsWindow.cpp | 88 +++--- 19 files changed, 50 insertions(+), 1621 deletions(-) delete mode 100644 mozilla/widget/src/photon/nsButton.cpp delete mode 100644 mozilla/widget/src/photon/nsButton.h delete mode 100644 mozilla/widget/src/photon/nsCheckButton.cpp delete mode 100644 mozilla/widget/src/photon/nsCheckButton.h delete mode 100644 mozilla/widget/src/photon/nsLabel.cpp delete mode 100644 mozilla/widget/src/photon/nsLabel.h delete mode 100644 mozilla/widget/src/photon/nsPhWidgetLog.h delete mode 100644 mozilla/widget/src/photon/nsTextHelper.cpp delete mode 100644 mozilla/widget/src/photon/nsTextHelper.h delete mode 100644 mozilla/widget/src/photon/nsTextWidget.cpp delete mode 100644 mozilla/widget/src/photon/nsTextWidget.h diff --git a/mozilla/widget/src/photon/nsAppShell.cpp b/mozilla/widget/src/photon/nsAppShell.cpp index 6f53fc99f43..0e7402cddf6 100644 --- a/mozilla/widget/src/photon/nsAppShell.cpp +++ b/mozilla/widget/src/photon/nsAppShell.cpp @@ -51,7 +51,6 @@ #include "nsIWidget.h" #include "nsIPref.h" -#include "nsPhWidgetLog.h" #include "nsCRT.h" #include @@ -195,9 +194,6 @@ static void client_connect( PtConnector_t *cntr, PtConnectionServer_t *csrvr, vo NS_IMETHODIMP nsAppShell::Create(int *bac, char **bav) { - if (!PhWidLog) - PhWidLog = PR_NewLogModule("PhWidLog"); - int argc = bac ? *bac : 0; char **argv = bav; diff --git a/mozilla/widget/src/photon/nsButton.cpp b/mozilla/widget/src/photon/nsButton.cpp deleted file mode 100644 index 80ee8f33d16..00000000000 --- a/mozilla/widget/src/photon/nsButton.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsButton.h" -#include "nsToolkit.h" -#include "nsColor.h" -#include "nsGUIEvent.h" -#include "nsString.h" -#include - -#include "nsILookAndFeel.h" -#include "nsWidgetsCID.h" -#include "nsIComponentManager.h" - -#include "nsIDeviceContext.h" -#include "nsIFontMetrics.h" - -#include "nsPhWidgetLog.h" - - - -NS_IMPL_ISUPPORTS_INHERITED1(nsButton, nsWidget, nsIButton) -//------------------------------------------------------------------------- -// -// nsButton constructor -// -//------------------------------------------------------------------------- -nsButton::nsButton() : nsWidget(), nsIButton() -{ -} - -//------------------------------------------------------------------------- -// -// nsButton destructor -// -//------------------------------------------------------------------------- -nsButton::~nsButton() -{ -} - -//------------------------------------------------------------------------- -// -// Set this button label -// -//------------------------------------------------------------------------- -NS_METHOD nsButton::SetLabel(const nsString& aText) -{ - mLabel = aText; - - if( mWidget ) - { - PtArg_t arg; - - PtSetArg( &arg, Pt_ARG_TEXT_STRING, - NS_ConvertUCS2toUTF8(aText).get(), 0 ); - PtSetResources( mWidget, 1, &arg ); - } - - return NS_OK; -} - -//------------------------------------------------------------------------- -// -// Get this button label -// -//------------------------------------------------------------------------- -NS_METHOD nsButton::GetLabel(nsString& aBuffer) -{ - aBuffer = mLabel; - return NS_OK; -} - -//------------------------------------------------------------------------- -// -// move, paint, resizes message - ignore -// -//------------------------------------------------------------------------- -// Not Implemented -PRBool nsButton::OnMove(PRInt32, PRInt32) -{ - return PR_FALSE; -} - -// Not Implemented -PRBool nsButton::OnPaint() -{ - return PR_FALSE; -} - -// Not Implemented -PRBool nsButton::OnResize(nsRect &aWindowRect) -{ - return PR_FALSE; -} - - -/** - * Renders the Button for Printing - * - **/ -// Not Implemented -NS_METHOD nsButton::Paint(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - return NS_OK; -} - - -NS_METHOD nsButton::CreateNative( PtWidget_t* aParent ) -{ - nsresult res = NS_ERROR_FAILURE; - PtArg_t arg[5]; - PhPoint_t pos; - PhDim_t dim; - const unsigned short BorderWidth = 2; - - NS_PRECONDITION(aParent, "nsButton::CreateNative aParent is NULL"); - - pos.x = mBounds.x; - pos.y = mBounds.y; - dim.w = mBounds.width - (2*BorderWidth); // Correct for border width - dim.h = mBounds.height - (2*BorderWidth); - - PtSetArg( &arg[0], Pt_ARG_POS, &pos, 0 ); - PtSetArg( &arg[1], Pt_ARG_DIM, &dim, 0 ); - PtSetArg( &arg[2], Pt_ARG_BORDER_WIDTH, BorderWidth, 0 ); - - mWidget = PtCreateWidget( PtButton, aParent, 3, arg ); - if( mWidget ) - { - PtAddEventHandler( mWidget, - Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE |Ph_EV_BOUNDARY, - RawEventHandler, this ); - - res = NS_OK; - } - - NS_POSTCONDITION(mWidget, "nsButton::CreateNative Failed to create Native Button"); - - return res; -} - diff --git a/mozilla/widget/src/photon/nsButton.h b/mozilla/widget/src/photon/nsButton.h deleted file mode 100644 index 89d7516918e..00000000000 --- a/mozilla/widget/src/photon/nsButton.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nsButton_h__ -#define nsButton_h__ - -#include "nsWidget.h" -#include "nsIButton.h" -#include - -/** - * Native Photon button wrapper - */ - -class nsButton : public nsWidget, public nsIButton -{ - -public: - nsButton(); - virtual ~nsButton(); - - //nsISupports - NS_DECL_ISUPPORTS_INHERITED - - // nsIButton part - NS_IMETHOD SetLabel(const nsString& aText); - NS_IMETHOD GetLabel(nsString& aBuffer); - - // nsBaseWidget - NS_IMETHOD Paint(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - - virtual PRBool OnMove(PRInt32 aX, PRInt32 aY); - virtual PRBool OnPaint(); - virtual PRBool OnResize(nsRect &aWindowRect); - -protected: - NS_IMETHOD CreateNative( PtWidget_t* aParent ); - - nsString mLabel; -}; - -#endif // nsButton_h__ diff --git a/mozilla/widget/src/photon/nsCheckButton.cpp b/mozilla/widget/src/photon/nsCheckButton.cpp deleted file mode 100644 index f7413243450..00000000000 --- a/mozilla/widget/src/photon/nsCheckButton.cpp +++ /dev/null @@ -1,294 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsCheckButton.h" -#include "nsToolkit.h" -#include "nsColor.h" -#include "nsGUIEvent.h" -#include "nsString.h" -#include - -#include "nsILookAndFeel.h" -#include "nsWidgetsCID.h" -#include "nsIComponentManager.h" - -#include "nsIDeviceContext.h" -#include "nsIFontMetrics.h" - -#include "nsPhWidgetLog.h" - - - -NS_IMPL_ADDREF(nsCheckButton) -NS_IMPL_RELEASE(nsCheckButton) - -//------------------------------------------------------------------------- -// -// nsCheckButton constructor -// -//------------------------------------------------------------------------- -nsCheckButton::nsCheckButton() : nsWidget(), nsICheckButton(), - mState(PR_FALSE) -{ -} - -//------------------------------------------------------------------------- -// -// nsCheckButton destructor -// -//------------------------------------------------------------------------- -nsCheckButton::~nsCheckButton() -{ - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton::~nsCheckButton - 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 nsCheckButton::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton:QueryInterface, mWidget=%p\n", mWidget)); - - if (NULL == aInstancePtr) - { - return NS_ERROR_NULL_POINTER; - } - - static NS_DEFINE_IID(kICheckButton, NS_ICHECKBUTTON_IID); - if (aIID.Equals(kICheckButton)) { - *aInstancePtr = (void*) ((nsICheckButton*)this); - NS_ADDREF_THIS(); - return NS_OK; - } - - return nsWidget::QueryInterface(aIID,aInstancePtr); -} - -//------------------------------------------------------------------------- -// -// Set the CheckButton State -// -//------------------------------------------------------------------------- -NS_METHOD nsCheckButton::SetState(const PRBool aState) -{ -// PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsCheckButton:SetState, mWidget=%p new state is <%d>\n", mWidget, aState)); - nsresult res = NS_ERROR_FAILURE; - - mState = aState; - if (mWidget) - { - PtArg_t arg; - - if (mState) - PtSetArg( &arg, Pt_ARG_FLAGS, Pt_SET, Pt_SET ); - else - PtSetArg( &arg, Pt_ARG_FLAGS, 0, Pt_SET ); - - if( PtSetResources( mWidget, 1, &arg ) == 0 ) - res = NS_OK; - } - - return res; -} - -//------------------------------------------------------------------------- -// -// Get the CheckButton State -// -//------------------------------------------------------------------------- -NS_METHOD nsCheckButton::GetState(PRBool & aState) -{ -// PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsCheckButton:GetState, mWidget=%p\n", mWidget)); - nsresult res = NS_ERROR_FAILURE; - - if (mWidget) - { - PtArg_t arg; - long *flags; - - PtSetArg( &arg, Pt_ARG_FLAGS, &flags, 0); - if( PtGetResources( mWidget, 1, &arg ) == 0 ) - { - if( *flags & Pt_SET ) - mState = PR_TRUE; - else - mState = PR_FALSE; - res = NS_OK; - } - } - - aState = mState; - - return res; -} - -//------------------------------------------------------------------------- -// -// Set this button label -// -//------------------------------------------------------------------------- -NS_METHOD nsCheckButton::SetLabel(const nsString& aText) -{ - nsresult res = NS_ERROR_FAILURE; - - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsCheckButton:SetLabel, mWidget=%p\n", mWidget)); - if( mWidget ) - { - PtArg_t arg; - - PtSetArg( &arg, Pt_ARG_TEXT_STRING, - NS_ConvertUCS2toUTF8(aText).get(), 0 ); - if( PtSetResources( mWidget, 1, &arg ) == 0 ) - res = NS_OK; - } - - return res; -} - -//------------------------------------------------------------------------- -// -// Get this button label -// -//------------------------------------------------------------------------- -NS_METHOD nsCheckButton::GetLabel(nsString& aBuffer) -{ - nsresult res = NS_ERROR_FAILURE; - - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton::GetLabel\n")); - - aBuffer.SetLength(0); - - if( mWidget ) - { - PtArg_t arg; - char *label; - - PtSetArg( &arg, Pt_ARG_TEXT_STRING, &label, 0 ); - if( PtGetResources( mWidget, 1, &arg ) == 0 ) - { - aBuffer.Append( label ); - res = NS_OK; - } - } - - return res; -} - -//------------------------------------------------------------------------- -// -// move, paint, resizes message - ignore -// -//------------------------------------------------------------------------- -PRBool nsCheckButton::OnMove(PRInt32, PRInt32) -{ - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton::OnMove - Not Implemented\n")); - return PR_FALSE; -} - -PRBool nsCheckButton::OnPaint() -{ - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton::OnPaint - Not Implemented\n")); - return PR_FALSE; -} - -PRBool nsCheckButton::OnResize(nsRect &aWindowRect) -{ - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton::OnResize - Not Implemented\n")); - return PR_FALSE; -} - - -/** - * Renders the CheckButton for Printing - * - **/ -NS_METHOD nsCheckButton::Paint(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect) -{ - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsCheckButton::Paint - Not Implemented\n")); - return NS_OK; -} - - -NS_METHOD nsCheckButton::CreateNative( PtWidget_t* aParent ) -{ - nsresult res = NS_ERROR_FAILURE; - PtArg_t arg[15]; - PhPoint_t pos; - PhDim_t dim; - - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsCheckButton::CreateNative this=<%p>\n", this)); - - pos.x = mBounds.x; - pos.y = mBounds.y; - dim.w = mBounds.width; // Correct for border width - dim.h = mBounds.height; - - PtSetArg( &arg[0], Pt_ARG_POS, &pos, 0 ); - PtSetArg( &arg[1], Pt_ARG_DIM, &dim, 0 ); - PtSetArg( &arg[2], Pt_ARG_BORDER_WIDTH, 0, 0 ); - PtSetArg( &arg[3], Pt_ARG_INDICATOR_TYPE, Pt_CHECK, 0 ); - PtSetArg( &arg[4], Pt_ARG_INDICATOR_COLOR, Pg_BLACK, 0 ); - PtSetArg( &arg[5], Pt_ARG_SPACING, 0, 0 ); - PtSetArg( &arg[6], Pt_ARG_MARGIN_TOP, 0, 0 ); - PtSetArg( &arg[7], Pt_ARG_MARGIN_LEFT, 0, 0 ); - PtSetArg( &arg[8], Pt_ARG_MARGIN_BOTTOM, 0, 0 ); - PtSetArg( &arg[9], Pt_ARG_MARGIN_RIGHT, 0, 0 ); - PtSetArg( &arg[10], Pt_ARG_MARGIN_WIDTH, 0, 0 ); - PtSetArg( &arg[11], Pt_ARG_MARGIN_HEIGHT, 0, 0 ); - PtSetArg( &arg[12], Pt_ARG_VERTICAL_ALIGNMENT, Pt_TOP, 0 ); - PtSetArg( &arg[13], Pt_ARG_FLAGS, 0, Pt_SELECTABLE ); - - mWidget = PtCreateWidget( PtToggleButton, aParent, 14, arg ); - if( mWidget ) - { - PtAddEventHandler( mWidget, - Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE |Ph_EV_BOUNDARY, - RawEventHandler, this ); - - res = NS_OK; - } - - return res; -} - - diff --git a/mozilla/widget/src/photon/nsCheckButton.h b/mozilla/widget/src/photon/nsCheckButton.h deleted file mode 100644 index 17b8ea0e3ec..00000000000 --- a/mozilla/widget/src/photon/nsCheckButton.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nsCheckButton_h__ -#define nsCheckButton_h__ - -#include "nsWidget.h" -#include "nsICheckButton.h" -#include - -/** - * Native Photon Check Button wrapper - */ - -class nsCheckButton : public nsWidget, public nsICheckButton -{ - -public: - nsCheckButton(); - virtual ~nsCheckButton(); - - //nsISupports - NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); - NS_IMETHOD_(nsrefcnt) AddRef(void); - NS_IMETHOD_(nsrefcnt) Release(void); - - // nsICheckButton part - NS_IMETHOD SetLabel(const nsString& aText); - NS_IMETHOD GetLabel(nsString& aBuffer); - NS_IMETHOD SetState(const PRBool aState); - NS_IMETHOD GetState(PRBool & aState); - - // nsBaseWidget - NS_IMETHOD Paint(nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect); - - virtual PRBool OnMove(PRInt32 aX, PRInt32 aY); - virtual PRBool OnPaint(); - 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 ); - - PRBool mState; - -}; - -#endif // nsCheckButton_h__ diff --git a/mozilla/widget/src/photon/nsDragService.cpp b/mozilla/widget/src/photon/nsDragService.cpp index 5cad6ba00a8..6ed727dc0b0 100644 --- a/mozilla/widget/src/photon/nsDragService.cpp +++ b/mozilla/widget/src/photon/nsDragService.cpp @@ -47,7 +47,6 @@ #include "nsXPIDLString.h" #include "nsWidgetsCID.h" -#include "nsPhWidgetLog.h" NS_IMPL_ADDREF_INHERITED(nsDragService, nsBaseDragService) NS_IMPL_RELEASE_INHERITED(nsDragService, nsBaseDragService) diff --git a/mozilla/widget/src/photon/nsLabel.cpp b/mozilla/widget/src/photon/nsLabel.cpp deleted file mode 100644 index 8b4ec78044a..00000000000 --- a/mozilla/widget/src/photon/nsLabel.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsLabel.h" -#include "nsToolkit.h" -#include "nsColor.h" -#include "nsGUIEvent.h" -#include "nsString.h" -#include - -#include "nsPhWidgetLog.h" - -NS_IMPL_ADDREF_INHERITED(nsLabel, nsWidget) -NS_IMPL_RELEASE_INHERITED(nsLabel, nsWidget) - -//------------------------------------------------------------------------- -// -// nsLabel constructor -// -//------------------------------------------------------------------------- -nsLabel::nsLabel() : nsWidget(), nsILabel() -{ - mAlignment = eAlign_Left; -} - -//------------------------------------------------------------------------- -// -// nsLabel destructor -// -//------------------------------------------------------------------------- -nsLabel::~nsLabel() -{ -} - - -//------------------------------------------------------------------------- -// -// Create the nativeLabel widget -// -//------------------------------------------------------------------------- -NS_METHOD nsLabel::CreateNative( PtWidget_t *aParent ) -{ - nsresult res = NS_ERROR_FAILURE; - PtArg_t arg[5]; - PhPoint_t pos; - PhDim_t dim; - - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsLabel::CreateNative at (%d,%d) for (%d,%d)\n",mBounds.x,mBounds.y, mBounds.width, mBounds.height)); - NS_PRECONDITION(aParent, "nsLabel::CreateNative aParent is NULL"); - - pos.x = mBounds.x; - pos.y = mBounds.y; - dim.w = mBounds.width; - dim.h = mBounds.height; - - PtSetArg( &arg[0], Pt_ARG_POS, &pos, 0 ); - PtSetArg( &arg[1], Pt_ARG_DIM, &dim, 0 ); - PtSetArg( &arg[2], Pt_ARG_BORDER_WIDTH, 0, 0 ); - - mWidget = PtCreateWidget( PtButton, aParent, 3, arg ); - if( mWidget ) - { - res = NS_OK; - } - - NS_POSTCONDITION(mWidget, "nsLabel::CreateNative Failed to create native label"); - - return res; -} - - -//------------------------------------------------------------------------- -// -// -//------------------------------------------------------------------------- -NS_METHOD nsLabel::PreCreateWidget(nsWidgetInitData *aInitData) -{ - if (nsnull != aInitData) { - nsLabelInitData* data = (nsLabelInitData *) aInitData; - mAlignment = data->mAlignment; - } - return NS_OK; -} - - -//------------------------------------------------------------------------- -// -// Set alignment -// -//------------------------------------------------------------------------- -NS_METHOD nsLabel::SetAlignment(nsLabelAlignment aAlignment) -{ - mAlignment = aAlignment; - return NS_OK; -} - - -//------------------------------------------------------------------------- -// -// Query interface implementation -// -//------------------------------------------------------------------------- -nsresult nsLabel::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - - nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr); - - static NS_DEFINE_IID(kILabelIID, NS_ILABEL_IID); - if (result == NS_NOINTERFACE && aIID.Equals(kILabelIID)) { - *aInstancePtr = (void*) ((nsILabel*)this); - AddRef(); - result = NS_OK; - } - - return result; -} - - -//------------------------------------------------------------------------- -// -// Set this button label -// -//------------------------------------------------------------------------- -NS_METHOD nsLabel::SetLabel(const nsString& aText) -{ - nsresult res = NS_ERROR_FAILURE; - - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsLabel:SetLabel\n")); - - if( mWidget ) - { - PtArg_t arg; - - PtSetArg( &arg, Pt_ARG_TEXT_STRING, - NS_ConvertUCS2toUTF8(aText).get(), 0 ); - if( PtSetResources( mWidget, 1, &arg ) == 0 ) - res = NS_OK; - } - - return res; -} - -//------------------------------------------------------------------------- -// -// Get this button label -// -//------------------------------------------------------------------------- -NS_METHOD nsLabel::GetLabel(nsString& aBuffer) -{ - nsresult res = NS_ERROR_FAILURE; - - PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsLabel:GetLabel\n")); - - aBuffer.SetLength(0); - - if( mWidget ) - { - PtArg_t arg; - char *label; - - PtSetArg( &arg, Pt_ARG_TEXT_STRING, &label, 0 ); - if( PtGetResources( mWidget, 1, &arg ) == 0 ) - { - aBuffer.Append( label ); - res = NS_OK; - } - } - - return res; -} - -//------------------------------------------------------------------------- -// -// 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"); - return PR_FALSE; -} - -PRBool nsLabel::OnResize(nsSizeEvent &aEvent) -{ - return PR_FALSE; -} diff --git a/mozilla/widget/src/photon/nsLabel.h b/mozilla/widget/src/photon/nsLabel.h deleted file mode 100644 index 5ae61790cd1..00000000000 --- a/mozilla/widget/src/photon/nsLabel.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nsLabel_h__ -#define nsLabel_h__ - -#include "nsWidget.h" -#include "nsIAppShell.h" -#include "nsILabel.h" - -/** - * Native Photon Label wrapper - */ -class nsLabel : public nsWidget, - public nsILabel -{ - -public: - - nsLabel(); - virtual ~nsLabel(); - - // 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); - - NS_IMETHOD PreCreateWidget(nsWidgetInitData *aInitData); - - virtual PRBool OnMove(PRInt32 aX, PRInt32 aY); - virtual PRBool OnPaint(nsPaintEvent &aEvent); - virtual PRBool OnResize(nsSizeEvent &aEvent); - -protected: - NS_METHOD CreateNative( PtWidget_t *aParent ); - - nsLabelAlignment mAlignment; - -}; - -#endif // nsLabel_h__ diff --git a/mozilla/widget/src/photon/nsLookAndFeel.cpp b/mozilla/widget/src/photon/nsLookAndFeel.cpp index 7c69a74a2ee..0a751c37a5e 100644 --- a/mozilla/widget/src/photon/nsLookAndFeel.cpp +++ b/mozilla/widget/src/photon/nsLookAndFeel.cpp @@ -38,7 +38,6 @@ #include "nsLookAndFeel.h" #include #include "nsFont.h" -#include "nsPhWidgetLog.h" #define PH_TO_NS_RGB(ns) (ns & 0xff) << 16 | (ns & 0xff00) | ((ns >> 16) & 0xff) diff --git a/mozilla/widget/src/photon/nsPhWidgetLog.h b/mozilla/widget/src/photon/nsPhWidgetLog.h deleted file mode 100644 index 73b41d91a44..00000000000 --- a/mozilla/widget/src/photon/nsPhWidgetLog.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -/* - * Used for Logging in the widget/src/photon directory. - */ - -#include -#include - -extern PRLogModuleInfo *PhWidLog; diff --git a/mozilla/widget/src/photon/nsSound.cpp b/mozilla/widget/src/photon/nsSound.cpp index c1e9a547275..4c6e5532511 100644 --- a/mozilla/widget/src/photon/nsSound.cpp +++ b/mozilla/widget/src/photon/nsSound.cpp @@ -48,7 +48,6 @@ #include "nsCOMPtr.h" #include -#include "nsPhWidgetLog.h" NS_IMPL_ISUPPORTS2(nsSound, nsISound, nsIStreamLoaderObserver) diff --git a/mozilla/widget/src/photon/nsTextHelper.cpp b/mozilla/widget/src/photon/nsTextHelper.cpp deleted file mode 100644 index fb976ae23ad..00000000000 --- a/mozilla/widget/src/photon/nsTextHelper.cpp +++ /dev/null @@ -1,272 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsTextHelper.h" -#include "nsToolkit.h" -#include "nsColor.h" -#include "nsGUIEvent.h" -#include "nsString.h" - -#include -#include "nsPhWidgetLog.h" - -NS_METHOD nsTextHelper::PreCreateWidget(nsWidgetInitData *aInitData) -{ - if (nsnull != aInitData) - { - nsTextWidgetInitData* data = (nsTextWidgetInitData *) aInitData; - mIsPassword = data->mIsPassword; - mIsReadOnly = data->mIsReadOnly; - } - - return NS_OK; -} - -NS_METHOD nsTextHelper::SetMaxTextLength(PRUint32 aChars) -{ - PtArg_t arg[2]; - - if (mWidget) - { - PtSetArg(&arg[0], Pt_ARG_MAX_LENGTH, aChars, 0); - PtSetResources(mWidget, 1, arg); - } - - return NS_OK; -} - -NS_METHOD nsTextHelper::GetText(nsString& aTextBuffer, PRUint32 aBufferSize, PRUint32& aActualSize) -{ - PtArg_t arg[2]; - int length; - char *string; - - - if (mWidget) - { - PtSetArg(&arg[0], Pt_ARG_TEXT_STRING, &string, 0); - PtGetResources(mWidget, 1, arg); - - aTextBuffer.SetLength(0); - aTextBuffer.AppendWithConversion(string); - aActualSize = aTextBuffer.Length(); - } - - return NS_OK; -} - -NS_METHOD nsTextHelper::SetText(const nsString &aText, PRUint32& aActualSize) -{ - PtArg_t arg[2]; - - mText = aText; - - if (mWidget) - { - PtSetArg(&arg[0], Pt_ARG_TEXT_STRING, - NS_ConvertUCS2toUFT8(aText).get(), 0); - PtSetResources(mWidget, 1, arg); - } - - aActualSize = aText.Length(); - return NS_OK; -} - -NS_METHOD nsTextHelper::InsertText(const nsString &aText, PRUint32 aStartPos, PRUint32 aEndPos, PRUint32& aActualSize) -{ - PtArg_t arg[2]; - nsString currentText; - PRUint32 currentTextLength; - if (mWidget) - { - PtTextModifyText(mWidget, 0, 0, aStartPos, - NS_ConvertUCS2toUTF8(aText).get(), - aText.Length()); - } - aActualSize = aText.Length(); - - /* Re-get the text and store in the local variable mText */ - GetText(currentText, 0, currentTextLength); - mText = currentText; - - return NS_OK; -} - -NS_METHOD nsTextHelper::RemoveText() -{ - PtArg_t arg[2]; - - mText.SetLength(0); - - if (mWidget) - { - PtSetArg(&arg[0], Pt_ARG_TEXT_STRING, "", 0); - PtSetResources(mWidget, 1, arg); - } - - return NS_OK; -} - -NS_METHOD nsTextHelper::SetPassword(PRBool aIsPassword) -{ - mIsPassword = aIsPassword; - return NS_OK; -} - -NS_METHOD nsTextHelper::SetReadOnly(PRBool aReadOnlyFlag, PRBool& aOldFlag) -{ - PtArg_t arg[2]; - int temp; - - aOldFlag = mIsReadOnly; - mIsReadOnly = aReadOnlyFlag; - - // Update the widget - if (mWidget) - { - if (mIsReadOnly) - temp = 0; - else - temp = 1; - - PtSetArg(&arg[0], Pt_ARG_TEXT_FLAGS, temp, Pt_EDITABLE); - PtSetResources(mWidget, 1, arg); - } - - return NS_OK; -} - -NS_METHOD nsTextHelper::SelectAll() -{ - int start, end; - - if (mWidget) - { - start = 0; - end = SHRT_MAX; - PtTextSetSelection(mWidget, &start, &end); - } - - return NS_OK; -} - -NS_METHOD nsTextHelper::SetSelection(PRUint32 aStartSel, PRUint32 aEndSel) -{ -/* The text widget is 0 based! */ - - if (mWidget) - { - int start, end; - start = aStartSel; - end = aEndSel; - - PtTextSetSelection(mWidget, &start, &end); - } - - return NS_OK; -} - - -NS_METHOD nsTextHelper::GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel) -{ -/*revisit not sure if this is 1 or 0 based! */ - - if (mWidget) - { - int start, end; - - PtTextGetSelection(mWidget, &start, &end); - - *aStartSel = start; - *aEndSel = end; - - } - - return NS_OK; -} - -NS_METHOD nsTextHelper::SetCaretPosition(PRUint32 aPosition) -{ - PtArg_t arg[2]; - - if (mWidget) - { - short CursPos = aPosition; - - PtSetArg(&arg[0], Pt_ARG_CURSOR_POSITION, CursPos, 0); - PtSetResources(mWidget, 1, arg); - } - - return NS_OK; -} - -NS_METHOD nsTextHelper::GetCaretPosition(PRUint32& aPos) -{ - PtArg_t arg[2]; - short *CaretPosition; - - if (mWidget) - { - PtSetArg(&arg[0], Pt_ARG_CURSOR_POSITION, &CaretPosition, 0); - PtGetResources(mWidget, 1, arg); - } - - aPos = PRUint32(*CaretPosition); - - return NS_OK; -} - -//------------------------------------------------------------------------- -// -// nsTextHelper constructor -// -//------------------------------------------------------------------------- - -nsTextHelper::nsTextHelper() : nsWidget(), nsITextWidget() -{ - mIsReadOnly = PR_FALSE; - mIsPassword = PR_FALSE; -} - -//------------------------------------------------------------------------- -// -// nsTextHelper destructor -// -//------------------------------------------------------------------------- -nsTextHelper::~nsTextHelper() -{ -} diff --git a/mozilla/widget/src/photon/nsTextHelper.h b/mozilla/widget/src/photon/nsTextHelper.h deleted file mode 100644 index 5a80d562f25..00000000000 --- a/mozilla/widget/src/photon/nsTextHelper.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#ifndef nsTextHelper_h__ -#define nsTextHelper_h__ - -#include "nsITextWidget.h" -#include "nsWidget.h" - -/** - * Base class for nsTextAreaWidget (obsolete) and nsTextWidget - */ - -class nsTextHelper : public nsWidget, - public nsITextWidget -{ - -public: - nsTextHelper(); - virtual ~nsTextHelper(); - - NS_IMETHOD SelectAll(); - NS_IMETHOD SetMaxTextLength(PRUint32 aChars); - NS_IMETHOD GetText(nsString& aTextBuffer, PRUint32 aBufferSize, PRUint32& aActualSize); - NS_IMETHOD SetText(const nsString &aText, PRUint32& aActualSize); - NS_IMETHOD InsertText(const nsString &aText, PRUint32 aStartPos, PRUint32 aEndPos, PRUint32& aActualSize); - NS_IMETHOD RemoveText(); - NS_IMETHOD SetPassword(PRBool aIsPassword); - NS_IMETHOD SetReadOnly(PRBool aNewReadOnlyFlag, PRBool& aOldReadOnlyFlag); - NS_IMETHOD SetSelection(PRUint32 aStartSel, PRUint32 aEndSel); - NS_IMETHOD GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel); - NS_IMETHOD SetCaretPosition(PRUint32 aPosition); - NS_IMETHOD GetCaretPosition(PRUint32& aPosition); - - NS_IMETHOD PreCreateWidget(nsWidgetInitData *aInitData); - -protected: - nsString mText; - PRBool mIsPassword; - PRBool mIsReadOnly; - -// virtual DWORD WindowExStyle(); - -}; - -#endif // nsTextHelper_h__ diff --git a/mozilla/widget/src/photon/nsTextWidget.cpp b/mozilla/widget/src/photon/nsTextWidget.cpp deleted file mode 100644 index 9a3c736749a..00000000000 --- a/mozilla/widget/src/photon/nsTextWidget.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsTextWidget.h" -#include "nsToolkit.h" -#include "nsColor.h" -#include "nsGUIEvent.h" -#include "nsString.h" - -#include "nsILookAndFeel.h" -#include "nsWidgetsCID.h" -#include "nsIComponentManager.h" - -#include "nsIDeviceContext.h" -#include "nsIFontMetrics.h" - -#include -#include "nsPhWidgetLog.h" - - -NS_IMPL_ADDREF(nsTextWidget) -NS_IMPL_RELEASE(nsTextWidget) - - -//------------------------------------------------------------------------- -// -// nsTextWidget constructor -// -//------------------------------------------------------------------------- -nsTextWidget::nsTextWidget() : nsTextHelper() -{ - mBackground = NS_RGB(124, 124, 124); -} - -//------------------------------------------------------------------------- -// -// nsTextWidget destructor -// -//------------------------------------------------------------------------- -nsTextWidget::~nsTextWidget() -{ -} - -//------------------------------------------------------------------------- -// -// Query interface implementation -// -//------------------------------------------------------------------------- -nsresult nsTextWidget::QueryInterface(const nsIID& aIID, void** aInstancePtr) -{ - nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr); - - static NS_DEFINE_IID(kInsTextWidgetIID, NS_ITEXTWIDGET_IID); - if (result == NS_NOINTERFACE && aIID.Equals(kInsTextWidgetIID)) { - *aInstancePtr = (void*) ((nsITextWidget*)this); - NS_ADDREF_THIS(); - result = NS_OK; - } - - return result; -} - -//------------------------------------------------------------------------- -// -// -//------------------------------------------------------------------------- -PRBool nsTextWidget::OnPaint() -{ - return PR_FALSE; -} - -PRBool nsTextWidget::OnResize(nsRect &aWindowRect) -{ - return PR_FALSE; -} - -NS_METHOD nsTextWidget::CreateNative( PtWidget_t* aParent ) -{ - nsresult res = NS_ERROR_FAILURE; - PtArg_t arg[5]; - PhPoint_t pos; - PhDim_t dim; - - pos.x = mBounds.x; - pos.y = mBounds.y; - dim.w = mBounds.width - 4; // Correct for border width - dim.h = mBounds.height - 4; - - PtSetArg( &arg[0], Pt_ARG_POS, &pos, 0 ); - PtSetArg( &arg[1], Pt_ARG_DIM, &dim, 0 ); - PtSetArg( &arg[2], Pt_ARG_BORDER_WIDTH, 2, 0 ); - mWidget = PtCreateWidget( PtText, aParent, 3, arg ); - if( mWidget ) - { - res = NS_OK; - PtAddEventHandler(mWidget, Ph_EV_KEY, RawEventHandler, this); - - /* Add an Activate Callback */ - PtAddCallback(mWidget, Pt_CB_ACTIVATE, handle_activate_event, this); - } - - return res; -} - -int nsTextWidget::RawEventHandler(PtWidget_t *aWidget, void *aData, PtCallbackInfo_t *aCbInfo ) -{ - nsTextWidget *me = (nsTextWidget *) aData; /* Mozilla object that created the event */ - - if( aCbInfo->reason == Pt_CB_RAW ) - { - PhEvent_t* event = aCbInfo->event; - - switch( event->type ) - { - case Ph_EV_KEY: - { - PhKeyEvent_t* keyev = (PhKeyEvent_t*) PhGetData( event ); - me->DispatchKeyEvent(keyev); - break; - } - default: - break; - } - } - - return (Pt_CONTINUE); -} - -int nsTextWidget::handle_activate_event (PtWidget_t *aWidget, void *aData, PtCallbackInfo_t *aCbinfo ) -{ - return (Pt_CONTINUE); -} diff --git a/mozilla/widget/src/photon/nsTextWidget.h b/mozilla/widget/src/photon/nsTextWidget.h deleted file mode 100644 index 125b3a15285..00000000000 --- a/mozilla/widget/src/photon/nsTextWidget.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nsTextWidget_h__ -#define nsTextWidget_h__ - -#include "nsTextHelper.h" -#include "nsITextWidget.h" - -/** - * Native Photon single line edit control wrapper. - */ - -class nsTextWidget : public nsTextHelper -{ - -public: - nsTextWidget(); - virtual ~nsTextWidget(); - - // nsISupports - NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); - NS_IMETHOD_(nsrefcnt) AddRef(void); - NS_IMETHOD_(nsrefcnt) Release(void); - - virtual PRBool OnPaint(); - virtual PRBool OnResize(nsRect &aWindowRect); - -protected: - NS_IMETHOD CreateNative(PtWidget_t *aParentWindow); - static int RawEventHandler( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo ); - static int handle_activate_event (PtWidget_t *aWidget, void *aData, PtCallbackInfo_t *aCbinfo ); -}; - -#endif // nsTextWidget_h__ diff --git a/mozilla/widget/src/photon/nsToolkit.cpp b/mozilla/widget/src/photon/nsToolkit.cpp index c5bfdfb8e1e..ea9ede0414e 100644 --- a/mozilla/widget/src/photon/nsToolkit.cpp +++ b/mozilla/widget/src/photon/nsToolkit.cpp @@ -38,8 +38,6 @@ #include "nsToolkit.h" #include "nscore.h" -#include "nsPhWidgetLog.h" - // // Static thread local storage index of the Toolkit // object associated with a given thread... diff --git a/mozilla/widget/src/photon/nsWidget.cpp b/mozilla/widget/src/photon/nsWidget.cpp index bf9dba5a325..fdcfdf188e4 100644 --- a/mozilla/widget/src/photon/nsWidget.cpp +++ b/mozilla/widget/src/photon/nsWidget.cpp @@ -58,7 +58,6 @@ #include "nsReadableUtils.h" #include "nsIPref.h" -#include "nsPhWidgetLog.h" #include #include @@ -902,6 +901,7 @@ PRBool nsWidget::DispatchKeyEvent( PhKeyEvent_t *aPhKeyEvent ) { // result = w->OnKey(keyEvent); InitKeyEvent(aPhKeyEvent, this, keyEvent, NS_KEY_PRESS); + if( aPhKeyEvent->key_cap == Pk_Alt_L || aPhKeyEvent->key_cap == Pk_Alt_R ) keyEvent.message = NS_KEY_DOWN; result = w->OnKey(keyEvent); } else if (aPhKeyEvent->key_flags & Pk_KF_Key_Repeat) { diff --git a/mozilla/widget/src/photon/nsWidgetFactory.cpp b/mozilla/widget/src/photon/nsWidgetFactory.cpp index 7777bfa9c7c..158ce21dfe5 100644 --- a/mozilla/widget/src/photon/nsWidgetFactory.cpp +++ b/mozilla/widget/src/photon/nsWidgetFactory.cpp @@ -62,10 +62,6 @@ #include "nsFilePicker.h" -#include -struct PRLogModuleInfo *PhWidLog = nsnull; -#include "nsPhWidgetLog.h" - NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow) NS_GENERIC_FACTORY_CONSTRUCTOR(ChildWindow) NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppShell) diff --git a/mozilla/widget/src/photon/nsWindow.cpp b/mozilla/widget/src/photon/nsWindow.cpp index a1d62463640..e433e95a1b5 100644 --- a/mozilla/widget/src/photon/nsWindow.cpp +++ b/mozilla/widget/src/photon/nsWindow.cpp @@ -38,7 +38,6 @@ * ***** END LICENSE BLOCK ***** */ -#include "nsPhWidgetLog.h" #include #include #include "PtRawDrawContainer.h" @@ -78,6 +77,16 @@ nsIRollupListener *nsWindow::gRollupListener = nsnull; nsIWidget *nsWindow::gRollupWidget = nsnull; static PtWidget_t *gMenuRegion; +/* avoid making a costly PhWindowQueryVisible call */ +static PhRect_t gConsoleRect; +static PRBool gConsoleRectValid = PR_FALSE; +#define QueryVisible( ) {\ + if( gConsoleRectValid == PR_FALSE ) { \ + PhWindowQueryVisible( Ph_QUERY_GRAPHICS, 0, 1, &gConsoleRect ); \ + gConsoleRectValid = PR_TRUE;\ + } \ + } + //------------------------------------------------------------------------- // // nsWindow constructor @@ -117,13 +126,12 @@ NS_IMETHODIMP nsWindow::WidgetToScreen( const nsRect& aOldRect, nsRect& aNewRect PhPoint_t pos, offset; PtWidget_t *disjoint = PtFindDisjoint( mWidget ); - PhRect_t console; - PhWindowQueryVisible( Ph_QUERY_GRAPHICS, 0, 1, &console ); + QueryVisible( ); PtGetAbsPosition( disjoint, &pos.x, &pos.y ); PtWidgetOffset( mWidget, &offset ); - aNewRect.x = pos.x + offset.x + aOldRect.x - console.ul.x; - aNewRect.y = pos.y + offset.y + aOldRect.y - console.ul.y; + aNewRect.x = pos.x + offset.x + aOldRect.x - gConsoleRect.ul.x; + aNewRect.y = pos.y + offset.y + aOldRect.y - gConsoleRect.ul.y; aNewRect.width = aOldRect.width; aNewRect.height = aOldRect.height; @@ -304,11 +312,9 @@ NS_METHOD nsWindow::CreateNative( PtWidget_t *parentWidget ) { } else if ((mWindowType == eWindowType_toplevel) && parentWidget) { - PhRect_t console; - PhWindowQueryVisible( Ph_QUERY_GRAPHICS, 0, 1, &console ); - - pos.x += console.ul.x; - pos.y += console.ul.y; + QueryVisible( ); + pos.x += gConsoleRect.ul.x; + pos.y += gConsoleRect.ul.y; PtSetArg( &arg[arg_count++], Pt_ARG_POS, &pos, 0 ); } @@ -366,7 +372,7 @@ NS_METHOD nsWindow::CreateNative( PtWidget_t *parentWidget ) { PtSetArg( &arg[arg_count++], Pt_ARG_FLAGS, Pt_DELAY_REALIZE, Pt_DELAY_REALIZE); PtSetArg( &arg[arg_count++], Pt_ARG_WINDOW_RENDER_FLAGS, render_flags, -1 ); PtSetArg( &arg[arg_count++], Pt_ARG_WINDOW_MANAGED_FLAGS, 0, Ph_WM_CLOSE ); - PtSetArg( &arg[arg_count++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Ph_WM_CLOSE, ~0 ); + PtSetArg( &arg[arg_count++], Pt_ARG_WINDOW_NOTIFY_FLAGS, Ph_WM_CLOSE|Ph_WM_CONSWITCH|Ph_WM_FOCUS, ~0 ); PtSetArg( &arg[arg_count++], Pt_ARG_FILL_COLOR, Pg_TRANSPARENT, 0 ); PtRawCallback_t cb_raw = { Ph_EV_INFO, EvInfo, NULL }; @@ -387,7 +393,7 @@ NS_METHOD nsWindow::CreateNative( PtWidget_t *parentWidget ) { PtAddCallback(mWidget, Pt_CB_RESIZE, ResizeHandler, nsnull ); PtAddEventHandler( mWidget, Ph_EV_PTR_MOTION_BUTTON | Ph_EV_PTR_MOTION_NOBUTTON | - Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE |Ph_EV_BOUNDARY|Ph_EV_DRAG /* | Ph_EV_WM | Ph_EV_EXPOSE */ + Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE |Ph_EV_BOUNDARY|Ph_EV_DRAG , RawEventHandler, this ); PtArg_t arg; @@ -402,10 +408,10 @@ NS_METHOD nsWindow::CreateNative( PtWidget_t *parentWidget ) { else if( mWindowType == eWindowType_popup ) { PtAddEventHandler( mClientWidget, Ph_EV_PTR_MOTION_BUTTON | Ph_EV_PTR_MOTION_NOBUTTON | - Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE |Ph_EV_BOUNDARY | Ph_EV_WM /*| Ph_EV_EXPOSE*/, + Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE |Ph_EV_BOUNDARY, RawEventHandler, this ); - PtAddEventHandler( mWidget, Ph_EV_DRAG /*| Ph_EV_EXPOSE*/, RawEventHandler, this ); + PtAddEventHandler( mWidget, Ph_EV_DRAG, RawEventHandler, this ); PtArg_t arg; PtRawCallback_t callback; @@ -579,12 +585,10 @@ NS_IMETHODIMP nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) // center the dialog if( mWindowType == eWindowType_dialog ) { PhPoint_t p; - PhRect_t console; - PhWindowQueryVisible( Ph_QUERY_GRAPHICS, 0, 1, &console ); - + QueryVisible( ); PtCalcAbsPosition( NULL, NULL, &dim, &p ); - p.x -= console.ul.x; - p.y -= console.ul.y; + p.x -= gConsoleRect.ul.x; + p.y -= gConsoleRect.ul.y; Move(p.x, p.y); // the move should be in coordinates assuming the console is 0, 0 } if( aRepaint == PR_FALSE ) PtStartFlux(mWidget); @@ -639,6 +643,19 @@ int nsWindow::WindowWMHandler( PtWidget_t *widget, void *data, PtCallbackInfo_t NS_RELEASE(win); } break; + + case Ph_WM_CONSWITCH: + gConsoleRectValid = PR_FALSE; /* force a call tp PhWindowQueryVisible() next time, since we might have moved this window into a different console */ + /* rollup the menus */ + if( gRollupWidget && gRollupListener ) gRollupListener->Rollup(); + break; + + case Ph_WM_FOCUS: + if( we->event_state == Ph_WM_EVSTATE_FOCUSLOST ) { + /* rollup the menus */ + if( gRollupWidget && gRollupListener ) gRollupListener->Rollup(); + } + break; } return Pt_CONTINUE; @@ -820,16 +837,12 @@ int nsWindow::EvInfo( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo ) // //------------------------------------------------------------------------- NS_METHOD nsWindow::Move( PRInt32 aX, PRInt32 aY ) { - PRInt32 origX, origY; - - if( mWindowType != eWindowType_popup && (mBounds.x == aX) && (mBounds.y == aY) ) { + if( mWindowType != eWindowType_popup && (mBounds.x == aX) && (mBounds.y == aY) ) return NS_OK; - } - /* Keep an untouched version of the coordinates laying around for comparison */ - origX=aX; - origY=aY; + mBounds.x = aX; + mBounds.y = aY; switch( mWindowType ) { case eWindowType_popup: @@ -864,23 +877,20 @@ NS_METHOD nsWindow::Move( PRInt32 aX, PRInt32 aY ) { case eWindowType_dialog: case eWindowType_toplevel: /* Offset to the current virtual console */ - PhRect_t console; - PhWindowQueryVisible( Ph_QUERY_GRAPHICS, 0, 1, &console ); - aX += console.ul.x; - aY += console.ul.y; + QueryVisible( ); + aX += gConsoleRect.ul.x; + aY += gConsoleRect.ul.y; break; } - /* Call my base class */ - nsresult res = nsWidget::Move(aX, aY); + if( mWidget ) { + if(( mWidget->area.pos.x != aX ) || ( mWidget->area.pos.y != aY )) { + PhPoint_t pos = { aX, aY }; + PtSetResource( mWidget, Pt_ARG_POS, &pos, 0 ); + } + } - /* If I am a top-level window my origin should always be 0,0 */ - if( mWindowType != eWindowType_child ) { - mBounds.x = origX; - mBounds.y = origY; - } - - return res; + return NS_OK; } int nsWindow::MenuRegionCallback( PtWidget_t *widget, void *data, PtCallbackInfo_t *cbinfo ) {