This commit is contained in:
rods 1998-06-05 21:37:19 +00:00
Родитель df4fdf7c4e
Коммит 799b1218ab
3 изменённых файлов: 205 добавлений и 0 удалений

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

@ -45,6 +45,7 @@ EXTRA_DSO_LDOPTS+= -lX11 -lm
endif
CPPSRCS= \
nsTextHelper.cpp \
nsCheckButton.cpp \
nsScrollbar.cpp \
nsButton.cpp \
@ -55,6 +56,7 @@ CPPSRCS= \
nsToolkit.cpp
CPP_OBJS= \
./$(OBJDIR)/nsTextHelper.o \
./$(OBJDIR)/nsCheckButton.o \
./$(OBJDIR)/nsButton.o \
./$(OBJDIR)/nsScrollbar.o \

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

@ -0,0 +1,146 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsTextHelper.h"
#include "nsToolkit.h"
#include "nsColor.h"
#include "nsGUIEvent.h"
#include "nsString.h"
#include "nsStringUtil.h"
void nsTextHelper::PreCreateWidget(nsWidgetInitData *aInitData)
{
if (nsnull != aInitData) {
nsTextWidgetInitData* data = (nsTextWidgetInitData *) aInitData;
mIsPassword = data->mIsPassword;
}
}
void nsTextHelper::SetMaxTextLength(PRUint32 aChars)
{
//::SendMessage(mWnd, EM_SETLIMITTEXT, (WPARAM) (INT)aChars, 0);
}
PRUint32 nsTextHelper::GetText(nsString& aTextBuffer, PRUint32 aBufferSize) {
/*int length = GetWindowTextLength(mWnd);
int bufLength = length + 1;
NS_ALLOC_CHAR_BUF(buf, 512, bufLength);
int charsCopied = GetWindowText(mWnd, buf, bufLength);
aTextBuffer.SetLength(0);
aTextBuffer.Append(buf);
NS_FREE_CHAR_BUF(buf);
return(0);
}
PRUint32 nsTextHelper::SetText(const nsString &aText)
{
/*
NS_ALLOC_STR_BUF(buf, aText, 512);
SetWindowText(mWnd, buf);
NS_FREE_STR_BUF(buf);
return(aText.Length());
*/
return 0;
}
PRUint32 nsTextHelper::InsertText(const nsString &aText, PRUint32 aStartPos, PRUint32 aEndPos)
{
// NOT IMPLEMENTED
return(0);
}
void nsTextHelper::RemoveText()
{
//SetWindowText(mWnd, "");
}
void nsTextHelper::SetPassword(PRBool aIsPassword)
{
mIsPassword = aIsPassword;
}
PRBool nsTextHelper::SetReadOnly(PRBool aReadOnlyFlag)
{
PRBool oldSetting = mIsReadOnly;
mIsReadOnly = aReadOnlyFlag;
return(oldSetting);
}
void nsTextHelper::SelectAll()
{
//::SendMessage(mWnd, EM_SETSEL, (WPARAM) 0, (LPARAM)-1);
}
void nsTextHelper::SetSelection(PRUint32 aStartSel, PRUint32 aEndSel)
{
//::SendMessage(mWnd, EM_SETSEL, (WPARAM) (INT)aStartSel, (INT) (LPDWORD)aEndSel);
}
void nsTextHelper::GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel)
{
//::SendMessage(mWnd, EM_GETSEL, (WPARAM) (LPDWORD)aStartSel, (LPARAM) (LPDWORD)aEndSel);
}
void nsTextHelper::SetCaretPosition(PRUint32 aPosition)
{
}
PRUint32 nsTextHelper::GetCaretPosition()
{
return(0);
}
//-------------------------------------------------------------------------
//
// nsTextHelper constructor
//
//-------------------------------------------------------------------------
nsTextHelper::nsTextHelper(nsISupports *aOuter) : nsWindow(aOuter)
{
mIsReadOnly = PR_FALSE;
mIsPassword = PR_FALSE;
}
//-------------------------------------------------------------------------
//
// nsTextHelper destructor
//
//-------------------------------------------------------------------------
nsTextHelper::~nsTextHelper()
{
}
//-------------------------------------------------------------------------
//
// Clear window before paint
//
//-------------------------------------------------------------------------
PRBool nsTextHelper::AutoErase()
{
return(PR_TRUE);
}

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

@ -0,0 +1,57 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsTextHelper_h__
#define nsTextHelper_h__
#include "nsITextWidget.h"
#include "nsWindow.h"
/**
* Base class for nsTextAreaWidget and nsTextWidget
*/
class nsTextHelper : public nsWindow, public nsITextWidget
{
public:
nsTextHelper(nsISupports *aOuter);
virtual ~nsTextHelper();
virtual void SelectAll();
virtual void SetMaxTextLength(PRUint32 aChars);
virtual PRUint32 GetText(nsString& aTextBuffer, PRUint32 aBufferSize);
virtual PRUint32 SetText(const nsString &aText);
virtual PRUint32 InsertText(const nsString &aText, PRUint32 aStartPos, PRUint32 aEndPos);
virtual void RemoveText();
virtual void SetPassword(PRBool aIsPassword);
virtual PRBool SetReadOnly(PRBool aReadOnlyFlag);
virtual void SetSelection(PRUint32 aStartSel, PRUint32 aEndSel);
virtual void GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel);
virtual void SetCaretPosition(PRUint32 aPosition);
virtual PRUint32 GetCaretPosition();
virtual void PreCreateWidget(nsWidgetInitData *aInitData);
virtual PRBool AutoErase();
protected:
PRBool mIsPassword;
PRBool mIsReadOnly;
};
#endif // nsTextHelper_h__