added additional FileWidget support

This commit is contained in:
rods 1998-06-15 16:29:00 +00:00
Родитель 308eb603eb
Коммит 6aea94df78
3 изменённых файлов: 54 добавлений и 5 удалений

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

@ -44,6 +44,7 @@ void nsFileWidget::Create(nsIWidget *aParent,
}
//-------------------------------------------------------------------------
void nsFileWidget:: Create(nsIWidget *aParent,
nsString& aTitle,
nsMode aMode,
@ -69,11 +70,12 @@ void nsFileWidget:: Create(nsIWidget *aParent,
if (DBG) fprintf(stderr, "Parent 0x%x\n", parentWidget);
mWidget = XmCreateFileSelectionDialog(parentWidget, "filesb", NULL, 0);
XtVaSetValues(mWidget, XmNdialogType, XmDIALOG_FULL_APPLICATION_MODAL, nsnull);
XtAddCallback(mWidget, XmNcancelCallback, nsXtWidget_FSBCancel_Callback, NULL);
XtAddCallback(mWidget, XmNokCallback, nsXtWidget_FSBOk_Callback, NULL);
XtAddCallback(mWidget, XmNcancelCallback, nsXtWidget_FSBCancel_Callback, this);
XtAddCallback(mWidget, XmNokCallback, nsXtWidget_FSBOk_Callback, this);
XtManageChild(mWidget);
//XtManageChild(mWidget);
}
void nsFileWidget::Create(nsNativeWindow aParent,
@ -103,15 +105,36 @@ nsresult nsFileWidget::QueryInterface(REFNSIID aIID, void** aInstancePtr)
}
//-------------------------------------------------------------------------
//
// Ok's the dialog
//
//-------------------------------------------------------------------------
void nsFileWidget::OnOk()
{
XtUnmanageChild(mWidget);
}
//-------------------------------------------------------------------------
//
// Cancel the dialog
//
//-------------------------------------------------------------------------
void nsFileWidget::OnCancel()
{
XtUnmanageChild(mWidget);
}
//-------------------------------------------------------------------------
//
// Show - Display the file dialog
//
//-------------------------------------------------------------------------
void nsFileWidget::Show(PRBool bState)
{
nsresult result = nsEventStatus_eIgnore;
XtManageChild(mWidget);
/*char fileBuffer[MAX_PATH];
fileBuffer[0] = '\0';
@ -234,6 +257,16 @@ void nsFileWidget::AggFileWidget::Create( nsIWidget *aParent,
GET_OUTER()->Create(aParent, aTitle, aMode, aContext, aToolkit, aInitData);
}
void nsFileWidget::AggFileWidget::OnOk()
{
GET_OUTER()->OnOk();
}
void nsFileWidget::AggFileWidget::OnCancel()
{
GET_OUTER()->OnCancel();
}
void nsFileWidget::AggFileWidget::Show(PRBool bState)
{
GET_OUTER()->Show(bState);

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

@ -61,7 +61,11 @@ class nsFileWidget : public nsWindow
// nsIFileWidget part
virtual void Show(PRBool bState);
virtual void GetFile(nsString& aFile);
virtual void SetFilterList(PRUint32 aNumberOfFilters,const nsString aTitles[],const nsString aFilters[]);
virtual void SetFilterList(PRUint32 aNumberOfFilters,
const nsString aTitles[],
const nsString aFilters[]);
virtual void OnOk();
virtual void OnCancel();
protected:
@ -106,6 +110,8 @@ class nsFileWidget : public nsWindow
const nsString aFilters[]);
virtual PRBool Show();
virtual void OnOk();
virtual void OnCancel();
};
AggFileWidget mAggWidget;

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

@ -21,6 +21,7 @@
#include "nsWindow.h"
#include "nsCheckButton.h"
#include "nsFileWidget.h"
#include "nsGUIEvent.h"
#include "stdio.h"
@ -313,9 +314,18 @@ void nsXtWidget_Text_Callback(Widget w, XtPointer p, XtPointer call_data)
//==============================================================
void nsXtWidget_FSBCancel_Callback(Widget w, XtPointer p, XtPointer call_data)
{
nsFileWidget * widgetWindow = (nsFileWidget *) p ;
if (p != nsnull) {
printf("OnCancel\n");
widgetWindow->OnCancel();
}
}
//==============================================================
void nsXtWidget_FSBOk_Callback(Widget w, XtPointer p, XtPointer call_data)
{
nsFileWidget * widgetWindow = (nsFileWidget *) p ;
if (p != nsnull) {
widgetWindow->OnOk();
}
}