Skip to content

Commit

Permalink
Removed nsObject.cpp and nsObject.h. Removed commented out code.
Browse files Browse the repository at this point in the history
added NS_ERROR_NO_AGGREATION to widget factory. marked code with XXX where
additional work is required. Removed unused global variables in nsWindow.cpp
  • Loading branch information
kmcclusk%netscape.com committed Oct 8, 1998
1 parent da48864 commit 916384f
Show file tree
Hide file tree
Showing 44 changed files with 175 additions and 635 deletions.
2 changes: 0 additions & 2 deletions widget/src/motif/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ CPPSRCS= \
nsMenuItem.cpp \
nsPopUpMenu.cpp \
nsWidgetSupport.cpp \
nsObject.cpp \
nsComboBox.cpp \
nsTextHelper.cpp \
nsTextAreaWidget.cpp \
Expand Down Expand Up @@ -78,7 +77,6 @@ CPP_OBJS= \
./$(OBJDIR)/nsImageButton.o \
./$(OBJDIR)/nsToolBar.obj \
./$(OBJDIR)/nsWidgetSupport.o \
./$(OBJDIR)/nsObject.o \
./$(OBJDIR)/nsComboBox.o \
./$(OBJDIR)/nsFileWidget.o \
./$(OBJDIR)/nsTextHelper.o \
Expand Down
1 change: 0 additions & 1 deletion widget/src/motif/nsAppShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ NS_METHOD nsAppShell::Run()
{
XtRealizeWidget(mTopLevel);

// XtAppMainLoop(mAppContext);
XEvent event;
for (;;) {
XtAppNextEvent(mAppContext, &event);
Expand Down
6 changes: 1 addition & 5 deletions widget/src/motif/nsAppShell.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,11 @@ class nsAppShell : public nsIAppShell
NS_DECL_ISUPPORTS

// nsIAppShellInterface

NS_IMETHOD Create(int* argc, char ** argv);
NS_IMETHOD Run();
NS_IMETHOD Exit();

NS_IMETHOD SetDispatchListener(nsDispatchListener* aDispatchListener);

virtual void* GetNativeData(PRUint32 aDataType);

virtual void* GetNativeData(PRUint32 aDataType);
};

#endif // nsAppShell_h__
Expand Down
3 changes: 1 addition & 2 deletions widget/src/motif/nsButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,12 @@ PRBool nsButton::OnMove(PRInt32, PRInt32)

PRBool nsButton::OnPaint(nsPaintEvent &aEvent)
{
//printf("** nsButton::OnPaint **\n");
return PR_FALSE;
}

PRBool nsButton::OnResize(nsSizeEvent &aEvent)
{
return PR_FALSE;
return PR_FALSE;
}


1 change: 0 additions & 1 deletion widget/src/motif/nsButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#ifndef nsButton_h__
#define nsButton_h__

//#include "nsdefs.h"
#include "nsWindow.h"
#include "nsIButton.h"

Expand Down
8 changes: 1 addition & 7 deletions widget/src/motif/nsCheckButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@ NS_METHOD nsCheckButton::Create(nsIWidget *aParent,

InitCallbacks();

/*XtAddCallback(mWidget,
XmNvalueChangedCallback,
nsXtWidget_Toggle_Callback,
this);*/

XtAddCallback(mWidget,
XmNarmCallback,
nsXtWidget_Toggle_ArmCallback,
Expand Down Expand Up @@ -266,13 +261,12 @@ PRBool nsCheckButton::OnMove(PRInt32, PRInt32)

PRBool nsCheckButton::OnPaint(nsPaintEvent &aEvent)
{
//printf("** nsCheckButton::OnPaint **\n");
return PR_FALSE;
}

PRBool nsCheckButton::OnResize(nsSizeEvent &aEvent)
{
return PR_FALSE;
return PR_FALSE;
}


30 changes: 14 additions & 16 deletions widget/src/motif/nsCheckButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,20 @@ class nsCheckButton : public nsWindow,
NS_IMETHOD SetState(const PRBool aState);
NS_IMETHOD GetState(PRBool& aState);



NS_IMETHOD Create(nsIWidget *aParent,
const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext = nsnull,
nsIAppShell *aAppShell = nsnull,
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);
NS_IMETHOD Create(nsIWidget *aParent,
const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext = nsnull,
nsIAppShell *aAppShell = nsnull,
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 OnMove(PRInt32 aX, PRInt32 aY);
virtual PRBool OnPaint(nsPaintEvent &aEvent);
Expand Down
99 changes: 33 additions & 66 deletions widget/src/motif/nsComboBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ PRInt32 nsComboBox::GetSelectedIndex()
}
}
} else {
NS_ASSERTION(0, "Multi selection list box does not support GetSlectedIndex()");
NS_ASSERTION(PR_FALSE, "Multi selection list box does not support GetSlectedIndex()");
}
return -1;
}
Expand Down Expand Up @@ -288,7 +288,7 @@ PRInt32 nsComboBox::GetSelectedCount()
PRInt32 inx = GetSelectedIndex();
return (inx == -1? 0 : 1);
} else {
return 0;//::SendMessage(mWnd, LB_GETSELCOUNT, (int)0, (LPARAM)0);
return 0;
}
}

Expand All @@ -310,10 +310,7 @@ NS_METHOD nsComboBox::GetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize)
//-------------------------------------------------------------------------
NS_METHOD nsComboBox::Deselect()
{
if (!mMultiSelect) {
//::SendMessage(mWnd, LB_SETCURSEL, (WPARAM)-1, (LPARAM)0);
} else {
// this is an error
if (mMultiSelect) {
return NS_ERROR_FAILURE;
}

Expand Down Expand Up @@ -361,8 +358,6 @@ NS_METHOD nsComboBox::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) {
Expand All @@ -372,70 +367,42 @@ NS_METHOD nsComboBox::Create(nsIWidget *aParent,
InitToolkit(aToolkit, aParent);
InitDeviceContext(aContext, parentWidget);

if (DBG) fprintf(stderr, "Parent 0x%x\n", parentWidget);

/*mWidget = ::XtVaCreateManagedWidget("",
xmListWidgetClass,
parentWidget,
XmNitemCount, 0,
XmNwidth, aRect.width,
XmNheight, aRect.height,
XmNx, aRect.x,
XmNy, aRect.y,
nsnull);
*/
Arg args[30];
int argc;

argc = 0;
XtSetArg(args[argc], XmNx, 0); argc++;
XtSetArg(args[argc], XmNy, 0); argc++;
mPullDownMenu = XmCreatePulldownMenu(parentWidget, "pulldown", args, argc);

argc = 0;
XtSetArg(args[argc], XmNmarginHeight, 0); argc++;
XtSetArg(args[argc], XmNmarginWidth, 0); argc++;
XtSetArg(args[argc], XmNrecomputeSize, False); argc++;
XtSetArg(args[argc], XmNresizeHeight, False); argc++;
XtSetArg(args[argc], XmNresizeWidth, False); argc++;
XtSetArg(args[argc], XmNspacing, False); argc++;
XtSetArg(args[argc], XmNborderWidth, 0); argc++;
XtSetArg(args[argc], XmNnavigationType, XmTAB_GROUP); argc++;
XtSetArg(args[argc], XmNtraversalOn, True); argc++;
XtSetArg(args[argc], XmNorientation, XmVERTICAL); argc++;
XtSetArg(args[argc], XmNadjustMargin, False); argc++;
XtSetArg(args[argc], XmNsubMenuId, mPullDownMenu); argc++;
XtSetArg(args[argc], XmNuserData, (XtPointer)this); argc++;
XtSetArg(args[argc], XmNx, aRect.x); argc++;
XtSetArg(args[argc], XmNy, aRect.y); argc++;
XtSetArg(args[argc], XmNwidth, aRect.width); argc++;
XtSetArg(args[argc], XmNheight, aRect.height); argc++;
mWidget = XmCreateOptionMenu(parentWidget, "", args, argc);

mOptionMenu = XmOptionLabelGadget(mWidget);
XtUnmanageChild(mOptionMenu);

/*XtVaSetValues(mWidget,
XmNx, aRect.x,
XmNy, aRect.y,
XmNwidth, aRect.width,
XmNheight, aRect.height,
nsnull);*/
//XtManageChild(mPullDownMenu);
//XtManageChild(mOptionMenu);

//XtSetMappedWhenManaged(mOptionMenu, False);
//XtManageChild(mOptionMenu);


//if (DBG)
Arg args[30];
int argc;

argc = 0;
XtSetArg(args[argc], XmNx, 0); argc++;
XtSetArg(args[argc], XmNy, 0); argc++;
mPullDownMenu = XmCreatePulldownMenu(parentWidget, "pulldown", args, argc);

argc = 0;
XtSetArg(args[argc], XmNmarginHeight, 0); argc++;
XtSetArg(args[argc], XmNmarginWidth, 0); argc++;
XtSetArg(args[argc], XmNrecomputeSize, False); argc++;
XtSetArg(args[argc], XmNresizeHeight, False); argc++;
XtSetArg(args[argc], XmNresizeWidth, False); argc++;
XtSetArg(args[argc], XmNspacing, False); argc++;
XtSetArg(args[argc], XmNborderWidth, 0); argc++;
XtSetArg(args[argc], XmNnavigationType, XmTAB_GROUP); argc++;
XtSetArg(args[argc], XmNtraversalOn, True); argc++;
XtSetArg(args[argc], XmNorientation, XmVERTICAL); argc++;
XtSetArg(args[argc], XmNadjustMargin, False); argc++;
XtSetArg(args[argc], XmNsubMenuId, mPullDownMenu); argc++;
XtSetArg(args[argc], XmNuserData, (XtPointer)this); argc++;
XtSetArg(args[argc], XmNx, aRect.x); argc++;
XtSetArg(args[argc], XmNy, aRect.y); argc++;
XtSetArg(args[argc], XmNwidth, aRect.width); argc++;
XtSetArg(args[argc], XmNheight, aRect.height); argc++;
mWidget = XmCreateOptionMenu(parentWidget, "", args, argc);

mOptionMenu = XmOptionLabelGadget(mWidget);
XtUnmanageChild(mOptionMenu);

// save the event callback function
mEventCallback = aHandleEventFunction;

//InitCallbacks();
return NS_OK;

}

//-------------------------------------------------------------------------
Expand Down
52 changes: 25 additions & 27 deletions widget/src/motif/nsComboBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,43 +50,41 @@ class nsComboBox : public nsWindow,
NS_IMETHOD SelectItem(PRInt32 aPosition);
NS_IMETHOD Deselect() ;

NS_IMETHOD Create(nsIWidget *aParent,
const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell = nsnull,
nsIToolkit *aToolkit = nsnull,
nsWidgetInitData *aInitData = nsnull);
NS_IMETHOD Create(nsIWidget *aParent,
const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell = nsnull,
nsIToolkit *aToolkit = nsnull,
nsWidgetInitData *aInitData = nsnull);

NS_IMETHOD Create(nsNativeWidget aParent,
const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell = nsnull,
nsIToolkit *aToolkit = nsnull,
nsWidgetInitData *aInitData = nsnull);
NS_IMETHOD Create(nsNativeWidget aParent,
const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell = nsnull,
nsIToolkit *aToolkit = nsnull,
nsWidgetInitData *aInitData = nsnull);

NS_IMETHOD SetForegroundColor(const nscolor &aColor);
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
NS_IMETHOD SetForegroundColor(const nscolor &aColor);
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);

virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
virtual PRBool OnPaint(nsPaintEvent & aEvent);
virtual PRBool OnResize(nsSizeEvent &aEvent);
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
virtual PRBool OnPaint(nsPaintEvent & aEvent);
virtual PRBool OnResize(nsSizeEvent &aEvent);

// nsIComboBox interface
NS_IMETHOD SetMultipleSelection(PRBool aMultipleSelections);
PRInt32 GetSelectedCount();
NS_IMETHOD GetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize);
NS_IMETHOD SetMultipleSelection(PRBool aMultipleSelections);
PRInt32 GetSelectedCount();
NS_IMETHOD GetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize);

protected:
Widget mPullDownMenu;
Widget mOptionMenu;
PRBool mMultiSelect;

Widget * mItems; // an array of Widgets
int mMaxNumItems;
int mNumItems;

Widget *mItems;
int mMaxNumItems;
int mNumItems;
};

#endif // nsComboBox_h__
6 changes: 3 additions & 3 deletions widget/src/motif/nsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ NS_METHOD nsDialog::Create(nsIWidget *aParent,
XmNy, aRect.y,
nsnull);

// Initially used xmDrawingAreaWidgetClass instead of
// newManageClass. Drawing area will spontaneously resize
// to fit it's contents.
// Must use newManageClass instead of xmDrawingAreaWidgetClass
// Drawing area will spontaneously resize to fit it's contents
// which is undesirable.

mWidget = ::XtVaCreateManagedWidget("drawingArea",
newManageClass,
Expand Down
1 change: 0 additions & 1 deletion widget/src/motif/nsDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#ifndef nsDialog_h__
#define nsDialog_h__

//#include "nsdefs.h"
#include "nsWindow.h"
#include "nsIDialog.h"

Expand Down
Loading

0 comments on commit 916384f

Please sign in to comment.